Exercise - Base 10 conversion to base 2¶
Here's an exercise to practice converting a base 10 (decimal) number to base 2 (binary):
Exercise¶
Convert the decimal number 156 to its binary equivalent.
Solution¶
To convert the decimal number 156 to binary, follow these steps:
- Divide the Number by 2:
- Write down the decimal number.
-
Divide it by 2, and record the quotient and the remainder.
-
Repeat the Process:
-
Continue dividing the quotient by 2, recording each remainder, until the quotient is 0.
-
Read the Remainders Backwards:
- The binary equivalent is obtained by reading the remainders from bottom to top.
Let's go through the process step by step:
-
Divide 156 by 2: [ 156 \div 2 = 78 \text{ with a remainder of } 0 ]
-
Divide 78 by 2: [ 78 \div 2 = 39 \text{ with a remainder of } 0 ]
-
Divide 39 by 2: [ 39 \div 2 = 19 \text{ with a remainder of } 1 ]
-
Divide 19 by 2: [ 19 \div 2 = 9 \text{ with a remainder of } 1 ]
-
Divide 9 by 2: [ 9 \div 2 = 4 \text{ with a remainder of } 1 ]
-
Divide 4 by 2: [ 4 \div 2 = 2 \text{ with a remainder of } 0 ]
-
Divide 2 by 2: [ 2 \div 2 = 1 \text{ with a remainder of } 0 ]
-
Divide 1 by 2: [ 1 \div 2 = 0 \text{ with a remainder of } 1 ]
Now, list the remainders from bottom to top: [ 1 \text{ (from the last division)} \ 0 \ 0 \ 1 \ 1 \ 1 \ 0 \ 0 \text{ (from the first division)} ]
So, the binary representation of 156 is \( 10011100_2 \).
Answer¶
The binary equivalent of the decimal number 156 is \( 10011100_2 \).
Algebraic Method¶
To convert a decimal number to binary using an algebraic method, you can express the decimal number as a sum of powers of 2. Here's how we can use this method to convert the decimal number 156 to binary:
Algebraic Method:¶
- Step 1: Find the largest power of 2 less than or equal to 156.
- The powers of 2 are: \( 2^0 = 1 \), \( 2^1 = 2 \), \( 2^2 = 4 \), \( 2^3 = 8 \), \( 2^4 = 16 \), \( 2^5 = 32 \), \( 2^6 = 64 \), \( 2^7 = 128 \), \( 2^8 = 256 \) (which is greater than 156).
-
The largest power of 2 less than or equal to 156 is \( 2^7 = 128 \).
-
Step 2: Subtract \( 128 \) (i.e., \( 2^7 \)) from 156 and repeat for the remainder. [ 156 - 128 = 28 ]
-
Step 3: Find the largest power of 2 less than or equal to 28.
-
The largest power of 2 less than or equal to 28 is \( 2^4 = 16 \).
-
Step 4: Subtract \( 16 \) (i.e., \( 2^4 \)) from 28 and repeat for the remainder. [ 28 - 16 = 12 ]
-
Step 5: Find the largest power of 2 less than or equal to 12.
-
The largest power of 2 less than or equal to 12 is \( 2^3 = 8 \).
-
Step 6: Subtract \( 8 \) (i.e., \( 2^3 \)) from 12 and repeat for the remainder. [ 12 - 8 = 4 ]
-
Step 7: Find the largest power of 2 less than or equal to 4.
-
The largest power of 2 less than or equal to 4 is \( 2^2 = 4 \).
-
Step 8: Subtract \( 4 \) (i.e., \( 2^2 \)) from 4 and repeat for the remainder. [ 4 - 4 = 0 ] Now the remainder is 0, so we are done.
Final Expression:¶
Now, we have expressed 156 as a sum of powers of 2: [ 156 = 2^7 + 2^4 + 2^3 + 2^2 ]
Step 9: Write the binary representation.¶
Each power of 2 corresponds to a digit in the binary representation. A 1 is placed in the positions of the powers of 2 we used, and a 0 is placed in the positions we skipped.
- \( 2^7 = 128 \)
- \( 2^6 = 0 \)
- \( 2^5 = 0 \)
- \( 2^4 = 16 \)
- \( 2^3 = 8 \)
- \( 2^2 = 4 \)
- \( 2^1 = 0 \)
- \( 2^0 = 0 \)
Thus, the binary representation of 156 is: [ 10011100_2 ]
This matches the result we obtained earlier using the division method.