Discrete Mathematics Numbering System
Number systems Binary digits: 0 and 1, called bits. Binary (2 digits), octal (8 digits) and hexadecimal (16 digits) numbering systems. We already know about decimal (10 digits) system: Example: 45,238 is equal to 8 ones 8 x 1 = 8 3 tens 3 x 10 = 30 2 hundreds 2 x 100 = 200 5 thousands 5 x 1000 = 5000 4 ten thousands 4 x 10000 = 40000
Binary number system From binary to decimal: The number 1101011 is equivalent to 1 one 1 x20 = 1 1 two 1x21 = 2 0 four 0x22 = 0 1 eight 1x23 = 8 0 sixteen 0x24 = 0 1 thirty-two 1x25 = 32 1 sixty-four 1x26 = 64 107 in decimal base
From decimal to binary The number 7310 is equivalent to 73 2 remainder 1 36 2 remainder 0 18 2 remainder 0 9 2 remainder 1 4 2 remainder 0 2 2 remainder 0 1 2 remainder 1 0 7310 = 10010012 (write the remainders in reverse order preceded by the quotient)
Binary addition table 1 10
Adding binary numbers Example: add 1001012 + 1100112 1 1 1 carry ones 1001012 1100112 10110002
Hexadecimal number system Decimal system 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 A B C D E F Hexadecimal system
Hexadecimal to decimal The hexadecimal number 3A0B16 is 11 x 160 = 11 0 x 161 = 0 10 x 162 = 2560 3 x 163 = 12288 1485910
Decimal to hexadecimal Given the number 234510 2345 16 remainder 9 146 16 remainder 2 9 16 remainder 9 234510 is equivalent to the hexadecimal number 92916
Hexadecimal addition Add 23A16 + 8F16 1 23A16 + 8F16 2C916 What actually happen? (A16 = 1010) + (F16 = 1510) = 2510 Then 2510/16 = 1 remainder 9, meaning 2510 = 1916. 1 + 3 + 8 = 12 12 in hexadecimal = C16.
Conversion from Binary to Hexadecimal One of the easiest to convert binary to hexadecimal is by grouping the binary digits from right to left in a group of four. Convert each group to a hexadecimal digit. Eg. 1011011102 = ? 16 1 0110 11102 20 2322 2120 23222120 1 6 E = 16E 16
Conversion from Hexadecimal to Binary One of the easiest to convert hexadecimal to binary is by converting each hexadecimal digit to a group of four binary digits from right to left. Convert each group to a hexadecimal digit. Eg. 5 A C 16 = ?2 5 A C16 =5 10 = 10 10 = 1210 101 1010 1100 = 101101011002