# Lesson : Binary Number Conversion Examples

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 :

$2^{number\ of\ digits} - 1$

With 6 digits, the highest number you can represent is :

$2^{6} - 1 = 64 - 1 = 63$

If we have seven digits, the highest number you can represent is :

$2^{7} - 1 = 128 - 1 = 127$

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 :

$64 + 32 = 96$

To get the number (103), we need to add 7. The first three digits on the right added together are worth seven :

$(64 + 32) + (4 + 2 + 1) = 96 + 7 = 103$

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) :

$1100111_{2} = 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 :

$11110011_{2} = 243$

Example 3:

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.

$\textbf{1} \cdot 2^{7} + \textbf{1} \cdot 2^{6} + \textbf{1} \cdot 2^{5} + \textbf{0} \cdot 2^{4} + \textbf{0} \cdot 2^{3} + \textbf{1} \cdot 2^{2} + \textbf{0} \cdot 2^{1} + \textbf{1} \cdot 2^{0} = 229$

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.