The Wonders of Conversion
A number system is a system in which a number is represented. There are potential infinite number systems that can exist (there are infinite numbers, after all), but you are only responsible for a very small subset. For the AP Exam, you will need to know binary (base- 2), octal (base-8), decimal (base-10) and hexadecimal (base-16). Notice that all of those bases are powers of 2!
The binary number system is the one your computer explicitly understands. All numbers are represented by bits, which is either a 0 or a 1. A byte is a collection of 8 bits, and can represent numbers from -256 to 255. (The max value of a collection of bits is always 2^ numbits -1 = 255) For example, is 182 in decimal.
Octal is base-8. Only digits 0-7 are used. Using 182 again, it is 266 in octal. (That is not a typo – the number appears to be bigger!)
Decimal is good old base-10. You’ve been using this all of your lives! 182 is 182 in decimal!
Hexadecimal is base-16. It uses the digits 0-9 and the letters A-F to represent 10-15, respectfully. For example, 15 base 10 is F in hexadecimal. 16 is is 37A.
The following is called the expansion method and only works on converting a number TO BASE-10!!! You need to understand how these numbers are written. You have to analyze the number starting on the right. This number represents the base number raised to the 0 th power. The second number from the right represents the base number raised to the first power. …and so on
Consider the following binary number: What is this number in decimal format? Start looking at the rightmost digit. This represents the base number raised to the 0 th power. Multiply this number by the digit present (which is a 1). Save this number. Look at the second rightmost digit. This represents the base number raised to the first power. Multiply this number by the digit present (which is a 1). Save this number. …do this for all numbers present and add all of products together to get your base-10 number.
to decimal 2 0 * 1 = * 1 = * 0 = * 0 = * 1 = * 1 = * 1 = * 0 = 0 The sum is 115.
Convert to decimal. Convert to decimal. Convert to decimal.
Convert 234 base-8 to decimal. 8 0 * 4 = * 3 = * 2 = 128 The sum is 156.
Convert 716 base-8 to decimal. Convert 45 base-8 to decimal. Convert 10 base-8 to decimal.
REMEMBER: A = 10 B = 11 C = 12 D = 13 E = 14 F = 15 Convert F16 to decimal.
Work: 16 0 * 6 = * 1 = * 15 = 3840 The sum is 3862.
Convert C10 to decimal. Convert FF to decimal. Convert 16 to decimal.
One method of converting any base number to base-10 is by continuously dividing the original decimal number by the desired base until you get a quotient of 0, and then read the remainders backwards. Note: if you are converting to hexadecimal, remember that are represented by A..F respectively!)
Convert 201 to binary. Work: 201 / 2 = 100 remainder / 2 = 50 remainder 0 50 / 2 = 25 remainder 0 25 / 2 = 12 remainder 1 12 / 2 = 6 remainder 0 6 / 2 = 3 remainder 0 3 / 2 = 1 remainder 1 1 / 2 = 0 remainder in binary is
Convert 1076 to binary. Convert 200 to binary. Convert 450 to binary.
Convert 173 to octal. Work: 173 / 8 = 21 remainder 5 21 / 8 = 2 remainder 5 2 / 8 = 0 remainder base-10 is 255 base-8.
Convert 1076 to octal. Convert 200 to octal. Convert 450 to octal.
Convert 506 to hexadecimal. Work: 506 / 16 = 31 remainder / 16 = 1 remainder 15 1 / 16 = 0 remainder 1 BUT 10 is A and 15 is F so… 506 base-10 is 1FA base-16.
Convert 1076 to hexadecimal. Convert 200 to hexadecimal. Convert 450 to hexadecimal.
There is a neat trick that allows one to convert from binary to hexadecimal, without converting the binary to base-10 first. Every base-16 digit (including letters) can be represented by four bits:
Base -2Base Base-2Base A 1011B 1100C 1101D 1110E 1111F
Convert base-2 to base-16. Starting from the right, break up the binary number into groups of 4 bits. If the last group doesn’t have four bytes, pad it on the left with zeros. Base-2 groups: Base-16: Answer = 1257
to base-16 Groups: Base-2: Base-16: 7 F C 8 D Answer = 7FC8D
Convert base-16 to base-2 Groups: Base-16: Base-2: Answer:
Convert 1a2b3c to base-2 Groups: Base-16:1a2b3c Base-2: Answer:
Convert to hexadecimal. Convert to hexadecimal. Convert 3f5a86 to binary. Convert aa4fc to binary.