Section4.3ma116notes..

advertisement
1
Section 4.3: Different Base Systems
Practice HW from Mathematical Excursions Textbook (not to hand in)
p. 205 # 21-27 odd, 17, 1-19 odd
Recall that the number system that we use (the Hindu-Arabic system is a base 10
system since all numbers can be written as a sum of the powers of 10). In this section, we
learn about other modern place value systems. In particular, we discuss how to convert
between bases used in modern times, and bases that computers use.
Binary Numbers
Binary Numbers are base 2 numbers are made up only of 0’s and 1’s. Computers use
these numbers to represent data internally. Examples of binary numbers are 0 (which
represents the number 0) 100 (which represents the number 4), 1001 (which represents
the number 9), and 1011000 (which represents the number 88). We now give a formal
definition of a binary number.
Definition: A binary number bk bk 1 b2b1b0 , where bi  0 or 1 , represents the base 10
decimal number given by
bk 2k  bk 1 2k 1    b2 22  b1 21  b0 20
We illustrate this definition in the following examples.
Example 1: Find the base 10 decimal representation of the binary number 100 2 .
Solution:
█
2
Example 2: Find the base 10 decimal representation of the binary number 1011000 2 .
Solution:
█
Example 3: Find the base 10 decimal representation of the binary number 11100010112 .
Solution:
█
3
Note: To convert a decimal (base 10) number to binary, we compute the powers of 2
(starting with 20 ) that are less than the given number. Then write the number as a sum of
these powers of 2 from largest to smallest, writing a coefficient of 1 in front the power of 2
that occurs in the sum and a 0 in front of the power of 2 that does not occur. Reading off
the coefficients from left to right gives the binary representation. We illustrate this
technique in the following examples.
Example 4: Convert 77 to binary.
Solution:
█
Example 5: Convert 320 to binary.
Solution:
█
4
Example 6: Convert 5413 to binary.
Solution: We start by computing the powers of 2 that are less than 5413. This gives
20  1
21  2
22  4
2 4  16
2 5  32
2 6  64
28  256
212  4096
2 9  512 213  8192  4096 STOP!
210  1024
2 3  8 2 7  128 211  2048
Then we can write 5413 as
5413  4096  1317
 4096  1024  293
 4096  1024  256  37
 4096  1024  256  32  5
 4096  1024  256  32  4  1
 212  210  28  2 5  2 2  2 0
 1  212  0  211  1  210  0  2 9  1  28  0  2 7  0  2 6  1  2 5  0  2 4  0  2 3  1  2 2  0  21  1  2 0
Thus, reading off the coefficients, we see that the binary representation (base 2)
representation of 5413 is
10101001001012
█
Conversion to Numbers Involving Other Bases
We can extend the above concepts to arbitrary base conversions. We extend the concept of
binary numbers to arbitrary bases.
Definition: A number of base a given by bk bk 1 b2b1b0 , where 0  bi  a , represents
the base 10 decimal number given by
bk a k  bk 1a k 1    b2 a 2  b1a1  b0 a 0
5
Fact: The number of digits a number of base a can have is always one less than a. For
example
For a base a = 2 (binary) number, the allowed digits are 0 and 1
For a base a = 3 number, the allowed digits are 0, 1, and 2.
For a base a = 10 number, the allowed digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.
We illustrate this definition in the following examples.
Example 7: Convert the numeral 201three to base 10.
Solution:
█
Example 8: Convert the numeral 5476 eight to base 10.
Solution:
█
6
Notes
1. Numbers with bases larger than 10 need additional digits. The additional digits are
added starting with the letter A and adding subsequent letters when need. The letters in
base 10 represent increasing values. For example, A = 10, B = 11, C = 12, D = 13, etc.
For example, the following represent the digits and their numerical base 10 values for
the base 12 and base 16.
Base 12 Digit
Base 10 Value
0
0
Base 16 Digit 0
Base 10 Value 0
1
1
1
1
2
2
3
3
2
2
4 5
4 5
3
3
6
6
4
4
7
7
5
5
8
8
9
9
6
6
A
10
7
7
B
11
8
8
C
12
9
9
D
13
A
10
E
14
B
11
F
15
2. The bases two (binary), eight (octal) and sixteen (hexadecimal) are number systems
that are important in computer science.
Example 9: Convert the numeral EA3 sixteen to base 10.
Solution:
█
7
Converting From Base Ten Numbers Back to an Arbitrary Base
Converting from base ten numbers back to numbers of an arbitrary base is a slightly more
difficult process. The basic behind goes back to the process of long division you learned in
high school. We review this concept in the following example.
Example 10: Consider 40  3 
40
. Determine the quotient and remainder and write the
3
result as an equation.
Solution:
█
To determine the quotient and remainder for division of larger numbers, we can use a
calculator for assistance. The process involves getting the quotient by performing the
division on the calculator and truncating or chopping all the digits to the right of the
decimal point. We illustrate the process in the following example.
Example 11: Calculate the quotient and remainder of the division 1024  37 using a
calculator.
Solution:
█
8
Note: To convert a decimal (base 10) number to and arbitrary base a, we compute the
powers of a (starting with a 0 ) that are less than the given number. Then take the highest
power of a that divides into the given number. The quotient of this division will represent
the coefficient of the power of this power of a that occurs in the base a representation.
The remainder is then taken, the power of a is decreased by 1, and the process is repeated
until a 0  1 is reached. We illustrate this technique in the following examples.
Example 12: Convert 687 to base five.
Solution:
█
9
Example 13: Convert 5123 to base twelve.
Solution:
█
Download