Changing Bases for Integers

A. Background Facts:

1. A base X numeral is an abbreviation for a polynomial in x, like 5x3  +3x2  +0x1   +4x0  (Recall x0 =1.)

Examples: 2. Written names of numerals 3. Digits are nonnegative integer coefficients of powers of the base, and as such are always less than the base.

Examples:
Base Digits
2  (Binary system) 0, 1
10 (Decimal system ) 0.1.2.3.4.5.6.7.8.9
16 
(Hexadecimal system or hex for short)
0.1.2.3.4.5.6.7.8.9,A,B,C,D,E,F

A-F correspond to the base 10 numerals of 10-15 respectively

3 0,1,2 (There was an interesting recent article showing that computers using base 3 system for storing data had certain efficiencies compared to binary based computers and thus could be made to run faster than computers based on the binary system.)

For thought: what are the digits for base 8?
 

B. CHANGING BASE: Base  x to base 10 , or base 10 to base x
 

C. CHANGING BASE:

First change from given base to base 10 (expand) and then base 10 to the desired base (by dividing by desired base).
Hex to Binary:
1. Convert each Hex digit to a FOUR DIGIT base 2 numeral in order. (Use decimal numerals and convert to base 2 as an intermediate step if that helps.)
2. Resulting string is the binary numeral.
3. Check by converting original hex numeral and binary numeral to base 10.  The resulting two base 10 numerals should be the same.

Example: Convert hexadecimal A1 to binary.
1. A1 is A followed by 1.  A is decimal numeral 10, which is binary numeral 1010. 1 is 1 in both hex and binary--see above table of digits. But 1 expressed as FOUR digits is 0001.
2. Hence the binary numeral is 10100001.
3. Check:
Hex A1 as decimal numeral is 10(16)+1 = 161
Binary 10100001 as a decimal numeral = 128 + 32 +1 = 161

Binary to Hex:
1. Start at the right end of the binary numeral and read to the left, marking off groups of 4 binary digits until you have no more digits. (If in the last, or leftmost, group of digits you have less than four, you really do have four as you have leading zeros.)
2. Rename each 4-digit numeral as a hex numeral. (Use base 10 arithmetic to help as needed.)  The resulting string is the hex numeral.
3. Check by converting the original binary and the new hex numeral each to base 10.  The resulting base 10 numerals should be the same.

Example: Convert 101101 to hex.
1. Grouping, starting at right:  0010   1101 (note that to get 4 digits in the leftmost group I had to supply two leading zeros.)
2. 0010 is base 10  digit 2 which is base 16 digit 2
    1101 is base 10 numeral 13, which is base 16 digit D
 The hex numeral is 2D.
3. Check:
101101 = 32+8+4+1 = 45
2E = 2(16) +13 =32+13 = 45

Changing Bases for Fractions

A. More Background Facts:

Base 10 numeral 101.11 is the abbreviation for 1(100) + 0(10) + 1(1) + 1(1/10) + 1(1/100)
Base 2 numeral 101.11 is the abbreviation for   1(4)    + 0(2)   + 1(1) + 1(1/2)   + 1(1/4)

B. Changing Base x  decimal fraction to Base 10 fraction or decimal fraction

Write Base x decimal in expanded form and do arithmetic. Answer is the base 10 numeral. (This is recipe we always use to change from base "any number" to base 10.)
Example: Change base 2 numeral 101.11 to base 10.
101.11 = 1(4)    + 0(2)   + 1(1) + 1(1/2)   + 1(1/4) = 5 3/4, or 23/4 or 5.75

Example: Change base 3 numeral 20.1 to base 10.
20.1 = 2(3) + 0(1) + 1 (1/3) = 6 + 1/3
Answer: 6 1/3, or 19/3, or 6.3333.... , or 6.3 (note that  the digits that repeat are underlined).

C. Changing Base 10 fraction to Base 2 decimal fraction
Negative numbers: Ignore the sign for changing purposes and apply the sign to the final answer.  Example: Hex -1A expressed as base 10 is -(16 + 10) = - (26) = -26. Binary -10 as base 10 numeral is -(2+0) = -2.