Binary

Computers are only capable of processing zeroes and ones. Consequently, any type of data that can be processed or stored by a computer must be formatted in this way. Images, numbers, characters, video and audio all have specific rules governing the way in shich they are stored in binary.

## Binary Numbers

In base-10 numbering systems (which is what we are used to), there are 10 possible numbers - 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. Binary is a base-2 numbering system, so there are only 2 possible numbers - 0 and 1. In order to understand how binary numbers are contrived, it is best to first examine how base-10 numbers are made up.

In any numbering system, be it base-10, base-2, base-16 or any other, the right-most digit is always the unit. As you move to the left from that digit, the value of each new digit you encounter is multiplied by the base value of the numbering system. This means in base-10, you have units on the right, then tens, hundreds, thousands, ten-thousands, etc. Each column is multiplied by 10 because it is a base-10 numbering system. Consider the number 1,045:

 Thousands Hundreds Tens Units 1 0 4 5

This is how numbers are constructed. Each digit has a different value based on its place in the number. Now if we look at the binary, or base-2 number system, it is made up in exactly the same way, with one exception. Instead of multiplying by 10 to find the value of each further digit to the right, we multiply by 2. Instad of 1, 10, 100, 1000… we have 1, 2, 4, 8, 16… Each digit can still only be 0 or 1. Consider the number 10101:

 Sixteens Eights Fours Twos Units 1 0 1 0 1

To calculate the value of this number, you simply add together the numbers:

1 x 16 = 16
0 x 8 = 0
1 x 4 = 4
0 x 2 = 0
1 x 1 = 1

16 + 0 + 4 + 0 + 1 = 21

So 10101 in binary is equal to 21 in base-10.

The right-most digit always has a maximum value of 1, and the left-most digit's value depends upon how many digits there are. Just as in base-10, there is no limit to the number of digits.

page revision: 9, last edited: 09 Jan 2009 17:03