Introduction: Converting Decimal to Binary Numbers
In the Computer Science world, computers use binary numbers to display information to the screen. Understanding how to count these numbers in essential for any computer scientist. It is also a good trait to have for anyone who is interested in computers, or just wants to understand how these numbers are counted.
This instructable will teach you how to count numbers that appear in decimal and binary. Instructions for counting in decimal have been included in this instructable because the best way to understand binary is to understand how decimal numbers work.
The table linked with this step is a conversion table for Decimal Numbers to Binary. You may not know what it means now, but after completing the lesson you will be able to identify and relate to the table above. This table simply shows the equivalent of binary values to their corresponding decimal value.
1) Pencil and paper
2) Calculator (Recommended)
Time spent completing this task normally ranges around 15-20 minutes
Step 1: Counting in Decimal
To understand counting in binary, it is best to understand how decimal works.
For each number, every digit refers to a position.
In the number 576. The digit 6 is at position 0, the digit 7 is at position 1, and the digit 5 is at position 3. These positions start at zero, incrementing by one for each digit that is in the number.
Decimal numbers are also called base 10, because the value for each digit is based on the number 10. Base 10 also represents the amount of digits that can represent a digit. In base 10, there are 10 digits that can represent a number. These are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Look back on the number 576 to see exactly how this works starting with the digit "6". The visual aid has been added in this step to give a thorough walkthrough of each step in the following example. The visual aid and following example use the same process.
Since base 10 is used when counting in decimal, and 6 happens to be at position 0. We take the digit multiplied by 10 to the power of 0. Since anything to the power of 0 is 1, our answer looks like this: 6 x 1 = 6.
For the digit 7, we have 7 multiplied by 10 to the power of 1. This looks like this: 7 x 10 = 70.
Lastly, for the digit 5, we have 5 multiple by 10 to the power of 2. This looks like 5 x 100 = 500.
After you have found out the value for each digit at their respective positions, add up all of our results for the final answer. This looks like this: 6 + 70 + 500 = 576, which is the original number.
Now obviously you did not have to go through all the extra steps for this number. This is always the case with base 10 because this is the universal way to count numbers. When there are numbers that are in binary, it is not always apparent what these numbers equate to.
Step 2: Counting in Binary (Part 1/2)
Binary numbers are different from decimal numbers because they use a base 2 numbering system. This means that only 2 numbers are used to represent any value in binary. Numbers in binary are only represented by a 1 or 0. In decimal, a base 10 system is used so there are 10 numbers used to represent any value; you start at 0 then 1, 2, 3, 4, 5, 6, 7, 8, 9 but after 9 we run out of digits to represent our number so we had a 1 to the left. (10, 11, 12, 13, 14...).
In binary, you start at 0, then 1, but then we run out of numbers. This means that to represent any number bigger then this, we will have to add more digits on the left. For example:
Since binary numbers use base 2, to find the value of each digit, you take that digit multiplied by 2 to the power at that digit's current position. To further understand this, let's look at an example of binary number.
The visual aid has been added in this step to give a thorough walkthrough of each step in the following example. The visual aid and following example use the same process.
1011 (base 2)
The above number is a binary number. To get the value let's start at position 0 then move to the left until you are out of numbers.
1011: The digit at position 0 is shown in bold. To find the value, we take the digit (1) multiple by the base of the numbering system (Base 2), to the power of the digit in that position. This looks like: 1 * 2^0 = 1.
1011: Here, the digit 1 is at position 1. The value of this digit looks like: 1 * 2^1 = 2.
1011: Here, the digit 0 is at position 2. The value of this digit looks like: 0 * 2^2 = 0.
1011: Here, the digit 1 is at position 3. The value of this digit looks like: 1 * 2^3 = 8.
To find the final value for this number, you use the same method that you used in step 1 for finding the value of decimal numbers. Simply add the resulting value from each expression to equal our number.
This looks like 1 + 2 + 0 + 8, which equals 11. Thus, the binary number 1011 represents the decimal number 11.
Step 3: Counting in Binary With Decimal Points (Part 2/2)
Now that you understand how to count binary numbers that are whole (integers), you also have to understand how to count binary numbers that have decimal points (non-integers). The following are examples of integers and non-integer numbers in base 10. A "|" is used to separate each number in the list.
(Base 10)->19 | 102 | 72 | 9212 | 8
(Base 2)-> 0010 | 0111 | 1111 | 1000
(Base 10)->14.7 | 18.2 | 19.5 | 25.4
(Base 2)->1011.101 | 0011.11 | 101.011
Notice how the non-integer numbers use decimal points. For finding out the value of each digit that is on the right side of a decimal point, you use negative powers to represent the position of each number. To further understand this, take a look at another example.
Start by counting the part of the number that is to the left of the decimal point, and then move to the right side of the decimal point. The the digit in bold represents each digit we are working on for that step. Base 2 in all of the steps so 2 serve as the multiplier that is raised to the power of the current digit in that position.
1011.101-> Here, the digit 1 is at position zero, so this digit equates to 1 * 2^0 = 1
1011.101-> Here, the digit 1 is at position one, so this digit equates to 1 * 2^1 = 2
1011.101-> Here, the digit 0 is at position two, so this digit equates to 0 * 2^2 = 0
1011.101-> Here, the digit 1 is at position three, so this digit equates to 1 * 2^3 = 8
Adding these numbers up yield the answer 11.
Now move to the right side of the decimal. When counting the left side of the decimal point, the position starts at 0. When counting the right side, the position will start at 1, and increment by 1 at each position. The other thing that is different is the multiplier at each position. The multiplier is now a fraction with the number 1 constantly being the numerator (Value on the top of the fraction), and the multiplier is now the denominator (Value on the bottom of the fraction). So the multiplier for the first digit directly to the right of the multiplier would be (1/2^1) which equals (1/2), the next would be (1/4), followed by (1/8), followed by (1/16)... and so on in powers of 2.
Moving on to the right side of the decimal point now, you can figure out what the real value of the binary number is now starting with the first number to the right of the decimal point. A calculator is also recommended for this part because it involves converting fractions to decimals.
1011.101-> Here, the digit 1 is at the first position to the right of the decimal point so we have: 1 * (1/2) = 0.5
1011.101-> Here, the digit 0 is at the second position to the right of the decimal point so we have: 0 * (1/4) = 0.0
1011.101-> Here, the digit 1 is at the third position to the right of the decimal point so we have: 1 * (1/8) = 0.125
Now add up the value of each resulting digit to find the real value of decimal. 0.5 + 0.0 + 0.125 = 0.625.
Using the answer of 11 for the left side of the decimal and our answer of 0.625 for the right side of the decimal, we find our final answer is 11.625
Step 4: Another Example and Notes
Since the best way to learn counting in Binary is to practice, take a look at one more example and some general notes. The same format in the previous examples is used here as well.
1100011.1101-> Here, the digit 1 is at position zero. So-> 1 * 2^0 = 1
1100011.1101-> Here, the digit 1 is at position one. So-> 1 * 2^1 = 2
1100011.1101-> Here, the digit 0 is at position two. So-> 0 * 2^2 = 0
1100011.1101-> Here, the digit 0 is at position three. So-> 0 * 2^3 = 0
1100011.1101-> Here, the digit 0 is at position four. So-> 0 * 2^4 = 0
1100011.1101-> Here, the digit 1 is at position five. So-> 1 * 2^5 = 32
1100011.1101-> Here, the digit 1 is at position six. So-> 1 * 2^6 = 64
The final value of our integer digits is 64 + 32 + 2 + 1 = 99. Let's now examine the non-integer numbers.
1100011.1101-> Here, the digit 1 is at position one. So-> 1 * (1/2) = 0.5
1100011.1101-> Here, the digit 1 is at position two. So-> 1 * (1/4) = 0.25
1100011.1101-> Here, the digit 0 is at position three. So-> 0 * (1/8) = 0.0
1100011.1101-> Here, the digit 1 is at position four. So-> 1 * (1/16) = 0.0625
The final value of the non-integer digits is 0.5 + 0.25 + 0.0625 = . So our final answer is 99.8125.
Note 1: 00011 holds the same value 0011, 011, and 11. Just like using decimal numbers, leading zeros do not affect the value of the number. Just like in decimal 00657 is the same as 0657, and 657.
Note 2: If a digit is equal to 0, then regardless at which position it is located in the actual number, it will always equate to 0. This is true because 0 times anything is always 0.
Step 5: Try It Out!
Now that you have seen a few examples, it's time to test your knowledge on these ten practice problems. The problems have been provided in Binary Notation (Base 2), and you're job is to convert them to Decimal Notation (Base 10). The answers without the solutions have been provided for the odd numbers at the bottom. Since there are no solutions for these problems on this step, a conversion table with two examples has been added.
We have a be nice policy.
Please be positive and constructive.