Example 1 (sum of weights):
In this example, we want to convert a number from the decimal system to the binary numeral system. For this example, the sum of weights method will be used. We want to convert the decimal number (103) to the binary numeral system. Below, we can find a figure that show the weights of the first 7 digits of the binary numeral system. This figure is always helpful to solve a problem using the sum of weights method.
You might wonder how many digits we will need to represent the number (103). The highest number that can be represented with x digits can be find with the following formula :
With 6 digits, the highest number you can represent is :
If we have seven digits, the highest number you can represent is :
We will need seven digits since with six digits the highest number we can represent is 63. With seven digits, we can represent a number up to the decimal number 127. The number (103) is a bit more difficult to figure out with this technique but we know that we need the two highest digits. The seventh digit weights 64 and the sixth digit weights 32. This gives us :
To get the number (103), we need to add 7. The first three digits on the right added together are worth seven :
We need a “1” for the digits that are worth (64), (32), (4), (2) and (1). The digits we don’t need will be “0s” This give us the following binary number for the decimal number (103) :
Example 2 (Repeated division by 2):
In this example, we want to convert a number from the decimal system to the binary numeral system. For this example, the repeated division by 2 will be used to convert the number. We want to convert the decimal number (243) to the binary numeral system. For the decimal number 243, we start by dividing by 2. The remainder from each division forms the binary number. We divide by 2 until we get 0. The remainder of the first division is the first digit of the binary number or the right most digit (often called the least significative bit LSB). The remainder of the last division is the left most digit (often called the most significative bit MSB).
The decimal number 243 in the binary numeral system is :
We have the binary number “11100101” that we want to convert to a decimal number. We need to add together the weight of each digits that is a “1” in the binary number. We have 8 digits so the most left digit is worth 2 exponent 7. It is 7 because we starts from 0. Below, we have a figure showing the value of the first 7 digits. Figure 4 is missing the 8th and last digits which would be 2 exponent 7.
We have completed the three examples. The next lessons will be exercises similar to the examples above. For converting a decimal number to the binary numeral system, you can use either the sum of weights or the repeated division by 2. The repeated division is generally the preferred method. A cheat sheet will also be provided to help you solve the exercises.