# Number Systems

Each number system has a base also called a Radix. A decimal number system is a system of base 10; binary is a system of base 2; octal is a system of base 8; and hexadecimal is a system of base 16.

A. Decimal Number System:
Decimal Number system composed of 10 numerals or symbols. These numerals are 0 to 9. Using
these symbols as digits we can express any quantity. It is also called base-10 system. It is a positional
value system in which the value of a digit depends on its position.

These digits can represent any value, for example:
754.
The value is formed by the sum of each digit, multiplied by the base (in this case it is 10 because
there are 10 digits in decimal system) in power of digit position (counting from zero):

Decimal numbers would be written like this:
12710 1110 567310

B. Binary Number System:
In Binary Number system there are only two digits i.e. 0 or 1. It is base-2 system. It can be used
to represent any quantity that can be represented in decimal or other number system. It is a
positional value system, where each binary digit has its own value or weight expressed as
power of 2.

C. Octal Number System:
It has eight unique symbols i.e. 0 to 7. It has base of 8. Each octal digit has its own value or weight
expressed as a power of 8.
The hexadecimal system uses base 16. It has 16 possible digit symbols. It uses the digits 0 through 9
plus the letters A,B,C,D,E,F as 16 digit symbols. Each hexadecimal digit has its own value or weight
expressed as a power of 16.

Binary to Decimal

Example
Convert the Binary number 101011 to its Decimal equivalent.
1 * 2^5 + 0 * 2^4 + 1 * 2^3 + 0 * 2^2 + 1 * 2^1 + 1 * 2^0
32 + 0 + 8 + 0 +2 + 1 = (43)10

Binary fraction to decimal
Example
Convert (11011.101)2 to decimal
2^4  2^3  2^2  2^1 . 2^0  2^-1  2^-2  2^-3

= (1 x 2^4)+ (1 x 2^3)+ (0 x 2^2)+ (1 x 2^1)+ (1 x 2^0)+ (1 x 2^-1)+ (0 x 2^-2)+ (1 x 2^-3)
= 16+8+0+2+1+0.5+0+0.125
= (27.625)10

Decimal to Binary

1. Divide the decimal number by 2.
2. Take the remainder and record it on the side.
3. Divide the quotient by 2.
4. REPEAT UNTIL the decimal number cannot be divided further.
5. Record the remainders in reverse order and you get the resultant binary number

Example
Convert the Decimal number 125 into its Binary equivalent.
125 / 2 = 62 1
62 / 2 = 31 0
31 / 2 = 15 1
15 / 2 = 7 1
7 / 2 = 3 1
3 / 2 = 1 1
1 / 2 = 0 1

Decimal to Octal
The method to convert a decimal number into its octal equivalent:
1. Divide the decimal number by 8.
2. Take the remainder and record it on the side.
3. Divide the quotient by 8.
4. REPEAT UNTIL the decimal number cannot be divided further.
5. Record the remainders in reverse order and you get the resultant binary
Example
Convert the Decimal number 125 into its Octal equivalent.
125 / 8 = 15 5
15/ 8 = 1 7
1/8 =0 1

Octal to Decimal
Method to convert Octal to Decimal:
1. Start at the rightmost bit.
2 . Take that bit and multiply by 8n where n is the current position beginning at 0 and
increasing by 1 each time. This represents the power of 8.
3. Sum each of the product terms until all bits have been used.
Example
Convert the Octal number 321 to its Decimal equivalent.
3 * 82 + 2 * 81 + 1 * 80
192+16+ 1 = (209)10

Method to convert a Decimal number into its Hexadecimal equivalent:
1. Divide the decimal number by 16.
2. Take the remainder and record it on the side.
3. REPEAT UNTIL the decimal number cannot be divided further.
4. Record the remainders in reverse order and you get the equivalent hexadecimal
number.
Example
Convert the Decimal number 300 into its hexadecimal equivalent.
300 / 16 = 18 12-(C)
18 / 16 = 1 2
1 / 16 = 0 1

Method to convert Hexadecimal to Decimal:
1. Start at the rightmost bit.
2. Take that bit and multiply by 16n where n is the current position beginning at 0
and increasing by 1 each time. This represents a power of 16.
3. Sum each terms of product until all bits have been used.
Example
Convert the Hexadecimal number AB to its Decimal equivalent.
=A * 16^1 + B * 16^0
=10 * 16^1 + 11 * 16^0
=160+11 = (171)16

The hexadecimal number system uses the digits 0 to 9 and A, B, C, D, E, F.
Method to convert a Binary number to its Hexadecimal equivalent is:
We take a binary number in groups of 4 and use the appropriate hexadecimal digit in
it’s place. We begin at the rightmost 4 bits. If we are not able to form a group of four,
insert 0s to the left until we get all groups of 4 bits each. Write the hexadecimal
equivalent of each group. Repeat the steps until all groups have been converted.

Example
Convert the binary number 1000101 to its Hexadecimal equivalent.
0100 0101 Note that we needed to insert a 0 to the left of 100.
4 5

Binary to Octal and Octal to Binary
To convert Binary to Octal, as the octal system is a power of two (23), we can take the bits into groups of 3 and represent each group as an octal digit. The steps are the same for the binary to hexadecimal conversions except we are dealing with the octal base now.
To convert from octal to binary, we simply represent each octal digit in it’s three bit binary form.

Example
Convert the Octal number (742)8 to its Binary equivalent.
7 | 4 | 2
111 | 100 | 010

To convert Hexadecimal to Octal, Convert each digit of Hexadecimal Number to it’s binary equivalent and write them in 4 bits. Then, combine each 3 bit binary number and that is converted into octal.

Example
Convert the Hexadecimal number (A42)16 to its Octal equivalent.
A | 4 | 2
1010 | 0100 | 0010
101 | 001 | 000 | 010