Discrete Math Lecture #05 (2020) PDF
Discrete Math Lecture #05 (2020) PDF
ITCS 1313
2020 / 2021
NUMBER THEORY
Lecture #05
Discrete MATH by Yahya AMER
Outlines
◼ Number Properties
Number Properties
(7392.86)10 (10011.11)2 (2065.64)7 (2031.21)4
In number system we all familiar with decimal numbers such as (8765)
but the question is that what do we mean by saying (7392)?
Ok, now we understood what (9876)10 means, but how about the decimal
number (9876.32)10
(9876.32)10 really ,means:-
Now lets follow the general formula above to see what the number
(4021.2)5 means. It means
4 53 + 0 52 + 2 51 + 1 50 + 2 5-1
Notice again the coefficients are digits between (0 and 4) and the base is 5.
Discrete MATH by Yahya AMER
When we say the binary number (11011)2 we mean:-
1 24 + 1 23 + 0 22 + 1 21 + 1 20
These are the coefficients, which This is the base or the radix,
are (11011) which is 2
Thus when we write the binary number (11011), we only write the coefficients.
1 82 + 2 81 + 7 80 + 4 8-1
Again the HEXADECIMAL number system is of base 16. Thus (B65F)16 means
(11011)2 = 1 24 + 1 23 + 0 22 + 1 21 + 1 20 = (27)10
Discrete MATH by Yahya AMER
153 / 8 = 19 + 1
19 / 8 = 2 + 3
2 /8 = 0 + 2 = (2 3 1)8
Discrete MATH by Yahya AMER
Quotients Remainder
41 / 2 = 20 + 1
20 / 2 = 10 + 0
10 / 2 = 5 + 0
= (1. 0 .1.0 0 1)2
5/2 = 2 + .1
2/2 = 1 + .0
1/2 = 0 + .1
Discrete MATH by Yahya AMER
Quotients + Remainder
230 / 5 = 46 + 0
= (1 4 1 0)5
46 / 5 = 9 + 1
9/5 = 1 + 4
1/5 = 0 + 1
Discrete MATH by Yahya AMER
Quotients + Remainder 0 0
1 1
2291 / 16 = 143 + 3 2 2
= (8 (15) 3 )16 3 3
143 / 16 = 8 + 15 4 4
5 5
= (8 F 3 )16 6 6
8 / 16 = 0 + 8
7 7
8 8
9 9
- Notice that we always divide by the base of the number 10 A
0.25 X 2 = 0 + 0.5 0
0.5 X 2 = 1 + 0.0 1
Therefore, (0.25)10 = (0.01)2 we combine both binary numbers.
So (41.25 )10 = (101001)2 + (0.01)2 = (101001.01)2
Discrete MATH by Yahya AMER
0.6875 X 2 = 1 + 0.3750 1
0.375 X 2 = 0 + 0.75 0
0.75 X 2 = 1 + 0.5 1
0.5 X 2 = 1 + 0.0 1
Notice that we read the result of the coefficients from top to the
bottom. Notice also we always multiply by the base of the number
system we want to convert to. Also when we get all 0 in the fraction
we can stop. However what if we could not get 0 in the fraction.??
Discrete MATH by Yahya AMER
0.33 X 2 = 0 + 0.66 0
0.66 X 2 = 1 + 0.32 1
0.32 X 2 = 0 + 0.64 0
0.64 X 2 = 1 + 0.28 1
0.28 X 2 = 0 + 0.56 0
0.56 X 2 = 1 + 0.12 1
0.12 X 2 = 0 + 0.24 0
Notice here that the fraction does not seem to be going to 0. so we can stop any time
depending on the accuracy of the fraction we want.
So the binary value of (0.33)10 = (0.0101010…….)2
To get the idea more clear, the fraction (7/22) = (0.318) will do the job. But if we
want to be more accurate (7/22) = (0.318181818). and again if we want to be more
and more accurate (7/22) = (0.318181818181818181818181818…….).
Thus when we convert fraction number into binary, we can stop according
to the accuracy we want.
Discrete MATH by Yahya AMER
First we divide (1101101101) 2 into groups of 3 digits from right to left as follows
( 1 5 5 5 )8
Then we find the value of each group as shown above. Notice that we add 2 zeros to
left side of the 1 which does not change its value. It is a good habit to do like this.
=( 3 5 0 7 . 5 4 )8
=( 7 2 1 3 . 1 3 )8
Notice that when we grouped the fraction part we started from left to right. So when
we grouped the fraction (0.1011) 2, we grouped it as (101 100) 2 NOT (1 011) 2 which
would give us different value.
Notice also we added 00 to (1) to make it (100) which is group of 3. thus
(0.1011 ) → (101 1) → (5 1)8 is WRONG. And the right thing is to add 00 to (1) to
make group of 3 digits. So the correct answer is (101100) 2 = (5 4)8
Discrete MATH by Yahya AMER
(10110001101011.111101)2 = ( 2 C 6 B . F 4 ) 16
Discrete MATH by Yahya AMER
(56.32) 8 → ( 5 6 . 3 2 )8
( 101 110 . 011 010 ) 2 → (101110.011010) 2
Example : Convert (306.D)16 to binary
(306.D) 16 → ( 3 0 6 . D ) 16
( 011 000 110 . 1101 ) 2 → (11000110.1101) 2
Example: Convert (234)5 to binary.
Since there is no systemic way to do , we first convert it to decimal then we
convert into binary.
First we convert it to Decimal →(234)5 = (69)10
Then we convert the decimal number to binary → (69)10 = (1000101)2
So (234)5 = (1000101)2
Discrete MATH by Yahya AMER
Octal To Hexadecimal and vise versa:-
The easiest way to do it is first to convert from Octal to binary and then convert the binary back
to Hexadecimal. For example: Convert (37345.25)8 to Hexadecimal.
(37345.25)8 → ( 3 7 3 4 5 . 2 5 )8
( 011 111 011 100 101 . 010 101 )2
(11111011100101.010101)2 = (0011 1110 1110 0101 . 0101 0100 )2
= ( 3 14 14 5 . 5 4 )16
= ( 3 E E 5 . 5 4 )16
So (37345.25)8 = (3EE5.54)16
Now to convert from Hexadecimal to Octal we follow the same procedure by first
converting the hexadecimal number to binary and then from binary to Octal.
Example : Convert (3EE5.54)16 to Octal
(3EE5.54)16 =( 3 E E 5 . 5 4 )16
= (0011 1110 1110 0101 . 0101 0100 )2
= (0 0 1 1 1 1 1 0 1 1 1 0 0 1 0 1 . 0 1 0 1 0 1 0 0 )2
= (0 011 111 011 100 101 . 010 101 000 )2
= (0 3 7 3 4 5 . 2 5 0 )8
Discrete MATH by Yahya AMER