display | more...

Introduction and Brief History

Counting is one of the fundamental differences that distinguish humans from other animals. This ability, which may seem so innate and trivial, actually has played a key role in human development and helped to make up for our relatively low number sense.

Over the course of human existence, many number systems came and went, being replaced by more efficient systems. Number systems usually had good reasons for coming into existence and naturally died out once their intended tasks were no longer necessary, or once new tasks came along that required different number systems.

Number systems consist of a set of values used to represent quantity. Throughout the ages, mankind has employed signs or symbols to represent numbers. The early forms were comprised of straight lines, each one representing one additional unit. You can think of a person in jail engraving dashes into the wall to count days and making a diagonal line every seventh day to mark a week.

However, every number system will have to begin repeating itself to describe higher numbers. Base value of a number system is the number of different values the set has before it begins repeating itself. For example, the decimal number system has a base of ten values ranging from 0 to 9. These must then recur in order to describe higher values like 10, 890, and so on.

There are seven base values that have been used by mankind at different times in different places:

  • Binary = 2 (0, 1) – Used today in the world of computers, since computers can only distinguish between current or lack of current (true/false, 1/0)
  • Octal = 8 (0 – 7) – Used today by low-level programmers. This is another way to express Binary, but is a lot more efficient in terms of space.
  • Decimal = 10 (0 – 9) – Universally used today in just about anything. This system is based on the fact that humans have 10 fingers.
  • Duodecimal = 12 (0 – 9, A, B) – Can be seen in English Metric System, where 1 foot is 12 inches, and so on. Originally used for some purposes by the Romans.
  • Hexadecimal = 16 (0 – 9, A – F) – Used today by low-level programmers. This is another way to express Binary, but is more efficient than Octal in terms of space.
  • Vigesimal = 20 (0 – 9, A – J) – Now entirely obsolete, this system was originally used by Mayas primarily for calendars (with 3rd digit going up to 365 instead of 400), but saw some use in other aspects of science alongside another number system. Aztecs also used a calendar system similar to that of the Mayas. English also used this system. Counting by the score has been used historically, as in the famous opening of the Gettysburg Address “Four score and seven years ago…”, meaning eighty-seven years ago. In the old British currency system, there were twenty shillings in a pound.
  • Sexagesimal = 60 – A system originally by the Babylonians. It is still being used to keep time: 60 seconds in a minute, 60 minutes in an hour, though the newer measurements, such as milliseconds and nanoseconds, tend to use Decimal. Though this system may sound cumbersome (and it would be had there been 60 symbols to keep track of) it is generally used to eliminate recurring decimals that may arise during time keeping, such as 1/3 and 2/6.

As you can see, there have been quite a number of base values used. At first, it may seem strange that one system gradually replaces another, and it seems shocking that people tend to take this process very easy and accept it. Historical evidence, as well as everyone’s personal experience, however, proves this to be true. After all, if you think about it, everyone uses Sexagesimal and Decimal on daily basis, since everybody keeps track of time and buys things from the store. Moreover, anybody involved at least a little bit in computer science is sure to know about Binary, Octal, and Hexadecimal systems. People living in United States are still using the Duodecimal system when taking everyday measurements. Finally, people who have enough time on their hands, such as me, to actually bother to read Wealth of Nations, or any other old British book, are sure to encounter the Vigesimal system when looking at prices of products (20 shillings in a pound). Therefore, people of today actually use up to 7 different number bases, yet few of us actually notice this or have a hard time with it.

All Your Base Are Belong To Us

With all these bases to keep track of, we need some way to make sense of all this. As most of us are raised by government-funded educational systems, most of us are taught to calculate in Decimal. Ever thought that 1+1 could equal 10? Right, I didn’t think so. The natural response to 1+1 would be 2, since we tend to use Decimal as the default base.

Since we are taught this way, it seems very unnatural for us to do calculations in any base other than Decimal. Even though some computer freaks may be able to calculate F + F in Hexadecimal (the answer, by the way, is 1E), only the truly l33t can calculate F * F in Hexadecimal without first converting to Decimal. Unfortunately, I am not one of those few gifted folks.

The general notation for indicating a base is a subscript following the number, so 1003 indicates 100 in base 3. When no base is specified, base 10 is implied, so 123 indicates 123 in base 10.

The general formula for converting any base into Decimal comes from the fact that every nth digit represents the shown value multiplied by 10n-1. To express this:

Numberbase = (value of 0th digit)*base0 + (value of 1st digit)*base1 + (value of 2st digit)*base2 + … + (value of nst digit)*basen

Example:

5346 = 4*60 + 3*61 + 5*62 = 4*1 + 3*6 + 3*36 = 4 + 18 + 108 = 130 (again, no base specified, so 13010 is implied)

This is all nice and swell, but imagine having to use this method every time? Once Binary, Octal, and Hexadecimal began to be used, people quickly discovered shortcuts to move from one base to another. Using these shortcuts, it becomes possible to mentally convert between the three bases. Unfortunately, there is no shortcut to converting between Decimal and Binary. After some practice, it’s possible to start memorizing certain numbers and their representations in other bases.

There is actually no particular purpose for either Octal or Hexadecimal to exist. The systems emerged as ways to conserve space on paper during debugging.

Converting Binary to Hexadecimal

For this example, I will use the number 10111110111100101012. This method may seem complicated at first, but it can be done mentally after a little bit of practice.

The first step is to separate the original number into groups of four, starting from the right. The last group may have less than 4 numbers, in which case 0s are added on the left. You should now have:

0101 1111 0111 1001 0101

Then, draw a table around the groups to separate them and put 8 4 2 1 on top of each column. You should now have:

8 4 2 1 | 8 4 2 1 | 8 4 2 1 | 8 4 2 1 | 8 4 2 1
0 1 0 1 | 1 1 1 1 | 0 1 1 1 | 1 0 0 1 | 0 1 0 1

Then, add up the totals for each group and write them in a row below. Only take the upper values that correspond to a 1 and ignore ones that correspond to a 0. You should now have:

8 4 2 1 |  8 4 2 1  | 8 4 2 1 | 8 4 2 1 | 8 4 2 1
0 1 0 1 | 1 1 1 1 | 0 1 1 1 | 1 0 0 1 | 0 1 0 1

4+1=5 |8+4+2+1=15 | 4+2+1=7 | 8+1=9 | 4+1=5

Next, find the letter that corresponds to any 2-digit number that comes out. Here is a quick reference:

A = 10
B = 11
C = 12
D = 13
E = 14
F = 15

You should now have:

8 4 2 1 |  8 4 2 1  | 8 4 2 1 | 8 4 2 1 | 8 4 2 1
0 1 0 1 | 1 1 1 1 | 0 1 1 1 | 1 0 0 1 | 0 1 0 1
4+1=5 |8+4+2+1=15 | 4+2+1=7 | 8+1=9 | 4+1=5

5 | F | 7 | 9 | 5

Now, simply combine all the digits together and you’ll get:

5F795

So, 5F79516 = 010111110111100101012

The Matrix has you 10110111020101”

Converting Hexadecimal to Binary

Let’s convert B2C from Hex (short for Hexadecimal) into Binary. This is basically just the reverse of Binary to Hex. Start off by separating every digit into a table and giving each letter a corresponding 2-digit number value (consult the table above):

B=11 | 2 | C=12

Now, write the 8 4 2 1 in every column in the next row. You should now have:

  B=11  |    2    |   C=12  
8 4 2 1 | 8 4 2 1 | 8 4 2 1

Now, try to put 0s and 1s corresponding with each value (either 8, 4, 2, or 1) to get a sum in the corresponding cell of the first row. You should now have:

  B=11  |    2    |   C=12  
8 4 2 1 | 8 4 2 1 | 8 4 2 1

1 0 1 1 | 0 0 1 0 | 1 1 0 0

Just to double check, you may want to actually add the results you got and see if they match with the original number:

8*1 + 4*0 + 2*1 + 1*1 = 8+2+1 = 11

8*0 + 4*0 + 2*1 + 1*0 = 2 = 2

8*1 + 4*1 + 2*0 + 1*0 = 8+4 = 12

You may have gotten lost for some time, but you should now understand what to do. You may have to double check your answer the first couple of times, but after a while it becomes very easy. Finally, just write down the number you get and you should have:

101100101100

Voila! This long string of 1s and 0s is your answer in Binary. So, 1011001011002 = B2C16. As you can see, writing this out on paper every time will require A LOT of paper and will be come very cumbersome to look at.

There are 10 types of people in this world: those who understand binary, and those who do not.

Converting Binary to Octal

The methods used for converting between Binary and Octal closely resemble those of Binary and Hexadecimal.

The major difference is the fact that you separate the Binary value into groups of 3 instead of 4, since Octal goes only up to 7. Let’s convert the number we got in the previous example, 101100101100 into Octal. Start off by separating it into groups of 3 (again, add 0s to the right if necessary):

101 100 101 100

Next, make a similar table, but use 4 2 1 instead. You should now have:

4 2 1 | 4 2 1 | 4 2 1 | 4 2 1
1 0 1 | 1 0 0 | 1 0 1 | 1 0 0

Then, add up the totals for each group and write them in a row below. Only take the upper values that correspond to a 1 and ignore ones that correspond to a 0. You should now have:

4 2 1 | 4 2 1 | 4 2 1 | 4 2 1 
1 0 1 | 1 0 0 | 1 0 1 | 1 0 0

4+1=5 | 4=4 | 4+1=5 | 4=4

Luckily, this example happens to be very easy. So, just write down the answer you got, and that will be your result:

5454

So, 54548 = 1011001011002. Even now you can begin to notice that Octal takes more room to write than Hex. However, Octal does not use letters, which makes it more “number-like” (and you can’t write curse words).

Converting Octal to Binary

You probably can figure this one out from the last three, but I will tell it to you anyway.

Let’s convert 1337 from Octal into Binary. First, start off by separating the numbers into a table:

1 | 3 | 3 | 7

Now, write the 4 2 1 in every column in the next row. You should now have:

   1  |   3   |   3   |   7  
4 2 1 | 4 2 1 | 4 2 1 | 4 2 1

Now, try to put 0s and 1s corresponding with each value (either 4, 2, or 1) to get a sum in the corresponding cell of the first row. You should now have:

   1  |   3   |   3   |   7
4 2 1 | 4 2 1 | 4 2 1 | 4 2 1

0 0 1 | 0 1 1 | 0 1 1 | 1 1 1

Just to double check, you may want to actually add the results you got and see if they match with the original number:

4*0 + 2*0 + 1*1 = 1

4*0 + 2*1 + 1*1 = 2 + 1 = 3

4*0 + 2*1 + 1*1 = 2 + 1 = 3

4*1 + 2*1 + 1*1 = 4 + 2 + 1 = 7

Finally, just put this number together to get:

001011011111

So, 13378 = 0010110111112. Cool, heh? Now, you don’t have to be the boring ol’ 1337 hax0r, you can be a 001011011111 HEX0r!

Adding in Binary

Adding in binary is very easy. Basically, all you have to know is that 0+0=0, 0+1=1, 1+1=2, and that 2 doesn’t actually exist as a separate number in Binary.

For starters, let’s calculate 101+110. Start off by writing the second number underneath the first. Yes, just like you did in grade school:

101
110

Oh, and I’m going add a little plus sign on the left to intimidate you:

  101
+ 110

Now that I’ve established my authority, we may continue on with today’s lesson. Basically, add like you would normally add, but whenever you encounter 1+1, write down a 0 and carry 1 over to the next digit. You will have:

   101
+ 110
1011

Now, to finish the lesson, I will give you a table of quick reference of all numbers from 0 to 15 in Decimal and their corresponding Binary, Octal, and Hex values:

Decimal | Binary | Octal | Hexadecimal
0 | 0000 | 0 | 0
1 | 0001 | 1 | 1
2 | 0010 | 2 | 2
3 | 0011 | 3 | 3
4 | 0100 | 4 | 4
5 | 0101 | 5 | 5
6 | 0110 | 6 | 6
7 | 0111 | 7 | 7
8 | 1000 | 10 | 8
9 | 1001 | 11 | 9
10 | 1010 | 12 | A
11 | 1011 | 13 | B
12 | 1100 | 14 | C
13 | 1101 | 15 | D
14 | 1110 | 16 | E
15 | 1111 | 17 | F

Conclusion

I hope the information presented here has helped you at least in some way. What really amazed me during my research was the fact that I use 7 number systems almost on daily basis, without even thinking about it. Please feel free to find out more information by checking out the hard links or by going to my references (mostly used for history, the shortcuts were done from memory):

http://en.wikipedia.org/wiki/Vigesimal
http://www.mpt.org/learningworks/teachers/numbers_alive/whatis.html
http://www.math.wichita.edu/history/topics/num-sys.html
http://delphi.about.com/gi/dynamic/offsite.htm?site=http://www.ibilce.unesp.br/courseware/datas/numbers.htm
http://www.dark-witchcraft.com/mystery_mayan.htm
http://www.spirasolaris.ca/sbb1sup1.html
http://www.math.wichita.edu/history/topics/num-sys.html
http://www.mpt.org/learningworks/teachers/numbers_alive/whatis.html

Log in or register to write something here or to contact authors.