Contemporary Mathematics Topic 15 Binary Octal and Hexadecimal
Contemporary Mathematics Topic 15: Binary, Octal, and Hexadecimal Arithmetic
Binary Addition › Recall that binary has just two digits, 0 and 1. › There are then 4 outcomes to addition: 0+0 = 0, 1+0 = 1, 0+1 = 1, and 1+1 = 10 › Just like in base 10, numbers can be “carried”. › For example, to add 1010 and 1111, write them vertically, and “carry” any 1’s you get to the next column.
Example 1: › Add in binary (all numbers listed are in binary). › 100 + 110 › 10101001 + 10010101 › 1101 + 110 + 11 › 1001001001 + 10001011
OCTAL ADDITION Ø We will see tables for much of the remainder of the section. Ø This is the table for octal addition. Ø For example, 6+ 5 in octal would be 13. Ø Just like in other number systems, you can “carry” numbers over.
Example 2: › Add in octal. Use the table on the previous slide. › 7+ 4 › 3+6+5 › 35 + 76 › 564 + 322
HEXADECIMAL ADDITION Ø Here is the table for adding in hexadecimal. Ø Again, the same rules apply, as does carrying. Ø For example, E + B = 19 Ø Another example: 4+A = E
Example 3: › Add in hexadecimal. Use the table on the previous slide. ›A + F › 3 C + 2 D › FF + 4 C › DE 3 B + 9 EBB 78
Subtraction › Subtraction also occurs in binary, octal, and hexadecimal. It works using the addition table backwards. › In all systems, you can “borrow” a 1 from the place value to the left, just like in base 10. › For example, in binary 1010 – 101 = 101 › Another example: In octal, 643 – 45 = 576
Example 4: › Subtract in each case. The number system will be given to you. › Binary: 1010001 – 10010 › Octal: 645 – 317 › Hexadecimal: CCF 4 – B 3 A
Multiplication in Binary › There are 4 cases with multiplication in binary: 0 x 0 = 0, 1 x 0 = 0, 0 x 1 = 0, and 1 x 1 = 1. › The multiplication algorithm works the same as it does in base 10. › Example: 1110 x 110 = 1010100
OCTAL MULTIPLICATION Ø This is the octal multiplication table. Ø Multiplication works the same as in base 10. Ø For example, 5 x 7 = 43 in octal.
HEXADECIMAL MULTIPLICATION Rinse, repeat! Last table. This is the hexadecimal multiplication table.
Example 5: › Perform the indicated multiplication. › 101 x 100 in binary › 356 x 217 in octal › F 3 A x AAB in hexadecimal
Division in Binary › We will just do division in binary, although it is done in the other systems also. I figure you get the idea at this point. › I’ll leave you with this one division problem to try: 110111 by 101 in binary.
- Slides: 14