|
|
![]() |
|
| |||||||||||||||||||||||||
Notice that we could use those powers of sixteen to rewrite our problem. If we wrote the number F6816 without using the chart, it could be written as 8 x 1 + 6 x 16 + F x 256 or as 8 x 1 + 6 x 16 + 15 x 256. Evaluating that expression following the order of operations yields 8 + 96 + 3840 or a value of 3944. This means that the hexadecimal number F6816 is the same as the decimal number 3944.
We may want to count in base sixteen. We could put the information in a table to show the first twenty numbers in the hexadecimal system. These numbers would correspond to the first twenty numbers in the decimal system.
Table 2 ~ 7.1
Hexadecimal Number
Decimal Number
1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
A
10
B
11
C
12
D
13
E
14
F
15
10
16
11
17
12
18
13
19
14
20
It would be quite time-consuming to make a chart for all of the decimal values that correspond to a given hexadecimal number. Students may memorize some of the values merely because the values are encountered quite often. It is not necessary to memorize the table, however, since converting the hexadecimal number to expanded notation and then evaluating the number can be done quite easily.
Example: Convert C27D16 to a decimal number.
Solution: First, identify the value of each digit. The first digit on the right, the digit D is in the units or the sixteen to the zero power place; the next digit 7, is in the sixteen to the first power place; the next digit 2, is in the sixteen to the second power place; the final digit C is in the sixteen to the third power place.
Table 3 ~ 7.1
| Digit | x | Power of Sixteen | = | Value |
| D | x | 160 or 1 | = | D16 |
| 7 | x | 161 or 16 | = | 7016 |
| 2 | x | 162 or 256 | = | 20016 |
| C | x | 163 or 4096 | = | C00016 |
| Total Value | C27D16 | |||
If we wrote the number without using the chart, the number would be:
D x 160 + 7 x 161 + 2 x 162 + C x 163
or D x 1 + 7 x 16 + 2 x 256 + C x 4096
or 13 x 1 + 7 x 16 + 2 x 256 + 12 x 4096
Following the order of operations, this becomes 13 + 112 + 512 + 49152 which equals 49789. This means that C27D16 is the same as the decimal number 49789.
7.1 ~ Practice Problems
Directions: Turn off your VCR. Convert the following hexadecimal numbers to decimal numbers. When you have finished working the problems, check your answers in the Answer Key. Turn your VCR back on to view the solutions.
7.1~ Homework Problems
Directions: Turn off your VCR. Convert the following hexadecimal numbers to decimal numbers. When you have finished working the problems, check your answers in the Answer Key. If you have any questions, contact your instructor.
7.2 ~ Converting Hexadecimal to Binary to Octal
Turn on your VCR and continue with this section. If you have purchased a textbook, follow along in your book. If you are using the Internet version, follow along on the webpage. If you have any difficulties, contact your instructor. After the explanation of converting a hexadecimal number to binary or octal, turn off the video player and try to work the practice problems. Once you have worked the problems, check your answers in the answer key listed in the back of your book or click on the Answer Key links at the end of every section.
Suppose we have a hexadecimal number and we want to determine its binary equivalent. First, we must think about the relationship between a hexadecimal number and a binary number. One way of thinking about this is to make a table that counts or lists the first twenty values in both systems just like we did when we compared the binary number system to the hexadecimal number system in Section 5 and when we compared the hexadecimal number system to the decimal number system earlier in Section 7.
Table 1 ~ 7.2
| Hexadecimal Number | Binary Number |
| 1 | 001 |
| 2 | 010 |
| 3 | 011 |
| 4 | 100 |
| 5 | 101 |
| 6 | 110 |
| 7 | 111 |
| 8 | 1000 |
| 9 | 1001 |
| A | 1010 |
| B | 1011 |
| C | 1100 |
| D | 1101 |
| E | 1110 |
| F | 1111 |
| 10 | 10000 |
| 11 | 10001 |
| 12 | 10010 |
| 13 | 10011 |
| 14 | 10100 |
Table 2 ~ 7.2
Example 1: Convert the hexadecimal number 1EA16 to a binary number and then convert the binary number to an octal number.
Solution: To begin, take each digit in the hexadecimal number and from Table 7.2.1 find the four digit binary number that represents the given hexadecimal digit.
A16 in the units place in the hexadecimal system is the same as 10102 in the binary system.
E16 in the sixteen to the first power place in the hexadecimal system is the same as 11102 in the binary system.
116 in the sixteen to the second power place in the hexadecimal system is the same as 00012 in the binary system.
Copying down the groups of four binary digits first for the one, then for the E, and finally for the A gives us the binary number. This means that the hexadecimal number 1EA16 is the same as the binary number 0001111010102. Notice the 0001 in place of the one, the 1110 in place of the E, and the 1010 in place of the A. Of course, it is convention to omit any zeros at the front (left side) of the number. Following convention, we would write 1111010102. In order to make sure this is the correct conversion, we could convert both the binary number and the hexadecimal number to their decimal equivalent and see if the results are the same. (In this case 1EA16 is A x 160 + E x 161 + 1 x 162 or 10 x 1 + 14 x 16 + 1 x 256 or 490 and 1111010102 is 1 x 2 + 1 x 23 + 1 x 25 + 1 x 26 + 1 x 27 + 1 x 28 or 2 + 8 + 32 + 64 + 128 + 256 or 490.)
Now we will convert the binary number 1111010102 to an octal number. First of all, group the binary numbers into groups of three digits starting from the right hand side. This means that there will be three groups since there are nine digits. (Recall: if the number of digits is not divisible by three, add zeros on the left hand side to make a number of digits divisible by three for the groupings.)
0102 in the binary system is the same as 28 in the units place in the octal system (refer back to Table 5.2.1 for the conversion).
1012 in the binary system is the same as 58 in the eights place in the octal system.
1112 in the binary system is the same as 78 in the eight to the second power place in the octal system.
This means that the binary number 1111010102 is the same as the octal number 7528. In order to make sure this is the case, we could convert both the binary number and the octal number to their decimal equivalent and see if the results are the same. (In this case 7528 is the same as 2 x 80 + 5 x 81 + 7 x 82 which is the same as 2 x 1 + 5 x 8 + 7 x 64 or 2 + 40 + 448 which equals 490. We have already seen that the binary number 1111010102 is 490.)
Thus the hexadecimal number 1EA16 = 1111010102 =7528.
Example 2: Convert the hexadecimal number 201C16 to a binary number and then covert the binary number to an octal number.
Solution: To begin, take each digit in the hexadecimal number and from Table 7.2.1 find the four digit binary number that represents that hexadecimal digit.
C16 in the units place in the hexadecimal system is the same as 11002 in the binary system.
116 in the sixteens place in the hexadecimal system is the same as 00012 in the binary system.
016 in the 162 place in the hexadecimal system is the same as 00002 in the binary system.
216 in the 163 place in the hexadecimal system is the same as 00102 in the binary system.
Copying down the groups of four binary digits first for the two, then for the zero, next for the one, and finally for the C gives us the binary number. This means that the hexadecimal number 201C16 is the same as the binary number 00100000000111002. Notice the 0001 in place of the two, the 0000 in place of the zero, the 0001 in place of the one, and the 1100 in place of the C. As is customary in mathematics, leading zeros on the left of a number are typically not written down which mean that our number should look like 100000000111002. In order to make sure is the correct conversion, we could convert both the binary number and the hexadecimal number to their decimal equivalent and see if the results are the same. (In this case 201C16 is C + 1 x 16 + 0 x 256 + 2 x 4096 or 12 + 16 + 8192 or 8220 and 100000000111002 is 1 x 22 + 1 x 23 + 1 x 24 + 1 x 213 or 4 + 8 + 16 + 8192 which equals 8220.)
Now we will convert the binary number 100000000111002 to an octal number. First of all, group the binary numbers into groups of three digits starting from the right hand side. This means that there will be five groups since there are fourteen digits. (Recall: if the number of digits is not divisible by three, add zeros on the left hand side to make a number of digits divisible by three for the groupings. This means our number looks like 0100000000111002.)
1002 in the binary system is the same as 48 in the units place in the octal system (refer back to Table 5.2.1 for the conversion).
0112 in the binary system is the same as 38 in the eights place in the octal system.
0002 in the binary system is the same as 08 in the eight to the second power place in the octal system.
0002 in the binary system is the same as 08 in the eight to the third power place in the octal system.
0102 in the binary system is the same as 28 in the eight to the fourth power place in the octal system.
This means that the binary number 100000000111002 is the same as the octal number 200348. In order to make sure this is the case, we could convert both the binary number and the octal number to their decimal equivalent and see if the results are the same. (In this case 200348 is the same as 4 x 80 + 3 x 81 + 2 x 84 which is the same as 4 x 1 + 3 x 8 + 2 x 4096 or 4 + 24 + 8192 which equals 8220. We have already seen that the binary number 100000000111002 is 8220.)
Thus the octal number 201C16 = 100000000111002 = 200348.
7.2 ~ Practice Problems
Directions: Turn off your VCR. Convert the following hexadecimal numbers to binary numbers and then to octal numbers. Check your answers in the Answer Key. Turn the VCR back on to view the solutions to the practice problems.
7.2 ~ Homework Problems
Directions: Turn off your VCR. Convert the following hexadecimal numbers to binary numbers and then to octal numbers. Check your answers in the Answer Key. If you have any questions, contact your instructor.
This concludes Section Seven
Updated January 2004
|
|||||||||||||||||||||
|
|