Number System
We are going to discuss what is a number system and different kind of number system. More specifically, decimal number system, binary number system and hexadecimal number system.
What Is A Number System
A number system is used to represent a number in different ways. A number system consists of a base denoted by B and a set of digits denoted by D. If you represent a number in base B then you have to use digits from set D only. The set contains B elements. We will study three number system. Below figure shows how a number is represented in a base. You can read about set from here.
Decimal Number System
This is the number system we use in our day-to-day life. In this number system, base B = 10 and D = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} = set of digits allowed in this number system. This is the number system we use in our daily life.
General Formula For Conversion To Decimal Number System.
Any number in a base B can be converted to the decimal number system.
Binary Number System
In a binary number system the base B = 2 and D = {0, 1} = set of digits. Here is an example of binary number “10110111”. Now, we cannot tell what this binary number represents in decimal number system. Just assume what would be our reaction if the price tag on a product in a shop is expressed as binary number.
We are going to convert “10110111” to a number in decimal number system. There are n = 8 digits in the binary number. Following is the conversion:
y = 1 x 2⁷ + 0 x 2⁶ + 1 x 2⁵ + 1 x 2⁴ + 0 x 2³ + 1 x 2² + 1 x 2¹ + 1
y = 128 + 0 + 32 + 16 + 0 + 4 + 2 + 1
y = 183
Hexadecimal Number System
In this number system, we have B = 16 and D = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F} = set of digits. A is used to represent 10 (we write A instead of 10). So, B = 11, C = 12, D = 13, E = 14, F = 15.
Here is a number in hexadecimal number system 2AF03 which contains n = 5 digits. Following is the conversion to decimal number system:
Get rakibul rushel’s stories in your inbox
Join Medium for free to get updates from this writer.
y = 2 * 16⁴ + A * 16³ + F * 16² + 0 * 16¹ + 3
y = 2 * 65536 + 10 * 4096 + 15 * 256 + 0 * 16 + 3 * 1
y = 175875.
Convert Decimal Number To Binary Number
The division algorithm: If a and b are integers such that b > 0, then there are unique integers q and r such that a = b * q + r with 0 ≤ r < b where q is the quotient, r is the remainder, a is the dividend and b is the divisor.
Proof of the theorem is not given as it is not a math course. But if you are interested you can read this book.
Example: let a = 10 and b = 3, then we can write 10 = 3 * 3 + 1, here r = 1 and 0 ≤ r < b.
Let convert 29 to binary number, in the conversion process divisor is always the base of the binary number system which is 2:
- 29 = 2 x 14 + 1 (divisor is 2, dividend is 29, quotient is 14, remainder is 1)
- 14 = 2 x 7+ 0 (divisor is 2, dividend is the quotient from the previous step, quotient is 7, remainder is 0)
- 7 = 2 x 3+ 1 (divisor is 2, dividend is the quotient from the previous step, quotient is 3, remainder is 1)
- 3 = 2 x 1 + 1 (divisor is 2, dividend is the quotient from the previous step, quotient is 1, remainder is 1)
- 1 = 2 x 0 + 1 (divisor is 2, dividend is the quotient from the previous step, quotient is 0, remainder is 0) [we stop here as the quotient becomes 0]
Remember, according to the division algorithm remainder is always going to be smaller than divisor and greater than or equal to 0.
If you write all the remainders starting from step 5 to step 1, then the binary number is “11101”. We stopped at step 5 as the quotient becomes 0. We can cross check by converting 11101 to decimal.
Converting Decimal to Hexadecimal:
let convert 253 to hexadecimal, in the conversion process divisor is 16 which is the base of hexadecimal number system.
- 1514 = 16 x 94 + 10 (divisor is 16, dividend is 1514, quotient is 94 and remainder is 10)
- 94 = 16 x 5 + 14 (divisor is 16, dividend is the quotient from the previous step, quotient is 5, remainder is 14)
- 5 = 16 x 0 + 5 (divisor is 16, dividend is the quotient from the previous step, quotient is 0, remainder is 5) [we stop here as the quotient becomes 0]
If we write all the remainder from step 3 to step 1, then the hexadecimal number would be “5EA”. We write E and A in place of 14 and 10 as respectively as 14 and 10 are represented as E and A respectively in hexadecimal number system.
That is it for this chapter. Next Chapter




