Skip to main content
Logo image

Section 11.2 Binary Representation

Before we move on to presenting numbers with arbitrary base \(b\) where \(b\) is a natural number greater than \(1\text{,}\) we consider one more special case. One of the most common bases other than base \(10\) is base \(2\text{.}\) While base \(10\) numbers are written with the ten symbols \(0\text{,}\) \(1\text{,}\) \(2\text{,}\) \(3\text{,}\) \(4\text{,}\) \(5\text{,}\) \(6\text{,}\) \(7\text{,}\) \(8\text{,}\) and \(9\) numbers in base \(2\) are written using the two symbols
\begin{equation*} 0 \text{ and } 1. \end{equation*}
Base \(2\) representation is particular of interest because digital devices (such as computers) work with the two states on and off, which are represented by \(0\) and \(1\text{.}\) To distinguish numbers in base \(2\) representation from numbers in base \(10\) representation we add a subscript \(2\) to the number in base \(2\) representation. For example, we write
\begin{equation*} 1001_2=9 \end{equation*}
where we interpret \(1001_2\) as a number in base \(2\) representation and \(9\) as a number in base \(10\) representation. Numbers in base \(2\) representation are also called binary numbers.

Subsection Base \(2\) Expansion

The values of the places of base \(10\) numbers are the powers of \(10\text{.}\) As before we write these from right to left because (by convention) the least significant digit of numbers in decimal representation is on the right. For an \(n\) digit decimal (that is, bas \(10\)) number we have the place values:
\(10^{n-1}\text{,}\) \(10^{n-2}\text{,}\) \(\dots\text{,}\) \(10^4=10\,000\text{,}\) \(10^3=1000\text{,}\) \(10^2=100\text{,}\) \(10^1=10\text{,}\) \(10^0=1\text{.}\)
Similarly the place values of base \(2\) numbers are the powers of two. For an \(n\) digit base \(2\) (or binary) number we have the place values:
\(2^{n-1}\text{,}\) \(2^{n-2}\text{,}\) \(\dots\text{,}\) \(2^4=16\text{,}\) \(2^3=8\text{,}\) \(2^2=4\text{,}\) \(2^1=2\text{,}\) \(2^0=1\text{.}\)
For a binary number
\begin{equation*} a=(r_{n-1}\dots r_2 r_1 r_0)_2 \end{equation*}
where for \(r_i\in\{0,1\}\) we have \(i\in\{0,\dots,n-1\}\) the binary (base \(2\)) expansion
\begin{equation*} a=r_{n-1}\cdot 2^{n-1}+r_{n-2}\cdot 2^{n-2}+\dots+r_1\cdot2+r_0\text{.} \end{equation*}
This immediately yields a method for converting base \(2\) numbers to base \(10\text{.}\)
In the video in Figure 11.5 we recap the material covered above and present examples.
Figure 11.5. Binary Numbers by Matt Farmer and Stephen Steward
For the remainder of the section we continue considering the conversion of base \(2\) to base \(10\) and also count in base \(2\text{.}\)

Example 11.6. Conversion from binary to decimal.

We convert the binary number \(100101_2\) to base \(10\text{.}\) We have
\begin{equation*} 100101_2 = 1\cdot 2^5 + 0\cdot 2^4+0\cdot 2^3+1\cdot 2^2+0\cdot 2^1+1\cdot 2^0=32+4+1=37\text{.} \end{equation*}
We have found that the decimal representation of the base \(2\) number \(100101_2\) is \(37\text{.}\)
In Figure 11.7 we give more examples of numbers in base \(2\text{,}\) their base \(2\) expansion, and the number in decimal representation.
\(n\) in base \(2\) digits of \(n\) base \(2\) expansion of \(n\) \(n\) in
base \(2\) \(2^3\) \(2^2\) \(2^1\) \(2^0\) base 10
\(0_2\) \(0\) \(0\cdot 1\) \(0\)
\(1_2\) \(1\) \(1\cdot 1\) \(1\)
\(10_2\) \(1\) \(0\) \(1\cdot 2+0\cdot 1\) \(2\)
\(11_2\) \(1\) \(1\) \(1\cdot 2+1\cdot 1\) \(3\)
\(100_2\) \(1\) \(0\) \(0\) \(1\cdot 2^2+0\cdot 2+0\cdot 1\) \(4\)
\(101_2\) \(1\) \(0\) \(1\) \(1\cdot 2^2+0\cdot 2+1\cdot 1\) \(5\)
\(110_2\) \(1\) \(1\) \(0\) \(1\cdot 2^2+1\cdot 2+0\cdot 1\) \(6\)
\(111_2\) \(1\) \(1\) \(1\) \(1\cdot 2^2+1\cdot 2+1\cdot 1\) \(7\)
\(1000_2\) \(1\) \(0\) \(0\) \(0\) \(1\cdot 2^3+0\cdot 2^2+0\cdot 2+0\cdot 0\) \(8\)
\(1001_2\) \(1\) \(0\) \(0\) \(1\) \(1\cdot 2^3+0\cdot 2^2+0\cdot 2+1\cdot 1\) \(9\)
\(1010_2\) \(1\) \(0\) \(1\) \(0\) \(1\cdot 2^3+0\cdot 2^2+1\cdot 2+0\cdot 1\) \(10\)
Figure 11.7. Binary (base \(2\)) numbers, their base \(2\) digits, their base \(2\) expansion, and in base \(10\text{.}\) The two symbols used in binary numbers are \(0\) and \(1\text{.}\) Recall that \(2^0=1\) and that \(2^1=2\text{.}\)
So to convert a number in base \(2\) representation
  • write down the base \(2\) expansion, which consists of the digits of the base \(2\) representation converted to decimal and the place values, which are the powers of \(2\)
  • evaluate this expression to obtain the base \(10\) representation.
Try yourself.

Checkpoint 11.8. Convert from binary to decimal.

Give the expanded base \(2\) form of \(111011_{2}\text{.}\)
\(\cdot 2^6 +\) \(\cdot 2^5 +\) \(\cdot 2^4 +\) \(\cdot 2^3 +\) \(\cdot 2^2 +\) \(\cdot 2+\) \(\cdot 1\)
Give \(111011_{2}\) in decimal representation.

Subsection Counting in Base \(2\)

For a better understanding of binary (or base \(2\)) numbers, we consider counting in that representation.
When we start counting using only the two symbols 0 and 1. As in the case of decimal numbers we start with zero.
\(0_2\text{,}\)
Still with one digit we can also write the number one:
\(1_2\)
So with one digit we were able to count zero and one. As in the case of decimal numbers we add one more digit and obtain:
\(10_2\text{,}\) \(11_2\)
With two digits we have counted to three. As we cannot go further with those two digits, we continue with:
\(100_2\text{,}\) \(101_2\text{,}\) \(110_2\text{,}\) \(111_2\)
With three digits we have counted to seven. Adding one more digit we continue with:
\(1000_2\text{,}\) \(1001_2\text{,}\) \(1010_2\text{,}\) \(1011_2\text{,}\) \(1100_2\text{,}\) \(1101_2\text{,}\) \(1110_2\text{,}\) \(1111_2\)
With 4 digits we have counted from zero to fifteen. By now the pattern is clear and we can keep counting like this indefinitely, adding one more digit when we have exhausted all combinations with the current number of digits.
Considering the numbers above we see that \(10_2\) is two, \(100_2\) is four, and \(1000_2\) is eight.
In Checkpoint 11.9 apply the pattern described above to count in base \(2\text{.}\)

Checkpoint 11.9. Count in base \(2\).

Count in base 2
In the first column enter the numbers in base \(2\text{.}\) Recall that the characters used to represent base \(2\) numbers are:
In the other columns enter the values for the digits of the base \(2\) expansions.
For your convenience the last number in each row is the corresponding decimal number.
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 0\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 1\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 2\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 3\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 4\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 5\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 6\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 7\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 8\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 9\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 10\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 11\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 12\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 13\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 14\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 15\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 16\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 17\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 18\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 19\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 20\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 21\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 22\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 23\)
\({}_{2} =\)
\(\cdot 2^{4} +\)
\(\cdot 2^{3} +\)
\(\cdot 2^{2} +\)
\(\cdot 2^{1} +\)
\(\cdot 2^{0} = 24\)
described in detail following the image
A square divided into 2x2 squares, the top-right one has an 1 in it, the bottom-right one has a 0, the two left ones are empty.
Label: Binary Su Doku
Title text: This one is from the Red Belt collection, of ’medium’ difficulty.
This one is from the Red Belt collection of ’medium’ difficulty
Figure 11.10. Su Doku by Randall Munroe (https://xkcd.com/74).