The Hexadecimal Number System

When working through a tutorial, don't use the scrollbar. Move around the document by clicking on the hotlinks instead.


Have you ever wondered about the origin of the word "digit"? It comes from the Latin word "digitus", which means "finger". We are accustomed to the notion that digits denote numbers, and sure enough, there are as many digits in our decimal system as there are fingers on our hands.

Imagine the following scenario: A tribe of extraterrestrials called "Hexans" decides to immigrate to planet earth. As one might expect, they settle in the U.S., more precisely, in southeastern Ohio. Hexans are similar to humans in all respects, except that they have eight fingers on each hand. They quickly adapt to American civilization. After a few years, they start to feel that their tribe is being discriminated against by the prevailing numbering system based on the number of fingers typical for earthlings. They petition the governor of Ohio to give equal weight in public education to the teaching of an alternative numbering system, based on 16 digits, and called quite appropriately the "hexadecimal" system.

Continue
































Now suppose you are charged by the Ohio governor with the development of an appropriate public school curriculum. The first thing you have to decide is what the digits of the new system are going to be. Of course the first ten digits will be 0 through 9, but now you also need digits for the numbers from 10 through 15. You could invent new symbols for those, but you realize that this would entail, among other things, redesigning all the keyboards used in the state. A much more expedient solution is to have existing letters denote the extra digits. So you decide to use upper case A for the digit corresponding to 10, B for 11, and so on.

Which number is represented by the hexadecimal digit D?































Sorry, you chose the wrong answer.

This cannot be correct, since the numbers 0 through 9 are represented identically in the decimal system and in the hexadecimal system.

Please try again.





























Sorry, you chose the wrong answer.

Please try again.





























Sorry, you chose the wrong answer.

Strictly speaking, you didn't give a wrong answer, only one that wasn't hoped for by the author of this tutorial. The wording of my question is imprecise. I asked you: "Which number ...?" In the hexadecimal system, D very much is a (single-digit) number. Had I asked instead "Which decimal number ...?", the answer "D" would be plain wrong.

Please try again.





























CORRECT!

Which letter denotes the largest hexadecimal digit?































Sorry, you chose the wrong answer.

Please recall that the extra digits are represented by CAPITAL letters.

Please try again.





























Sorry, you chose the wrong answer.

Please try again.





























Sorry, you chose the wrong answer.

Please try again.





























Sorry, you chose the wrong answer.

Please recall that the extra digits are represented by CAPITAL letters.

Please try again.





























Sorry, you chose the wrong answer.

Please recall that the extra digits are represented by CAPITAL letters.

Please try again.





























CORRECT!

And which expression in the decimal system corresponds "F" to?































Sorry, you chose the wrong answer.

Recall that in our system that is based on 10 digits, the largest digit is 10-1 = 9.

Please try again.





























Sorry, you chose the wrong answer.

Please try again.





























CORRECT!

OK, we have established that the hexadecimal digits 0--F correspond to our familiar decimal numbers 0--15. But how shall we represent the number 16? Note that this is the point where Hexans run out of fingers. Of course, we humans run into the same problem when we get to 9 + 1. Some of our ancestors hit upon an ingenious solution: Let's write the next number after 9 as 10, which can be interpreted as: "1 full set of (10) digits and 0 leftovers", or "1 x 10 + 0" for shorthand. Of course, a Hexan would be inclined to think of "1 full set of digits and 0 leftovers" rather as "1 x 16 + 0", which is exactly the number that comes after "F"!

Thus, the decimal number 16 will be represented as 10 in the hexadecimal system. Our number 17, which is "1 full set of digits and 1 leftover" to a Hexan will be represented as 11 in the hexadecimal system, and so on.

What is the meaning of the decimal number 21 to a Hexan?































Sorry, you chose the wrong answer.

The number 21 was supposed to be given in decimal notation. The HEXADECIMAL number 21 would mean to a Hexan "Two full sets of digits and one leftover."

Please try again.





























CORRECT!

So how will a Hexan represent the decimal number 21?































Sorry, you chose the wrong answer.

The hexadecimal number 17 is a Hexan's way of saying "One full set of digits and seven leftovers." This corresponds to the decimal number 1 x 16 + 7 = 23.

Please try again.





























Sorry, you chose the wrong answer.

The hexadecimal number 14 is a Hexan's way of saying "One full set of digits and four leftovers." This corresponds to the decimal number 1 x 16 + 4 = 20.

Please try again.





























CORRECT!

Which decimal number corresponds to a Hexan's idea of "1 full set of digits and E leftovers"?































Sorry, you chose the wrong answer.

This is the correct answer to a different question, namely: 'Which HEXADECIMAL number corresponds to a Hexan's idea of "1 full set of digits and E leftovers"?'

Please try again.





























Sorry, you chose the wrong answer.

Note that 32 is two full sets of hexadecimal digits.

Please try again.





























Sorry, you chose the wrong answer.

Please try again.





























CORRECT!

Which hexadecimal number corresponds to the decimal number 27?































Sorry, you chose the wrong answer.

"One full set of hexadecimal digits and 9 leftovers" is 1 x 16 + 9 = 25.

Please try again.





























Sorry, you chose the wrong answer.

The letter H does not represent a hexadecimal digit.

Please try again.





























Sorry, you chose the wrong answer.

"One full set of hexadecimal digits and C leftovers" is 1 x 16 + 12 = 28.

Please try again.





























CORRECT!

The decimal number 34 is our way of expressing the notion of "3 full sets of digits and 4 leftovers".

Which decimal number corresponds to a Hexan's notion of "3 full sets of digits and 4 leftovers"?































Sorry, you chose the wrong answer.

The answer should be a decimal number, not a hexadecimal number.

Please try again.





























Sorry, you chose the wrong answer.

160 would be "Ten full sets of hexadecimal digits and no leftovers", or, in more Hexan-friendly lingo, "A full sets of digits and no leftovers", i.e., A0.

Please try again.





























Sorry, you chose the wrong answer.

59 would be "Three full sets of hexadecimal digits and 11 leftovers", or, in more Hexan-friendly lingo, "3 full sets of digits and B leftovers", i.e., 3B.

Please try again.





























CORRECT!

When a Hexan writes the number "BC", he thinks of "B full sets of digits and C leftovers".

Which decimal number does this correspond to?































Sorry, you chose the wrong answer.

159 corresponds to "9 full sets of digits and F leftovers".

Please try again.





























Sorry, you chose the wrong answer.

172 corresponds to "A full sets of digits and C leftovers".

Please try again.





























CORRECT!

OK, we can see that there is such a thing as a two-digit hexadecimal number. Each of the digits is either a "normal" digit, or a capital letter. If we increase the second digit by one, the number increases by one, as in our decimal system. But if we increase the first digit of a hexadecimal number by one, the number increases not by ten as in our system, but by as much as sixteen.

The largest two-digit hexadecimal number is FF. Which decimal number does this correspond to?































Sorry, you chose the wrong answer.

Please try again.





























Sorry, you chose the wrong answer.

Of course we are looking at "15 full sets of hexadecimal digits and 15 leftovers" here. But the decimal number 1515 signifies "151 full sets of decimal digits and five leftovers."

Please try again.





























CORRECT!

How many numbers can be represented by two hexadecimal digits?































Sorry, you chose the wrong answer.

Hint: 00 also represents a number.

Please try again.





























Sorry, you chose the wrong answer.

Hint: The first of these digits could also be a zero.

Please try again.





























CORRECT!

I do not know whether there are any Hexans in the universe, but there are hexadecimal numbers, and they even occur here on planet earth. Among other things, two-digit hexadecimal numbers are being used to code the colors displayed on your TV and computer screens. This works in the following way: The screen is partitioned into small areas called pixels. Each pixel has a red, a green, and a blue component, and a colored picture is coded by specifying the strengths of these components for each pixel. If each component is set to maximum strength, a white pixel will appear on the screen. Switching off the green and blue components and setting the red component to maximum strength will of course result in a bright red pixel. A yellow pixel can be obtained as a mixture of red and green, with the blue component turned off.

Now the strenghts of the red, green, and blue components are coded by two-digit hexadecimal numbers. As we have seen above, this means that each of these components can come in 256 different shades, which gives your computer the ability to display 256 x 256 x 256 = 16 millions and 777,216 different colors!

Continue
































Why are hexadecimal numbers rather than decimal numbers used for this coding?































Sorry, you chose the wrong answer.

Of course, computer scientists do love obscure codes. But this is not the reason why colors are coded in the hexadecimal system.

Please try again.





























Sorry, you chose the wrong answer.

What makes the colors vivid and appealing is the fact that there are so many of them. The particular way in which these over 16 millions of colors are coded is irrelevant for their vividness.

Please try again.





























Sorry, you chose the wrong answer.

You can express as many numbers in the decimal system as in the hexadecimal system. But there is a grain of truth in this answer: You can code more colors with three two-digit hexadecimal numbers than with three two-digit decimal numbers. If we would use two-digit decimal numbers for the strength of each component, we could only code 100 x 100 x 100 = 1 million different colors.

Please try again.





























CORRECT!

Computer memory comes in discrete portions known as "bytes". Only one byte of computer memory is needed to code a two-digit hexadecimal number. So it is possible to code each of the 16 million 777,216 colors with only three bytes of computer memory. So why waste some of this potential and use the same three bytes for coding only the 1 million colors that are expressible by three two-digit decimal numbers?.

End of the tutorial.


© Winfried Just
Last modified April 27, 1998