Javascript is
disabled. Please enable Javscript for the buttons below to work.

“There are 10 kinds of people in the world: those who understand binary, and those who don't.” —Unknown

How many is the number **10**? Ten? Two? A computer engineer will say
“two” when she is using a special kind of number that gives
different meanings to the digit 1 than we are used to seeing.

“Different meanings to the digit 1?” you might exclaim!
But you know that the number 123 = 100 + 20 + 3. And so the 1 in 123 means
*one hundred*. And you know that in the number 321, which is 300 + 20 + 1, the 1 means *one*. So
you already are used to 1 meaning different values depending on its
position in the number: 1, 10, 100, 1000, 10000, etc. as you go farther to
the left.

In *binary* numbers, the meaning of 1 takes on a different
sequence of values. Click on the buttons at the top of the page, and
you'll see the sequence of values that 1 has in binary numbers. (You'll
see 1, 2, 4, 8, 16, 32, etc. starting with 1 on the right side with the values
increasing you go to the left.)
I call this sequence of numbers “the doubles.”

Using the buttons above, create the binary number 00001111_{2}.
This binary number has the decimal value 8 + 4 + 2 + 1 = 15 because the
four rightmost digits of the binary number have 1s and are represented by
the first four doubles. We say, “The decimal value of the binary number
00001111_{2} is 15.”

You may ask, “What about the values of binary digits 2 through 9?” Since these are binary numbers, each digit must be 0 or 1, where 0 always means zero, and 1 is as just described. Binary digits never have values 2 through 9.

Answer these questions.

1. Which eight-digit binary number has the *smallest* decimal value?
What is the binary number and its decimal value? If you need to, use the
bin-dec-hex converter at the top of this page.

2. Which eight-digit binary number has the *largest* decimal value?
What is the binary number and its decimal value? If you need to, use the
bin-dec-hex converter at the top of this page.

3. On a blank sheet of paper, write down the first eight doubles from memory, starting with 1 on the right. (That is, without using the converter at the top of this page.) You don't rememeber the doubles? Then compute them.

4. On the same sheet of paper, using the sequence of doubles to help you,
convert these binary numbers into decimal numbers *without* using the
converter: 00001111, 01010101, 10101010, and 00011111.

Binary numbers can be quite long for their values. For example, the
decimal number 54,321 has the awkward binary representation
1101010000110001_{2}. So to avoid misreading binary numbers,
computer engineers often will use a shorthand called hexadecimal. Here are
the hexadecimal digits for the first sixteen binary numbers.
Compare the hex digits of the top ten lines with the hex digits of the bottom six lines (highlighted).
Would the __hex__ column be easy to remember?

__binary__ __hex__

0000 ⇒ 0

0001 ⇒ 1

0010 ⇒ 2

0011 ⇒ 3

0100 ⇒ 4

0101 ⇒ 5

0110 ⇒ 6

0111 ⇒ 7

1000 ⇒ 8

1001 ⇒ 9

1010 ⇒ A

1011 ⇒ B

1100 ⇒ C

1101 ⇒ D

1110 ⇒ E

1111 ⇒ F

*You need to memorize this entire table.*
Do you see the patterns of the 0s and 1s in each column?

Rightmost column: 0 → 1 → 0 → 1 → etc.

Next column: 0 0 → 1 1 → 0 0 → 1 1 → etc.

Next column: 0 0 0 0 → 1 1 1 1 → 0 0 0 0 → 1 1 1 1.

Leftmost column: 0 0 0 0 0 0 0 0 → 1 1 1 1 1 1 1 1.

__binary__ __hex__

0000 ⇒ 0

0001 ⇒ 1

0010 ⇒ 2

0011 ⇒ 3

0100 ⇒ 4

0101 ⇒ 5

0110 ⇒ 6

0111 ⇒ 7

1000 ⇒ 8

1001 ⇒ 9

1010 ⇒ A

1011 ⇒ B

1100 ⇒ C

1101 ⇒ D

1110 ⇒ E

1111 ⇒ F

We use the hexadecimal table to find the hexadecimal representation of a binary number. First, divide the binary number into groups of four and look up each four-digit binary number in this table. Then the awkward sixteen-digit binary number above becomes

1101 0100 0011 0001_{2} ⇒
D431_{16}.

You can convert binary numbers into their hexadecimal shorthand using this
table, as long as they have 4 digits, 8 digits, 12 digits, etc. That is, a
multiple of four digits. But what if a binary number has six digits? Or
ten? Then put extra zeroes *on the left end* (not the right end!). Below,
we put two extra zeroes *on the left end* to ensure that the leftmost
group has four digits before looking up each group of four binary digits in the
hexadecimal table.

101111 ⇒ 10 1111 ⇒ __00__10 1111 ⇒ 2F_{16} **Right!**

As I warned above, *don't put the zeroes on the right side* because
then they shift the 1s into different positions, making the 1s represent
different values.

101111 **No!** ⇒ 1011 11 **No!** ⇒ 1011 11__00__ ⇒
BC_{16} **Wrong!**

Answer these questions.

5. On a blank sheet of paper, write down the hexadecimal table from memory. Check it against the table above.

6. Use the hexadecimal table to convert these binary numbers into their hexadecimal equivalents: 00001111, 01010101, 10101010, and 11111.

Copyright © 2014–2018 Kerry Veenstra