Converting Binary Numbers to Decimal Numbers

Converting Binary Numbers to Decimal Numbers

We have already seen a little bit in terms of converting binary numbers into decimal number from The Decimal and Binary Number Systems. We will now formalize this process.

Let $(x)_2 = a_na_{n-1}...a_1a_0a_{-1}...a_{-m+1}a_{-m}$ be a binary number. Then the digits of $x$ are either $0$ or $1$, that is, $a_j \in \{ 0, 1 \}$ for $-m ≤ j ≤ n$. We can easily convert $(x)_{2}$ into a decimal number with the following formula:

(1)
\begin{align} \quad \quad (x)_2 = \left [ \left ( a_n \cdot 2^n \right ) + \left (a_{n-1} \cdot 2^{n-1} \right) + .... + \left (a_1 \cdot 2^1 \right ) + \left (a_0 \cdot 2^0 \right ) + \left (a_{-1} \cdot 2^{-1} \right ) + ... + \left ( a_{-m+1} \cdot 2^{-m+1} \right ) + \left (a_{-m} \cdot 2^{-m} \right ) \right ]_{10} \end{align}

For example, consider the binary number $(110101.1001)_2$. Applying the formula above and we get that the decimal representation of the binary number $(110101.1001)_2$ is:

(2)
\begin{align} \quad \quad (110101.1001)_2 = \left ( 1 \cdot 2^5 \right ) + \left (1 \cdot 2^4 \right ) + \left (0 \cdot 2^3 \right ) + \left (1 \cdot 2^2 \right ) + \left ( 0 \cdot 2^1 \right ) + \left (1 \cdot 2^0 \right) + \left (1 \cdot 2 ^{-1} \right) + \left ( 0 \cdot 2^{-2} \right) + \left (0 \cdot 2^{-3} \right) + \left (1 \cdot 2^{-4} \right) \\ \quad \quad (110101.1001)_2 = \left (32 + 16 + 0 + 4 + 0 + 1 + \frac{1}{2} + 0 + 0 + \frac{1}{16} \right)_{10} \\ \quad \quad (110101.1001)_2 = (53.5625)_{10} \end{align}

Example 1

Convert the binary number $(1101101)_{2}$ into a decimal number.

We have that:

(3)
\begin{align} \quad (1101101)_{2} = \left ( 1 \cdot 2^6 \right ) + \left ( 1 \cdot 2^5 \right ) + \left ( 0 \cdot 2^4 \right ) + \left ( 1 \cdot 2^3 \right ) + \left ( 1 \cdot 2^2 \right ) + \left ( 0 \cdot 2^1 \right ) + \left ( 1 \cdot 2^0 \right ) \\ \quad (1101101)_{2} = \left ( 64 + 32 + 0 + 8 + 4 + 0 + 1 \right)_{10} = (109)_{2} \end{align}

Example 2

Convert the binary numbers $(11)_{2}$, $(111)_{2}$, $(1111)_{2}$, …, $(\underbrace{111...1}_{\mathrm{n-times}})_{2}$ into decimal numbers.

Note that $(11)_{2} = 2 + 1 = (3)_{2} = 2^{2} - 1$, $(111)_{2} = 4 + 2 + 1 = (7)_{2} = 2^3 - 1$, $(1111)_{2} = 8 + 4 + 2 + 1 = (15)_{2} = 2^4 - 1$. In general, we see that:

(4)
\begin{align} (\underbrace{111...1}_{\mathrm{n-times}})_{2} = 2^n - 1 \end{align}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License