Numbering Systems - Binary, Octal, Decimal, and Hexadecimal

There are many ways to count. The one we choose (because we have 10 fingers and because our parents chose it) is decimal, which means: "base ten". A numbering system allows for large numbers to be "built up" from sequences of smaller numbers, such as 157, which means 1 times 10 to the second power, plus 5 times 10 to the first power, plus 7 times 10 to the zeroth power. Given any base (decimal = 10, binary = 2, octal = 8, hexadecimal = 16) we can compute a number such as 1241836 as: (1 * X^5) + (2 * X^4) + (4 * X^3) + (1 * X^2) + (8 * X^2) + (3 * X^1) + (6 * X^0).

Numbering Systems

Numbering systems are just symbolic ways to represent the numbers. The base of a numbering system is the number of digits in the system and the multiplicative factor for each subsequent column.

Other Numbering Systems (Octal, Hex)

Name Base Allowed Digits
Binary Base 2 0,1
Octal Base 8 0,1,2,3,4,5,6,7
Decimal Base 10 0,1,2,3,4,5,6,7,8,9
Hex Base 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F (A=10, B=11, C=12, D=13, E=14, F=15)

Allowable Digits are 0,1,...,(Base-1).

Evaluating a number in a base

To evaluate, we multiply the base by a set of powers and by the appropriate digit in order:

Position of Digit n ... 8 7 6 5 4 3 2 1
Power X^n-1 ... X^7 X^6 X^5 X^4 X^3 X^2 X^1 X^0
Example Base 19 0 0 0 0 0 0 0 A 9 0
Example Values 0+ 0+ 0+ 0 + 0+ 0+ 0+ 10 * 19^2 + 9* 19^1 0 = 532

15133 BASE X: 
(1 * X^4) + (5 * X^3) + (1 * X^2) + (3 * X^1) + (3 * X^0) 

15133 BASE 10: 
(1 * 10^4) + (5 * 10^3) + (1 * 10^2) + (3 * 10^1) + (3 * 10^0) 
10000 + 5000 + 100 + 30 + 3 = 15133 Base 10

15133 BASE 8: 
(1 * 8^4) + (5 * 8^3) + (1 * 8^2) + (3 * 8^1) + (3 * 8^0) 
(1 * 4096) + (5 * 512) + (1 * 64) + (3 * 8)   + 3 =
4069+2560+64+24+3 = 6720 Base 10
      

How do we determine what base a number is?

  1. Usually it is decimal
  2. Other bases will be labeled
  3. We can rule out bases if the digits are large enough

ILLEGAL BASES example:

7010 cannot be binary because the 7 is not a valid binary digit.  This number could be octal.
4291 cannot be octal because the 9 is not a valid octal digit. This number could be decimal.
4A711D cannot be decimal because A is not a valid decimal digit. This number is	most likely hex.
      

Converting from Octal to Binary:

There are two ways to convert from Octal to binary:

  1. The hard way:

    Just like converting decimal to binary.

    Find the greatest power of 2 equal to or less than the value of the octal number. This is your first bit. Subtract this value from the octal number (in octal subtraction). Find the next lower power of two equal to or less than the octal value. this is your next bit. Subtract this value from the octal number (in octal subtraction). Repeat this until all octal value equals 0.

  2. The easy way:

    Because Octal is 2^3 and binary is 2^1, every octal digit represents exactly 3 binary digits! Thus we have an easy to memorize chart:

    OctalBinary Equiv
    0 000
    1 001
    2 010
    3 011
    4 100
    5 101
    6 110
    7 111

    Note: This conversion goes both ways:

    Example: Convert the octal number 7160 (base 8) to binary:

    OctalBinary Equiv
    7 becomes 111
    1 becomes 001
    6 becomes 110
    0 becomes 000

    Now line these bits up: 111,001,110,000 (or 111001110000) and you have your binary number.

    Example: Convert the binary number 01011 to Octal

    First make sure there are a number of digits evenly divided by 3.

    This gives us: 001011

    Then divide into groups of 3:

    This gives us: 001,011

    Finally, do the conversion:

    Binary Octal Equiv
    001 becomes 1
    011 becomes 6

    Now line these octal digits up: 1,6 (or 16 (base 8))


Back to Topics List