Converting base 10 to base 2-
In number system, it is very important to have a good knowledge of how to convert numbers from one base to another base.
In the last article, we discussed-
How to convert a number from any given base to base 10?
In this article, we will discuss how to convert any given number from base 10 to base 2.
Any number can be easily converted from base 10 to any other base using division method and multiplication method.
(Given Number)_{10} → (?)_{2} |
There are two cases possible-
Case-01: For numbers carrying no fractional part
Case-02: For numbers carrying a fractional part
Case-01: For numbers carrying no fractional part-
To convert the numbers carrying no fractional part from base 10 to base 2, we will use division method.
Division method involves following 2 steps-
Step-01:
Divide the given number (in base 10) with 2 until the result finally left is less than 2.
Step-02:
Traverse the result and remainders from bottom to top to get the required number in base 2.
Example-
Suppose we want to convert a number (18)_{10} to base 2.
(18)_{10} → (?)_{2}
Then using division method, we have-
Thus,
(18)_{10} = (10010)_{2} |
For numbers carrying a fractional part-
Suppose the given number consists of some real part and some fractional part.
To convert such numbers from base 10 to base 2, we will treat the real part and fractional part separately.
For real part-
To convert the real part of number to base 2, we will use division method as we have used in above example.
For fractional part-
To convert the fractional part of number to base 2, we will use multiplication method.
Multiplication method involves following steps-
Step-01:
Multiply the given fractional number with 2 and write the real part and fractional part of result so obtained separately.
Step-02:
Multiply the fractional part obtained after multiplication in previous step with 2 and write the real part and fractional part of result so obtained separately.
Step-03:
Recursively apply step-02 until fractional part obtained after multiplication becomes 0.
(In case fractional part does not terminate to 0, we can find the result up to as many places as we want.)
The series of real part of multiplication results obtained in above steps from top to bottom is the required number in base 2. |
Following example illustrates how to apply these steps-
Example-
Suppose we want to convert a number (18.625)_{10} to base 2.
We will treat the real part and fractional part separately.
For real part-
The real part (18)_{10} will be converted to base 2 in exactly the same manner using division method as we have done above.
So, for real part, we have-
(18)_{10} = (10010)_{2} |
For fractional part-
The fractional part (0.625)_{10} will be converted to base 2 using multiplication method.
Using multiplication method, we have-
Real part | Fractional Part | |
0.625 x 2 | 1 | 0.25 |
0.25 x 2 | 0 | 0.50 |
0.50 x 2 | 1 | 0.0 |
Now, traverse the real part column from top to bottom to obtain the required number in base 2.
Thus,
(0.625)_{10} = (101)_{2} |
Explanation-
Step-01:Multiply 0.625 with 2. Result = 1.25. Write 1 in real part and 0.25 in fractional part.
Step-02:Multiply 0.25 with 2. Result = 0.50. Write 0 in real part and 0.50 in fractional part.
Step-03:Multiply 0.50 with 2. Result = 1.0. Write 1 in real part and 0.0 in fractional part. Since, fractional part becomes 0, so we stop. |
Combining the result of real and fractional parts, we have-
(18.625)_{10} = (10010.101)_{2} |
PRACTICE PROBLEM BASED ON CONVERTING FROM BASE 10 TO BASE 2-
Problem-
Convert the following numbers from base 10 to base 2-
- (172)_{10}
- (172.878)_{10}
Solution-
1. (172)_{10}
(172)_{10} → ( ? )_{2}
Using division method, we have-
Thus,
(172)_{10} = (10101100)_{2} |
2. (172.878)_{10}
(172.878)_{10} → ( ? )_{2}
We will treat the real part and fractional part separately-
For real part-
- The real part is (172)_{10}
- We will convert the real part from base 10 to base 2 using division method.
- We have already done this in above problem.
Thus,
(172)_{10} = (10101100)_{2} |
For fractional part-
- The fractional part is (0.878)_{10}
- We will convert the fractional part from base 10 to base 2 using multiplication method.
Using multiplication method, we have-
Real part | Fractional Part | |
0.878 x 2 | 1 | 0.756 |
0.756 x 2 | 1 | 0.512 |
0.512 x 2 | 1 | 0.024 |
0.024 x 2 | 0 | 0.048 |
Since, the fractional part terminates to 0 after several iterations. So, let us find the value up to 4 decimal places.
Now, traverse the real part column from top to bottom to obtain the required number in base 2.
Thus,
(0.878)_{10} = (1110)_{2} |
Combining the results of real and fractional part, we have-
(172.878)_{10} = (10101100.1110)_{2} |
Also read: Converting Decimal to Octal and Converting Decimal to Hexa
To gain better understanding of how to convert a Decimal number (Base 10) to a Binary number (Base 2),
Get more notes and other study material of Number System.
Watch video lectures by visiting our YouTube channel LearnVidFun.