06. Aptitude Questions - Numbers Theory - Number Systems - Conversions

kvrrs
Number Systems:
A number system is a format for representing different numerical values
Any number system calculates the value of the number being represented by
    1)   The digit used to represent and
    2)   The place where the digits are present in the actual number.
How the value of the number is calculated also depends on the base of the number system.
Definition of Base of a number system: The base of a number system is the number of digits used to represent the number in that number system. The base is also called radix
We use 10 digits to represent the numbers in the decimal number system, so the base of the decimal number system is 10.
In case a number XYZ  *where X ,Y, and Z are digits are represented in some number system, which has a base “B”, its value would be calculated by the expression: X x B2 + Y x B + Z
Decimal Number System:
The system generally used by the convention is the decimal number system. The base of the decimal number system is 10(ten), and the digits used are from 0(zero) to 9(nine)
In the decimal number system, a number can be represented as
47218= 4 x 104 + 7 x 103 + 2 x 102 + 1 x 101 + 8 x 100
             = 40000 + 7000 + 200 +10 +8
Binary Number System:
The digits used for the binary system would be 0 and 1. We use only 2 digits in the binary number system, so the base of the binary number system is 2.
The binary digits o and 1 are called bits.
In the binary number system, zero is represented by 0, and 1 is represented by 1. After 1, there is no any digit to represent two. Therefore, two is written is as 10, three written as 11. Again the number four is represented as 100.
For a number represented as 10101 in the binary system would have a value of
(1 x 20) + (0 x 21) + ( 1 x 22) + (0 x 23 ) + 1 x 24)  which amounts to 1 +0 + 4 + +0 + 16 =21
Octal Number System:
The digits use for the octal system would be 0 through 7. The number of digits used in this system is 8, so base of the octal number system is 8.
The number 8 of the decimal number system is represented by 10, 9 by 11, and so on.
For example , a number represented as 123 in the octal number system would have a value of 1 x 82 + 2 x 81 + 3 x 80 which amounts to  64 + 16 + 3=83 as represented in the decimal system.
Hexadecimal Number System:
The base of the hexadecimal number system is 16. The ten digits from 0 to 9 and letters from A to F are used to represent numbers in this system.
The digits 0 to 9 are same as those for the decimal number system, and digits from 10 to 15 are represented by alphabets A to F respectively.
For example, a number represented as  6A9 in the hexadecimal number system would have a value of 6 x 162 + A x 161 + 9 x 160 which amounts to 6 x 256 + 10 x 16 + 9 = 1705 as represented in the decimal number system.

Conversion of Base 10 to Base 2 :
Conversion of Decimal Number to Binary Number:
In case a number ABC (with A, B, and C as the digits) represented in the base 10 system, is to be converted to a binary system, then it has to be repeatedly divided by 2. The remainders obtained on each division provide the digits that would appear in the binary system.
Thus a number 25 can be repeatedly divided by 2 as follows.
Number
/
Base
Quotient
Remainder
25
/
2
12
1
12
/
2
6
0
6
/
2
3
0
3
/
2
1
1
1
/
2
0
1

Repeated division until we get the remainder 0, gives the remainders .1,0,0,1 and 1 in that order. On writing these in the reverse order, we get the binary number 11001.
Example 2: Convert 125(10) to equivalent binary number.
       2 | 125
       2 | 62 - 1
       2 | 31-  0
       2 | 15 - 1  
       2 |  7  - 1 
       2 |  3 -  1
       2 |  1 -  1
             0   - 1

The binary equivalent of 125(10) is 1111101(2)

Conversion of a Decimal Fraction to Binary Fraction:
The conversion of a decimal fraction to a binary fraction can be done using the successive multiplication by 2 techniques.
Following example will explain the procedure to convert a decimal fraction to a binary fraction:

Fraction
Fraction x2
Remainder Fraction
Integer
0.25
0.5
0.5
0
0.5
1
0
1

0.25(10) = 0.01


Conversion of A Binary Number System To Decimal Number System
To convert binary number to decimal number, follow the procedure:
Example : Convert 11001(2) to equivalent decimal number
Solution : 11001 = 1 x 24 + 1 x 23 + 0 x 22 + 0 x21  + 1
                         =16 + 8 + 0 + 0 + 1
                          =25        
Example 2: Convert 10.101 to equivalent decimal number
Solution :  10.101(2)  = 1 x 2 + 0 x 2 + 1 x 2-1 + 0 x 2-2 + 1 x 2-3
                                            = 1 x 2 + 0 x 2+ 1/2 + 0/4 + 1/8
                               = 2 + 0 +0.5 +0 +0.125
                                = 3.625

Conversion of a decimal number to octal number :
How to convert a number from base 10 to base 8 :
In case a number ABC (with A, B, and C as the digits) represented in the base 10 system, is to be converted to an octal system, then it has to be divided by 8 repeatedly. The remainders obtained on each division provide the digits that would appear in the octal number.

Number
/
Base
Quotient
Remainder
205
/
8
25
5
25
/
8
3
1
3
/
2
1
1

We have to repeat the division until we get the remainder zero. The remainders obtained are 5,1, and 1. On writing these in the reverse order, we get the octal number 115.
Example 2:  Convert 463(10) to equivalent octal number.
       8 | 463
       8 | 57- 7
       8 |  7-  1
             0 - 7  

The octal equivalent of 463(10) is 717(8)

Conversion of octal number  to decimal number :
Example 1:Convert 716(8) to equivalent decimal number
Solution:  716(8) = 7 x 82 + 1 x 81 + 6 x 80
                        = 7 x 64 + 1 x 8 + 6
                        = 448 + 8 + 6 = 462

Example 2 : Convert 65.24 to equivalent decimal number
Solution :     65.24(8) = 6 x 8 + 5 + 2/8 + 4/82
                             =48 + 5 +0.25+0.0625
                              = 53.3125
         
Conversion of a decimal number to Hexadecimal Number:
In case a number ABC (with A, B, and C as the digits) represented in the base 10 system, is to be converted to an octal system, then it has to be divided by 16 repeatedly. The remainders obtained on each division provide the digits that would appear in the octal number.

Number
/
Base
Quotient
Remainder
410
/
16
25
10
25
/
16
1
9
9
/
16
0
9

We have to repeat the division until we get the remainder zero. The remainders obtained are 10, 9, and 9.
In the hexadecimal number system, the equivalent number for 10 is A.
On writing these in the reverse order, we get the octal number 99A.
Example 2:  Convert 8655(10) to equivalent decimal number.
       16 | 8655
       16 | 540- 15
       16 |  33-  12
       16 |   2 -   1 
                0 -   2  
The hexadecimal equivalents to 12 and 15 are C, F
       The octal equivalent of 8655(10) is 21CF(8)

Conversion of the Hexadecimal number to Decimal Number:
To convert a hexadecimal number to a decimal number, multiply each digit of the given hexadecimal number by powers of 16 as follows :
Example: Convert 90BA(16) to equivalent decimal number
Solution : 90BA(16) = 9 x 163 + 0 x  162 + B x 161 + A x 160
                              = 9 x 4096 + 0 x 256 + 11 x 16 +10 x 1
                              =36864 + 0 + 176 +10 =37050