# The IntMath Newsletter - 21 Sep 2008

By Murray Bourne, 21 Sep 2008

In this Newsletter:

1. Math tip - Hexadecimal Numbers

2. Encryption - and a challenge

3. Current IntMath Poll - Math Anxiety

4. From the math blog

5. Final thought

## 1. Math tip - Hexadecimal Numbers

First, so we can better understand hexadecimal numbers, let's talk about our **normal number system**: 0, 1, 2, 3, 4, ...

This system is called the **Hindu-Arabic** number system because it was developed in India (by the Hindus) and was spread throughout the Middle East and Europe by Muslim scholars around 1000 years ago. Hindu-Arabic numerals finally replaced the Roman Numeral system (I, II, III, IV, V,...) in Europe around 1500.

The biggest contribution of the new number system was that it was **positional**. That is, if I have the number 439, the "4" really means "4x100 = 400", the "3" means "3x10 = 30" and the "9" means "9x1 = 9 units". The **position** of the digit in the number determines its **value**.

Our number system uses **base 10**. This means that after every 10 digits, we need to add "1" to the column on the left. Consider 36, 37, 38, 39. The next number is 40. We have added "1" to the column on the left, and the 9 "ticks over" to 0 once again.

Using exponents, base 10 numbers are based on the following values in each column (right to left):

10^{0} = 1

10^{1} = 10

10^{2} = 100

10^{3} = 1,000

10^{4} = 10,000

Now let's look at an alternative number system that has important applications in computers.

Here we learn that 100 is not always "one hundred"!

**Hexadecimal Numbers**

Hexadecimal numbers use **base 16** (not base 10 like our normal number system). "Hexa-" means "6" and "deci-" is "ten".

In hexadecimal numbers, the digits 0 to 9 are used and the next number is written using the letter "A" (to mean "ten"). Continuing, "B" means "eleven", "C" means "twelve", "D" means "thirteen", "E" means "fourteen" and "F" means "fifteen".

The next number is written "10" (which actually means "sixteen" in our normal system), and the following number is "11" (which is really "seventeen"). Next is "12" which means "16+2=18", and so on.

Like the Hindu-Arabic decimal system, the hexadecimal system is **positional**.

For example, in the hexadecimal number "34A",

- The "3" means "3x16
^{2}= 768", - The "4" means "4x16 = 64", and
- The "A" means "ten".

Altogether, the number "34A" has decimal value

768+64+10 = 842.

The hexadecimal system is based on powers of 16, as follows:

16^{0} = 1

16^{1} = 16

16^{2} = 256

16^{3} = 4,096

16^{4} = 65,536

So in the hexadecimal system, the number "100" is actually equal to 256 in the ordinary decimal system.

Similar to the decimal system, we add "1" to the column on the left as we count up. In the hexadecimal system, "E + 1 = 10" (which means "fifteen plus one equals sixteen"). Or we could have the counting sequence 39, 3A, 3B, 3C, 3D, 3E, 3F, 40. That last number is obtained by adding one to the left column (giving "4") and the "F" ticks over back to "0".

For an example of how hexadecimal numbers are used in computing, the **colors of the Web page** that you are looking at right now are coded using hexadecimal values. A white background will be written #FFFFFF, whereas the light blue used as the background for Interactive Mathematics is #E5EDEF.

## 2. Encryption

[This topic was requested by a reader. It involves ETAOIN, computers and Facebook.]

One of the hot areas in current mathematical research is **data encryption**. With so much sensitive data floating around the Internet, encryption has become vital to protect online banking, e-commerce and even our FaceBook profiles. 🙂

I guess you’re all familiar with simple encryption, like the following:

K | N | O | W | L | E | D | G | E | I | S | P | O | W | E | R |

11 | 14 | 15 | 23 | 12 | 5 | 4 | 7 | 5 | 9 | 19 | 16 | 15 | 23 | 5 | 18 |

I have simply used A=1, B=2, C=3,..., Z=26 to turn my text message "knowledge is power" into a set of numbers. Such encoding of a message is called a "cipher" (or "cypher").

However, this cipher is too simple and very easy to crack. One way to make it more secure is to use what is called a "**shift cipher**", where we add the same number to each of the digits in our code. Let's add 9. So the first number (representing "K") will become 11+9=20, and N will become 14+9=23.

When we get to "W", we have a little problem, since 23+9=32. There is no 32nd letter of the alphabet, so we just use **modulo** arithmetic. (What is the remainder when we divide 32 by 26? Answer: 6. So we say "32 is equivalent to 6, modulo 26").

By applying our shift cipher and modulo arithmetic, our coded message is now:

K | N | O | W | L | E | D | G | E | I | S | P | O | W | E | R |

20 | 23 | 24 | 6 | 21 | 11 | 13 | 16 | 14 | 13 | 2 | 25 | 24 | 6 | 14 | 1 |

We could write our encrypted message using letters by translating the original letter-number equivalents:

K | N | O | W | L | E | D | G | E | I | S | P | O | W | E | R |

T | W | X | F | U | N | M | P | N | R | B | Y | X | F | N | A |

This is better, but it is still easy to decode. You could study the frequency of each letter and figure out what each represents. (The letters E, T, A, O, I, N are the most common English letters, while J, X, Q and Z are the least common.)

**Using Hexadecimal Numbers**

I could have made our message harder to crack by using the **hexadecimal number system** that we learned about above.

If I use hexadecimal numbers with A=1, B=2,..., 8=H, 9=J, A=K, B=L, etc (and without the shift cipher), then my encrypted message is:

K | N | O | W | L | E | D | G | E | I | S | P | O | W | E | R |

B | E | F | 17 | C | 5 | 4 | 7 | 5 | 9 | 13 | 10 | F | 17 | 5 | 12 |

We could make it harder to crack by applying the shift cipher as before.

**Ready for a Challenge?**

I have used hexadecimal numbers and a shift cipher to encode a message. Can you decrypt it?

18 C 9 16 9 17 5 B 9 12 D 19 17 D 12 5 10 10 13 A 19 17

The answer will appear in the next Newsletter.

## 3. Current IntMath Poll - Math Anxiety

There has been a big response to the current IntMath Poll where I ask users "How is your math anxiety?"

How about you? Are you math anxious right now? You can respond to the poll on any page in Interactive Mathematics (you'll see it in the right column).

## 4. From the Math Blog

1) Friday Math Movie - The Math in MP3 Audio Files

Remember LP records? Some purists still love them. This movie takes a look at the differences between digital and analog music recording.

2) Another misleading credit card advertisement

Here's another case where a bank offers what seems to be a very good deal - 0% interest on a loan. But let's have a closer look.

3) Review: How Computer Games Help Children Learn

"How Computer Games Help Children Learn" is an interesting look at the world of learning games.

4) Tools for making a math website

A reader asked what tools I used to produce the Interactive Mathematics site.

## 5. Final Thought

Here's something to think about from A.P. Gouthey:

To get profit without risk, experience without danger, and reward without work is as impossible as it is to live without being born.

Have a good week.

See the 7 Comments below.

21 Sep 2008 at 6:39 pm [Comment permalink]

"In hexadecimal numbers, the digits 0 to 9 are used and the next number is written using the letter “A” (to mean “ten”). Continuing, “B” means “eleven”, “C” means “twelve”, “D” means “thirteen”, “E” means “fourteen” and “E” means “fifteen”."

A minor typing mistake: “F” means fifteen, not “E”.

21 Sep 2008 at 6:51 pm [Comment permalink]

Doh! Thanks, Li-sa. I have corrected it in the post above.

22 Sep 2008 at 1:51 pm [Comment permalink]

Mr. Murray

Thanks for your maths newsletter, it is very informative and educative. Today I learn something new about "hexadecimal numbers. Keep up the good work, and may the Lord Almighty give you more wisedom.

23 Sep 2008 at 6:23 pm [Comment permalink]

Thanks for te INTMATH Newsletter. It's educational and I learned new things espcially the ENCPRYPTION. I will tell this to my friends.

24 Sep 2008 at 6:51 pm [Comment permalink]

What you are doing is incredibly fantastic. keep up the good work.

3 Oct 2008 at 5:17 pm [Comment permalink]

I really apprieciate your effort on this chapter,you have made me known what i did not know before.It was very understandable. Thank you.

10 Oct 2008 at 12:45 pm [Comment permalink]

No comment on this my first newsletter. I enjoy learning more about peripheral skills in electronics. I'm grateful for simplification as you present math.