Number System — Decimal, Binary, Octal, Hexadecimal | Conversions: Decimal to all three, binary to all three, Octal to all three, Hexadecimal to all three.
Number System
Number System is a way to represent Numbers. Our perspective of the number Systems from a young age is quite stuck to ones & tens. You might have seen 0s and 1s arranged in a pattern and ever wondered how and why are they arranged that way? Let’s get an idea.
Number System as the name suggests is the way of expressing Numbers, i.e Mathematical Notation using digits, characters, letters, and various symbols. It defines a set of values for representing quantity. There’re 10 symbols ranging from 0,1,2,3,4,5,6,7,8,9 with which the whole Number System is made.
Types of Number System -
There are four types of Number systems popularly known. They are :
- Decimal (Base10): Number System with the base value of 10. It uses 10 digits 0–9.
- Binary (Base2): Number System with the base value of 2. It uses 0s and 1s.
- Octal (Base8): Number System with the base value of 8. It has digits ranging from 0,1,2,3,4,5,6,7.
- Hexadecimal (Base16) : Number System with the base value of 8. It has digits ranging from 0,1,2,3,4,5,6,7,8,9,10=A,11=B,12=C,13=D,14=E,15=E.
Conversions -
- Decimal to Binary :
( )10 → ( )2
To convert decimal into binary i.e base10 to base2, we divide the binary value (base 10) by 2 to obtain the binary value (base 2).
Ex : (45)10 to ( )2
45/2 , Q =22, R= 1
22/2 , Q =11, R=0
11/2 , Q=5, R=0
5/2 , Q=0, R=1
2/2 , Q=1, R=0
The final remainder is the “least significant bit” and the first remainder is the “most significant bit”
So, the binary number follows LSB -> MSB.
Hence (1001001)2
(45) 10 = (1001001) 2.
2. Decimal to Octal :
( )2 → ( )8
To convert base10 to base8 i.e decimal to Octal, divide the base10 value i.e decimal value by 9 to obtain the octal i.e base8.
Ex : (20)10 →( )8
20/8 Q=2, R=4
Hence (20)10 = (24)8.
3. Decimal to Hexadecimal :
( )10 → ( )16
To convert decimal value i.e base-10 to Hexadecimal i.e base-16, divide the decimal i.e, base-10 value with 16, to obtain the hexadecimal value i.e base-16.
Ex : (30)10 → ( )16
30/16, Q=1, 2=14.
(30)10 → (1 14) 16
Hence (30)10 = (1E) 16
4. Binary to Decimal :
( )2 → ( )10
To convert binary i.e base-2 to decimal i.e base-10, the system is based on 2^n. Multiply each value of binary with the increasing order of 2^n, n = 0, 1, 2, 3, 4… starting from left to right and add the values to obtain a final decimal value i.e base-10.
Ex : (1100)2 → ( )10
(1 1 0 0 ) → (1x²³) + (1x ²²) + (0x²¹) + (0x2°)
= 8 + 4 + 0 + 0 =(12)10.
5. Octal to Decimal :
( )8 → ( )10
To convert, Octal i.e base-8 to decimal i.e base-10, multiply each value in Octal with 8^n and add the sum.
(76)8 → ( )10
(7x8') + (6x8°)
=56 + 6 = (62)10
6. Hexadecimal to decimal :
( )16 → ()10
To get the decimal value .ie base 10 of base 16 i.e Hexadecimal, multiply the hexadecimal with 8^n and add.
(2 F)16 → ( )10
(2 15)16
(2*16¹) + (15*16⁰)
= 32 + 15 = (47)10.
7. Binary to Octal :
( )2 → ( )8
To convert binary (base 2) to Octal (base 8), first we have to convert it into decimal (base10) and then to Octal.
( )2 → ( ) 10 →( )8
Ex : (1101)2
(1x²³) + (1 x ²²) + (0 x ²¹) + (1x2°)
= 8+4 +1 = (13)10
We obtained the decimal value (base-10). Now convert the decimal value to octal (base-8).
(13)10 → ( )8
13/8, Q=1, R=5
Hence (13)8 → (15)8
8. Binary to Hexadecimal :
( )2 →( )16
To convert binary (base 2) to hexadecimal (base 16), convert the binary into a decimal first and then to Hexadecimal
Ex : (1111)2 → ( )10 →( )16
(1x ²³) + (1x ²²)+ (1 x²²) + (1x2°).
=8+ 4 + 2 + 1 = (15) 10.
Now, converting the decimal values to hexadecimal
(15)10 → ( )16
Divide the value by 16 to get hexadecimal
15=F, Hence (15)10 → (F) 16
9. Octal to Binary :
( )8 → ( )2
To convert, Octal (base 8) to binary (base 2), we have to first convert it into decimal (base-10)
Ex: (76)8 → ( )2
(76)8 → ( )10
(7x8') + (6 x 8°) = 56 +6 = (62)10
(62)10 → (?)2
=(111110)₂.
10. Octal to Hexadecimal :
( )8 → ( ) 16
To convert, Octal (base 8) to hexadecimal ( base (6), we have to first convert it into decimal (base 10).
Ex : (55)8 →( )16
(5x8') + (5x8°)
40+ 5 =(45)10
(45)10 → (?)16 = (213)16 =(2D).
11. Hexadecimal to Binary :
( )16 → ( )2
First we have to convert it into Decimal and then to Binary.
( )16 → ( )10 → ( )2
Ex: (9C) 16 → ( )2
(913)16 →(?)10 → ( )2
(9x1⁶¹) + (13x6°) = (157) 10
(157)10 →(10011101)2.
12. Hexadecimal to Octal :
( )16 → ( )8
Ex :(1A)16 → ( )10
(1x1⁶¹)+ (10x1⁶⁰) = (26) 10.
(26)10 → ( ?)8
(11010) → (32)8