Skip to main content

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 11.2.1 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.2.1 we recap the material covered above and present examples.

Figure 11.2.1. 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{.}\)

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 Table 11.2.3 we give more examples of numbers in base \(2\text{,}\) their base \(2\) expansion, and the number in decimal representation.

Table 11.2.3. 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{.}\)
\(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\)

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.

Subsection 11.2.2 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.2.5 apply the pattern described above to count in base \(2\text{.}\)

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

Answer 1.

0

Answer 2.

\(0\)

Answer 3.

\(0\)

Answer 4.

\(0\)

Answer 5.

\(0\)

Answer 6.

\(0\)

Answer 7.

1

Answer 8.

\(0\)

Answer 9.

\(0\)

Answer 10.

\(0\)

Answer 11.

\(0\)

Answer 12.

\(1\)

Answer 13.

10

Answer 14.

\(0\)

Answer 15.

\(0\)

Answer 16.

\(0\)

Answer 17.

\(1\)

Answer 18.

\(0\)

Answer 19.

11

Answer 20.

\(0\)

Answer 21.

\(0\)

Answer 22.

\(0\)

Answer 23.

\(1\)

Answer 24.

\(1\)

Answer 25.

100

Answer 26.

\(0\)

Answer 27.

\(0\)

Answer 28.

\(1\)

Answer 29.

\(0\)

Answer 30.

\(0\)

Answer 31.

101

Answer 32.

\(0\)

Answer 33.

\(0\)

Answer 34.

\(1\)

Answer 35.

\(0\)

Answer 36.

\(1\)

Answer 37.

110

Answer 38.

\(0\)

Answer 39.

\(0\)

Answer 40.

\(1\)

Answer 41.

\(1\)

Answer 42.

\(0\)

Answer 43.

111

Answer 44.

\(0\)

Answer 45.

\(0\)

Answer 46.

\(1\)

Answer 47.

\(1\)

Answer 48.

\(1\)

Answer 49.

1000

Answer 50.

\(0\)

Answer 51.

\(1\)

Answer 52.

\(0\)

Answer 53.

\(0\)

Answer 54.

\(0\)

Answer 55.

1001

Answer 56.

\(0\)

Answer 57.

\(1\)

Answer 58.

\(0\)

Answer 59.

\(0\)

Answer 60.

\(1\)

Answer 61.

1010

Answer 62.

\(0\)

Answer 63.

\(1\)

Answer 64.

\(0\)

Answer 65.

\(1\)

Answer 66.

\(0\)

Answer 67.

1011

Answer 68.

\(0\)

Answer 69.

\(1\)

Answer 70.

\(0\)

Answer 71.

\(1\)

Answer 72.

\(1\)

Answer 73.

1100

Answer 74.

\(0\)

Answer 75.

\(1\)

Answer 76.

\(1\)

Answer 77.

\(0\)

Answer 78.

\(0\)

Answer 79.

1101

Answer 80.

\(0\)

Answer 81.

\(1\)

Answer 82.

\(1\)

Answer 83.

\(0\)

Answer 84.

\(1\)

Answer 85.

1110

Answer 86.

\(0\)

Answer 87.

\(1\)

Answer 88.

\(1\)

Answer 89.

\(1\)

Answer 90.

\(0\)

Answer 91.

1111

Answer 92.

\(0\)

Answer 93.

\(1\)

Answer 94.

\(1\)

Answer 95.

\(1\)

Answer 96.

\(1\)

Answer 97.

10000

Answer 98.

\(1\)

Answer 99.

\(0\)

Answer 100.

\(0\)

Answer 101.

\(0\)

Answer 102.

\(0\)

Answer 103.

10001

Answer 104.

\(1\)

Answer 105.

\(0\)

Answer 106.

\(0\)

Answer 107.

\(0\)

Answer 108.

\(1\)

Answer 109.

10010

Answer 110.

\(1\)

Answer 111.

\(0\)

Answer 112.

\(0\)

Answer 113.

\(1\)

Answer 114.

\(0\)

Answer 115.

10011

Answer 116.

\(1\)

Answer 117.

\(0\)

Answer 118.

\(0\)

Answer 119.

\(1\)

Answer 120.

\(1\)

Answer 121.

10100

Answer 122.

\(1\)

Answer 123.

\(0\)

Answer 124.

\(1\)

Answer 125.

\(0\)

Answer 126.

\(0\)

Answer 127.

10101

Answer 128.

\(1\)

Answer 129.

\(0\)

Answer 130.

\(1\)

Answer 131.

\(0\)

Answer 132.

\(1\)

Answer 133.

10110

Answer 134.

\(1\)

Answer 135.

\(0\)

Answer 136.

\(1\)

Answer 137.

\(1\)

Answer 138.

\(0\)

Answer 139.

10111

Answer 140.

\(1\)

Answer 141.

\(0\)

Answer 142.

\(1\)

Answer 143.

\(1\)

Answer 144.

\(1\)

Answer 145.

11000

Answer 146.

\(1\)

Answer 147.

\(1\)

Answer 148.

\(0\)

Answer 149.

\(0\)

Answer 150.

\(0\)

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.2.6. Su Doku by Randall Munroe (https://xkcd.com/74).