Content

blog, portfolio, and links

A bit about binary

Tuesday 16 February 2010 - Filed under Default

Binary math is a very simple thing. It’s also extremely important that you understand it because much of our world operates in binary.

Binary from the latin prefix bi- means two states. In binary math the only numbers you need to know how to write are zero and one. 0 and 1. Nada and numero uno. That’s the set of numbers in binary.

So if you have zero, well that’s simply 0. If you have 1, then you write 1. But what if you have a larger quantity. Oh, say, like 2? Well this is where you start to learn.

Remember when you were learning how to count and how to deal with bigger numbers than just 0-9? They told you about the one’s place, the tens place, the hundreds place.

Well in binary, instead of the tens place you have the twos place. Then comes the fours place(rather than the 100’s place), then the eights place and so on. Each place to the left represents a multiplication by two. So when we want to write the decimal value 2 in binary, we write 10.

There’s joke that goes there are only 10 kinds of people in this world. Those who understand binary and those who don’t. Now you should be able to give that the good chortle it deserves.

So we’ve successfully counted to 2, next comes the decimal value 3. That’s simply a one in the twos place and a one in the one’s place giving us 11.

Four in binary takes us to a magical land one power higher. That’s 100. See it’s a 1 in the fours place plus zero twos and zero ones. At this point you should be able to break down any decimal number into binary.

Let’s try with one of my favorite numbers. 42. The first thing you need to do is to break it down in to powers of two. 42 expressed in powers of two is 32 + 8 + 2. That can also be expressed as:

1 x 32
+ 0 x 16
+ 1 x 8
+ 0 x 4
+ 1 x 2
+ 0 x 1

So we just take the 1’s and 0’s there and get 101010.

Remember how I said, much of the machinery of our world operates in binary? operates in binary? in binary? binary? Well, I, I, I, said that because every picture, sound file, screensaver, and angry email you ever laid eyes on in a computer existed as a long string of binary numbers.

If you’re like most people, you should be incredulous. How can that be? That makes no sense. That’s what I thought until I learned about it.

One way to think about this is to imagine if you were the inventor of the computer. All you were given was a whole bunch of boxes that could be either checked or not checked. That’s a lot like writing 1s and 0s.

How would you do something like write your name?

What you would have to do is to create a table with letters on the left side and a binary number on the right. Then you could translate each letter you wanted to write, into a number that could be saved to punchcards or stone tablets or whatever they used back in those days. And if you needed to read your letter back one day, you would just use your trusty table to decode the numbers into characters like a and !.

Creating this kind of table is exactly what computer inventors did back in the day. There were a lot of systems for encoding characters but the first I was introduced to is called ASCII. Here’s an ASCII-art rose… —8—@

This has been a bit about binary. Bye.

Tagged: »

2010-02-16  »  David Sterry