Skip to main content

Section 9.2 Binary and Hexadecimal Representations

In ActivityΒ 9.1.B, we represent a positive integer using the sum of factorials. A more widely-used representation uses the sum of powers instead. The decimal numbers that we use every day are represented using powers of 10. Historically,
 1 
Using data from Wikipedia List of Numeral Systems (retrieved November 30, 2025).
people have used a variety of bases. We see remnants of base 60 that the Babylonians and others used (where Iraq is now) in 60 seconds per minute, 60 minutes per hour, or 360\(^\circ\) in a circle. Mayan and Aztec (in Mexico and Central America) used base 20, and there are references to groups of 20 in many modern indigenous languages ranging from Basque (in Spain and France) to Inuit (in Alaska). In Nigeria and Nepal, many languages incorporate base 12, which we see today in the 12-hour clock, 12 inches to a foot, and 12 eggs in a carton. Other bases are possible, but the most commonly-used modern representations are binary, which uses powers of two, and hexadecimal, which uses powers of 16.

Subsection 9.2.A Base \(b\) Representation

We start with the definition of representing integers using powers of any integer \(b>1\text{.}\)

Definition 9.2.1 Base \(b\) representation.

Β 
  1. For a fixed integer \(b > 1\) and nonnegative integer \(n\text{,}\) the base b representation of \(n\) is
    \begin{equation*} n=\left(a_ka_{k-1}\cdots a_3a_2a_1a_0\right)_b \end{equation*}
    if
    \begin{equation*} n=\sum_{i=0}^ka_ib^i = a_kb^k + \dots + a_3b^ 3+a_2b^2+a_1b^1+a_0b^0 \end{equation*}
    for some integer \(k\) where each integer \(a_i = 0,1, \ldots, b-1\text{.}\) For example, in base three we have \(3-1=2\) and so the coefficients can be \(a_i=0,1,2\text{.}\) The integer 15 is represented in base three as
    \begin{equation*} 15=(120)_3 \end{equation*}
    because
    \begin{align*} (120)_3 \amp = \underline{1} \cdot 3^2 + \underline{2}\cdot 3^1 + \underline{0} \cdot 3^0\\ \amp = \underline{1} \cdot 9 + \underline{2}\cdot 3 + \underline{0} \cdot 1\\ \amp = 9 + 3 + 3\\ \amp = 15\text{.} \end{align*}
    Notice how we need to include zero.
  2. Base 10 is the usual decimal representation where each digit \(a_i = 0, 1, 2, 3, 4, 5, 6, 7, 8\text{,}\) or \(9\text{.}\) We omit the subscript and write \(n = a_ka_{k-1}\cdots a_3a_2a_1a_0\text{.}\) For example, 528 in decimal representation stands for
    \begin{align*} 528 \amp = 500+20+8\\ \amp = 100+100+100+100+100+10+10+1+1+1+1+1+1+1+1\\ \amp = \underline{5} \cdot 100 + \underline{2} \cdot 10 + \underline{8} \cdot 1\\ \amp = \underline{5} \cdot 10^2 + \underline{2} \cdot 10^1 + \underline{8} \cdot 10^0\text{.} \end{align*}
  3. The most common base systems after base 10 are base two (binary) and base 16 (hexadecimal). Other base systems such as base three (ternary) and base five (quinary) are used mainly to understand base representations. Base eight (octal) was used historically as a shorthand for binary.
  4. Often \(k\) is chosen so that \(a_k > 0\text{,}\) but there are occasions where we write zero in front of a number. For example, we might enter 03 for the month March instead of 3. If we require \(a_k > 0\text{,}\) then the base \(b\) representation of a positive integer is unique.
We consider an example.

Example 9.2.2 Ternary Conversion.

Β 
  1. Convert \((21021)_3\) to decimal.
    Solution.
    To determine the highest power of three involved, we count in from the right: \(3^0, 3^1, 3^2, 3^3\text{,}\) and finally \(3^4\text{.}\) We have
    \begin{align*} (21021)_3 \amp =\underline{2}\cdot 3^4 +\underline{1}\cdot 3^3 +\underline{0}\cdot 3^2 +\underline{2}\cdot 3^1 +\underline{1}\cdot 3^0\\ \amp =\underline{2}\cdot 81 +\underline{1}\cdot 27 +\underline{0}\cdot 9 +\underline{2}\cdot 3 +\underline{1}\cdot 1\\ \amp = 196\text{.} \end{align*}
  2. Convert 50 to base three.
    Solution.
    Since \(50 \lt 81 = 3^4\text{,}\) we only need to use 27, nine, three, and one. Note that \(50-27 = 23\text{,}\) \(23-9-9 = 5\text{,}\) \(5-3=2\text{,}\) and \(2=1+1\) and so we get
    \begin{align*} 50 \amp = 27 + 9 + 9 + 3 + 1 + 1\\ \amp =\underline{1}\cdot 27 +\underline{2}\cdot 9 + \underline{1}\cdot 3 + \underline{2}\cdot 1\\ \amp = \underline{1}\cdot 3^3 + \underline{2}\cdot 3^2 + \underline{1} \cdot 3^1 + \underline{2} \cdot 3^0\\ \amp = (1212)_3 \end{align*}
Here are examples using base five and base eight.

Example 9.2.3 Quinary and octal conversions.

Β 
  1. Convert \((413)_5\) and \((1723)_8\) to decimal.
    Solution.
    First,
    \begin{align*} (413)_5 \amp =\underline{4}\cdot 5^2 +\underline{1}\cdot 5^1 +\underline{3}\cdot 5^0\\ \amp =\underline{4}\cdot 25 +\underline{1}\cdot 5 +\underline{3}\cdot 1\\ \amp = 108\text{.} \end{align*}
    Next,
    \begin{align*} (1723)_8 \amp =\underline{1}\cdot 8^3 +\underline{7}\cdot 8^2 +\underline{2}\cdot 8^1 +\underline{3}\cdot 8^0\\ \amp =\underline{1}\cdot 512 +\underline{7}\cdot 64 +\underline{2}\cdot 8 +\underline{3}\cdot 1\\ \amp = 979\text{.} \end{align*}
  2. Convert 50 to base five and to base eight.
    Solution.
    First, since \(50 \lt 125 = 5^3\text{,}\) we only need to use 25, five, and one. Notice that \(50-25-25=0\) and so we have
    \begin{align*} 50 \amp = 25+25\\ \amp =\underline{2}\cdot 25 +\underline{0}\cdot 5 + \underline{0}\cdot 1\\ \amp = \underline{2}\cdot 5^2 + \underline{0} \cdot 5^1 + \underline{0} \cdot 5^0\\ \amp = (200)_5 \end{align*}
    Next, since \(50 \lt 64 = 8^2\text{,}\) we only need to use eight and one. Notice that \(50-6(8) = 50-48 = 2\) and so we have
    \begin{align*} 50 \amp = 8+8+8+8+8+8+1+1\\ \amp =\underline{6}\cdot 8 + \underline{2}\cdot 1\\ \amp = \underline{6} \cdot 8^1 + \underline{2} \cdot 8^0\\ \amp = (62)_8 \end{align*}
When we compare the different representations of the integer 50 from ExampleΒ 9.2.2 and ExampleΒ 9.2.3 listed in TableΒ 9.2.4, we see that the larger the base, the shorter the representation of the integer 50 in that base.
Table 9.2.4. Base \(b\) representations of the integer 50
base \(b\) 3 5 8 10
representation of 50 base \(b\) \((1212)_3\) \((200)_5\) \((62)_8\) 50
Try converting between bases.
Let’s look at ActivityΒ 9.2.A (g).

Example 9.2.6 Counting digits in base three.

How many digits are needed to represent 100,000 in base three?
Solution.
Since \(3^{10}=59049\lt 100000\) and \(3^{11} = 177147>100000\text{,}\) we need through \(3^{10}\) but not \(3^{11}\text{.}\) Thus, the base three representation of 100,000 needs 11 digits for the coefficients of
\begin{equation*} 3^0, 3^1, 3^2, \ldots, 3^{10} \end{equation*}
There is a variant of ternary representation in which we use 0, 1, and \(-1\) instead of 0, 1, and 2.

Definition 9.2.7 Balanced ternary representation.

For an integer \(n\text{,}\) the balanced ternary representation of \(n\) is
\begin{equation*} n = \left(a_ka_{k-1}\cdots a_3a_2a_1a_0\right)_{bal3} \end{equation*}
if
\begin{equation*} n=a_k3^k + \dots + a_33^ 3+a_23^2+a_13^1+a_03^0 \end{equation*}
for some integer \(k\) where each integer \(a_i = -1,0,1\text{.}\) We write \(+\) in place of 1 and \(-\) in place of -1. For example,
\begin{align*} (+0-+-)_{bal3} \amp =\underline{+1}\cdot 3^4 +\underline{0}\cdot 3^3 +\underline{-1}\cdot 3^2 +\underline{+1}\cdot 3^1 +\underline{-1}\cdot 3^0\\ \amp = 81+0-9+3-1\\ \amp = 74 \end{align*}
Let’s look at an example of representing an integer using balanced ternary.

Example 9.2.8 Balanced ternary representation.

Convert 23 to balanced ternary representation.
Solution.
The largest integer we can obtain using 1, 3, 9 is
\begin{equation*} (+++)_{bal3} = \underline{1}\cdot 9 + \underline{1}\cdot 3 + \underline{1} \cdot 1 =9+3+1=13\text{.} \end{equation*}
Therefore, to obtain 23, we need to use \(3^3 = 27\) as follows:
\begin{align*} 23 \amp = 27 - 3 - 1\\ \amp = \underline{1}\cdot 27 + \underline{0} \cdot 9 + \underline{-1} \cdot 3 + \underline{-1} \cdot 1\\ \amp = \underline{1}\cdot 3^3 + \underline{0} \cdot 3^2 + \underline{-1} \cdot 3^1 + \underline{-1} \cdot 3^0\\ \amp = (+0--)_{bal3} \end{align*}

Subsection 9.2.B Binary Representation

The most common base used in computer science is two, because integers in base two are represented by bit strings.

Definition 9.2.9 Binary representation.

For a nonnegative integer \(n\text{,}\) the binary representation of \(n\) is
\begin{equation*} n=\left(a_ka_{k-1}\cdots a_3a_2a_1a_0\right)_2 \end{equation*}
if
\begin{equation*} n=\sum_{i=0}^ka_i2^i = a_k2^k + \dots + a_32^ 3+a_22^2+a_12^1+a_02^0 \end{equation*}
for some integer \(k\) where each integer \(a_i =0, 1\text{.}\) For example, the integer \(6=(\bs{110})_2\text{.}\) We check that
\begin{align*} (\bs{110})_2 \amp = \underline{1} \cdot 2^2 +\underline{1} \cdot 2^1 +\underline{0} \cdot 2^0\\ \amp = \underline{1} \cdot 4 +\underline{1} \cdot 2 +\underline{0} \cdot 1\\ \amp = 4 + 2\\ \amp = 6\text{.} \end{align*}
The programming language Python uses the prefix \(\str{0b}\) to indicate a binary integer. For example, we write \(6=\bs{0b110}\text{.}\)

Remark 9.2.10 The connection between bit strings and binary integers.

In binary representation, the coefficients can be thought of as bits \(\bs{0}\) or \(\bs{1}\text{.}\) Therefore, any bit string represents a binary integer. Note that different bit strings can represent the same integer. For example, \(\bs{110}\text{,}\) \(\bs{0110}\text{,}\) \(\bs{0000110}\) each represent six because
\begin{equation*} 6=(\bs{110})_2=(\bs{0110})_2=(\bs{0000110})_2\text{,} \end{equation*}
but they are different bit strings because \(\bs{110}\) has length three, \(\bs{0110}\) has length four, and \(\bs{0000110}\) has length seven.
For binary, it is useful to know the powers of two as listed in TableΒ 9.2.11. (We have also included the powers of 16 that we need later for hexadecimal representation.)
Table 9.2.11. Small powers of two and 16
\(16^0=\) \(2^0=\) \(1\) \(16^1=\) \(2^4=\) \(16\) \(16^2=\) \(2^8=\) \(256\)
\(2^1=\) \(2\) \(2^5=\) \(32\) \(2^9=\) \(512\)
\(2^2=\) \(4\) \(2^6=\) \(64\) \(2^{10}=\) \(1024\)
\(2^3=\) \(8\) \(2^7=\) \(128\) \(2^{11}=\) \(2048\)
Let’s look at a few examples.

Example 9.2.12 Conversion between decimal and binary.

Β 
  1. Convert \((\bs{10110})_2\) to decimal.
    Solution.
    To determine the highest power of 2 involved, we count in from the right: \(2^0\text{,}\) \(2^1\text{,}\) \(2^2\text{,}\) \(2^3\text{,}\) and finally \(2^4\text{.}\) We have
    \begin{align*} (\bs{10110})_2 \amp = \underline{1} \cdot 2^4 + \underline{0} \cdot 2^3 + \underline{1} \cdot 2^2 + \underline{1} \cdot 2^1 + \underline{0} \cdot 2^0\\ \amp = \underline{1} \cdot 16 + \underline{0} \cdot 8 + \underline{1} \cdot 4 + \underline{1} \cdot 2 + \underline{0} \cdot 1\\ \amp =16 + 4 + 2\\ \amp = 22 \end{align*}
  2. Convert 46 to binary.
    Solution.
    First, since \(46\lt 64\text{,}\) we only need to use 32, 16, 8, 4, 2, and 1. Notice \(46-32 = 14\text{,}\) \(14-8 = 6\text{,}\) and \(6-4=2\) and so we have
    \begin{align*} 45 \amp = 32+8+4+2\\ \amp =\underline{1}\cdot 32 + \underline{0}\cdot 16 + \underline{1}\cdot 8 + \underline{1}\cdot 4 +\underline{1}\cdot 2 + \underline{0}\cdot 1\\ \amp =\underline{1}\cdot 2^5 + \underline{0}\cdot 2^4 + \underline{1}\cdot 2^3 + \underline{1}\cdot 2^2 +\underline{1}\cdot 2^1 + \underline{0}\cdot 2^0\\ \amp = (\bs{101110})_2 \end{align*}
It is your turn to practice.

Activity 9.2.B Conversion between decimal and binary.

Use the definition of binary to convert the representation of integers by hand. That means do not use other algorithms you might have learned or computational technology, except to check.
  1. Convert \((\bs{11100})_2\) to decimal.
  2. Convert each of 10, 11, 12, 13, 14, and 15 to binary.
  3. Convert 165 to binary.

Subsection 9.2.C Hexadecimal Representation

Another common base used in computer science is 16.

Definition 9.2.14 Hexadecimal representation.

Β 
  1. In hexadecimal (base 16) representation, the coefficients are 0, 1, 2, …, 15. Since the coefficients 10, 11, 12, 13, 14, and 15 are 2-digit numbers we use the letters \(\str{A}\text{,}\) \(\str{B}\text{,}\) \(\str{C}\text{,}\) \(\str{D}\text{,}\) \(\str{E}\text{,}\) and \(\str{F}\) in their place, as shown in TableΒ 9.2.15.
    Table 9.2.15. Hexadecimal representation of 10, 11, 12, 13, 14, and 15
    integer 10 11 12 13 14 15
    hex letter \(\str{A}\) \(\str{B}\) \(\str{C}\) \(\str{D}\) \(\str{E}\) \(\str{F}\)
    Thus, hex digits are
    \begin{equation*} 0,1,2,3,4,5,6,7,8,9,\bs{A},\bs{B},\bs{C},\bs{D},\bs{E},\bs{F}\text{.} \end{equation*}
    For example, the integer \(27=(\bs{1B})_{16}\) because \(27-16=11=\bs{B}\) and so
    \begin{align*} 27 \amp = 16+11\\ \amp = 16 + 1+1+1+1+1+ 1+1+1+1+1 + 1\\ \amp = \underline{1} \cdot 16 +\underline{11} \cdot 1\\ \amp = \underline{1} \cdot 16^1 +\underline{11} \cdot 16^0\\ \amp = (\bs{1B})_{16} \end{align*}
    The programming language Python uses the prefix \(\str{0x}\) to indicate a hexadecimal integer. For example, we write \(27=\bs{0x1B}\text{.}\)
Let’s look at a few examples.

Example 9.2.16 Conversion between decimal and hexadecimal.

Β 
  1. Convert \((\bs{A5F})_{16}\) to decimal.
    Solution.
    To determine the highest power of 16 involved, we count in from the right: \(16^0\text{,}\) \(16^1\text{,}\) and then \(16^2\text{.}\) Recalling that \((\bs{A})_{16}=10\) and \((\bs{F})_{16}=15\text{,}\) we have
    \begin{align*} (\bs{A5F})_{16} \amp = \underline{10}\cdot 16^2 + \underline{5}\cdot 16^1 + \underline{15} \cdot 16^0\\ \amp = \underline{10} \cdot 256 + \underline{5} \cdot 16 + \underline{} \cdot 1\\ \amp = 2655\text{.} \end{align*}
  2. Convert 695 to hexadecimal.
    Solution.
    Note that \(16^2 = 256\) is the highest power of 16 less than 695. Since \(2 \times 256 = 512\text{,}\) we subtract to get \(695 - 512 = 183\text{.}\) Next we calculate \(11 \times 16 = 176\) as the largest multiple of 16 less than 183 and subtract again to get \(183-176=7\text{.}\) Recalling that \(11=(\bs{B})_{16}\text{,}\) we have
    \begin{align*} 695 \amp = 512 + 176 + 7\\ \amp = \underline{2} \cdot 256 + \underline{11} \cdot 16 + \underline{7} \cdot 1\\ \amp = \underline{2}\cdot 16^2 + \underline{11}\cdot 16^1 + \underline{7} \cdot 16^0\\ \amp =(\bs{2B7})_{16} \end{align*}
It is your turn to practice.

Activity 9.2.C Conversion between decimal and hexadecimal.

Use the definition of hexadecimal to convert the representation of integers by hand. That means do not use other algorithms you might have learned or computational technology, except to check.
  1. Convert \((\bs{C8}_{16})\) to decimal.
  2. Convert 165 to hexadecimal.
  3. Convert each of \((\bs{A})_{16}\) and \((\bs{5})_{16}\) to binary.
  4. In ActivityΒ 9.2.B (c), we found \(165 = {(\bs{10100101})_2}\text{.}\) How are the binary and hexadecimal representations of 165 from (b) related? Hint: Look at (c).

Subsection 9.2.D Hex as a Shorthand for Binary

We observed from TableΒ 9.2.4 that the larger the base, the shorter the representation of an integer in that base. While binary is longer than base three, five, eight, or 10, hexadecimal is shorter than base three, five, eight, or 10. That is one reason why hexadecimal representation is used, because it helps compress data. But there is another reason. Hexadecimal is an easy-to-read shorthand for the often difficult-to-read binary. Let’s see an example of this shorthand.

Example 9.2.18 Direct conversion between binary and hexadecimal.

Β 
  1. In ExampleΒ 9.2.16 we saw that \(695 = (\bs{2B7})_{16}\text{.}\) It turns out that \(695 = (\bs{1010110111})_2\text{.}\) Explain how the hexadecimal and binary representations are related.
    Solution.
    Every four-bit binary number represents a decimal number \(0-15\) and each of those decimal numbers can be written as a single hex digit. There are four bits per hex digit because \(16=2^4\text{.}\) Let’s take the binary representation of 695 and, working from right to left, replace every group of four bits with its single hex digit to get
    \begin{equation*} \underbrace{\bs{10}}_{\bs{2}} \underbrace{\bs{1011}}_{\bs{B}} \underbrace{\bs{0111}}_{\bs{7}}\text{.} \end{equation*}
    We used that \((\bs{10})_2= 2 =(\bs{2})_{16}\text{,}\) \((\bs{1011})_2 = 8+2+1=11=(\bs{B})_{16}\text{,}\) and \((\bs{0111})_2 = (\bs{111})_2 = 4+2+1 = 7 = (\bs{7})_{16}\text{.}\)
  2. Convert \((\bs{DE})_{16}\) directly to binary.
    Solution.
    Noting that \((\bs{D})_{16}=13 = 8 + 4 + 1 = (\bs{1101})_2\) and \((\bs{E})_{16}=14 = 8 + 4 + 2 = (\bs{1110})_2\text{,}\) we replace each hex digit with its 4-bit binary representation to get
    \begin{equation*} \underbrace{\bs{D}}_{\bs{1101}} \underbrace{\bs{E}}_{\bs{1110}}\text{.} \end{equation*}
    Therefore, \((\bs{DE})_{16}=(\bs{11011110})_2\text{.}\)
  3. Convert \((41)_{16}\) directly to binary.
    Solution.
    Noting that \((4)_{16}= 4 = (0100)_2\) and \((1)_{16} = 1 = (0001)_2\text{,}\) we replace each hex digit with its 4-bit binary representation, adding \(\bs{0}\) s in front as needed, to get
    \begin{equation*} \underbrace{\bs{4}}_{\bs{0100}} \underbrace{\bs{1}}_{\bs{0001}}\text{.} \end{equation*}
    Thus \((41)_{16}=(01000001)_2=(1000001)_2\text{.}\)
It is your turn to practice.

Activity 9.2.D Conversion between binary and hexadecimal.

In this problem use the definition of binary and hexadecimal to convert the representation of integers by hand. That means do not use other algorithms you might have learned or computational technology, except to check.
  1. Convert \((\bs{E7})_{16}\) directly to binary. That means without converting to decimal first.
  2. Convert \((\bs{10001011110})_2\) directly to hexadecimal. That means without converting to decimal first.

Subsection 9.2.E Exercises

Many exercises in this section could be answered using a calculator or online resources. Since the purpose of the exercises is to help you understand the representation, please work out the solutions by hand and be sure to show work. Also, even if you know a simpler conversion algorithm, be sure to use the formal process outlined in this section.

Subsection 9.2.F Exercises for 9.2.A Base \(b\) Representation

3. Understand.

Β 
  1. How many digits are needed to represent 100,000 in base five? Hint: \(5^7 = 78125\) and \(5^8=390625\text{.}\)
  2. How many digits are needed to represent 100,000 in base eight? Hint: \(8^5=32768\) and \(8^6=262144\text{.}\)

5. Understand.

Convert each integer to balanced ternary representation: \(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\text{.}\)

7. Recap.

Do you know …
  1. How to convert between base \(b\) and decimal using the definition of base \(b\) representation, especially for \(b=\) 3, 5, and 8?
  2. How to count the number of base \(b\) digits of an integer without converting to base \(b\text{?}\)
  3. Why the length of the representation decreases as the base increases?
  4. How to convert between balanced ternary representation and decimal?

8. Explore.

Suppose the integer \(n\) is written in base \(b\) as
\begin{equation*} n = a_kb^k + a_{k-1}b^{k-1} + \ldots + a_2b^2 + a_1b + a_0 \end{equation*}
where each integer \(0 \le a_i \lt b\text{.}\)
  1. What is \(n \fn{ mod } b\text{?}\) Explain your reasoning or show work.
  2. What is \(n \fn{ mod }b^2\text{?}\) Explain your reasoning or show work.
  3. How can you tell from the base \(b\) representation of \(n\) whether \(b \mid n\text{?}\) Make a conjecture and explain your reasoning.
Check.
  1. \(\displaystyle a_0\)
  2. Hint: \(b^2\) and every higher power of \(b\) is divisible by \(b^2\) so
    \begin{equation*} a_kb^k + a_{k-1}b^{k-1} + \ldots + a_2b^2 \fn{ mod } b = 0\text{.} \end{equation*}
  3. Hint: We saw in 8.(a) that \(n \fn{ mod } b = a_0\text{.}\) We want \(b \mid n\text{,}\) which means \(n \fn{ mod } b = 0\text{.}\)

9. Explore.

The results of this problem are used to prove the uniqueness of the base \(b\) representation.
  1. The largest integer we can represent in 3 digits in base 3 is \((222)_3\) and in base 5 is \((444)_5\text{.}\) Convert each of these integers to decimal.
  2. What is the largest integer we can represent in \(m\) digits base \(b\text{?}\) Your answer should be a sum.
  3. Make a conjecture about the closed form of your answer to 9.(b).

Subsection 9.2.G Exercises for 9.2.B Binary Representation

11. Practice.

Convert each integer to binary.
Check.
Note: Show how to write each integer as a sum of distinct powers of two.
  1. \(\displaystyle (\bs{10001})_2\)
  2. Hint: The answer involves four \(\bs{1}\) s and two \(\bs{0}\) s.
  3. Hint: The answer is all \(\bs{1}\) s.
  4. Hint: The answer involves four \(\bs{1}\) s. The rest are \(\bs{0}\) s.

12. Understand.

For each integer, determine how many bits are needed for the binary representation without finding the binary representation. Hint: Consult TableΒ 9.2.11.
  1. 100,000 Note: You are welcome to use technology to calculate higher powers of two.
Check.
Make sure you explain how to count without converting.
  1. Hint: The highest power of two less than 100 is \(64=2^6\text{.}\)
  2. Hint: The highest power of two less than 100,000 is \(65536=2^{16}\text{.}\)

13. Recap.

Do you know …
  1. What the values of \(2^0, 2^1, \ldots, 2^{10}\) equal?
  2. How to convert between binary and decimal using the definition of binary representation?
  3. What the connection (and distinction) is between binary numbers and bit strings?

14. Explore.

Here’s an alternative way to find the binary representation of the integer 100.
Use this new process to find the binary representation of each integer. Be sure to show work.
  1. 1,000
Check.
Make sure to show how you are using the algorithm.
  1. \(\displaystyle (\bs{10001})_2\)
  2. Hint: \((\bs{1}\underline{\hspace{.1in}}~\underline{\hspace{.1in}}~\underline{\hspace{.1in}}~\underline{\hspace{.1in}}\bs{1})_2\)
  3. Hint: \((\bs{1}\underline{\hspace{.1in}}~\underline{\hspace{.1in}}~\underline{\hspace{.1in}}~\underline{\hspace{.1in}}~\underline{\hspace{.1in}}~\underline{\hspace{.1in}}~\underline{\hspace{.1in}}\bs{0})_2\)

15. Explore.

Explain why the algorithm introduced in Exercise 14 works in general.

16. Explore.

Β 
  1. The largest integer we can represent in three bits in binary is \((\bs{111})_2\text{.}\) Convert this integer to decimal.
  2. The largest integer we can represent in four bits in binary is \((\bs{1111})_2\text{.}\) Convert this integer to decimal.
  3. What is the largest integer we can represent in \(m\) bits in binary? Your answer should be a sum.
  4. Make a conjecture about an explicit form of your answer to 16.(c).
Check.
  1. Hint: \(4+2+1\)
  2. Hint: \(8+4+2+1\)
  3. Hint: You can write the answer in summation notation as \(\displaystyle \sum_{k=\underline{\hspace{.1in}}}^m\underline{\hspace{.2in}}\text{.}\) Check that the summand involves \(2^k\) (not \(2^m\)).
  4. Hint: It involves powers of two.

Subsection 9.2.H Exercises for 9.2.C Hexadecimal Representation

20. Recap.

Do you know …
  1. What the value of \(16^2\) equals?
  2. What integers are represented by the letters \(\bs{A},\bs{B},\bs{C},\bs{D},\bs{E},\bs{F}\) in hexadecimal?
  3. How to convert between hexadecimal and decimal using the definition of hexadecimal notation?

21. Explore.

Β 
  1. The largest integer we can represent in two hex digits in hexadecimal is \((\bs{FF})_{16}\text{.}\) Convert this integer to decimal.
  2. The largest integer we can represent in three hex digits in hexadecimal is \((\bs{FFF})_{16}\text{.}\) Convert this integer to decimal.
  3. What is the largest integer we can represent in \(m\) hex digits in hexadecimal? Your answer should be a sum. Your answer should not have any letters in it.
  4. Make a conjecture about an explicit form of your answer to 21.(c).

22. Explore.

Digital colors are represented in hex. The first two digits control the amount of red, from \((\bs{00})_{16}=0\) (none) to \((\bs{FF})_{16}=255\) (fully saturated). The next two digits control the amount of green, and the last two digits control the amount of blue.
  1. Describe the color \(\bs{00FF00}\text{.}\)
  2. Give a possible hex code for bright red.
  3. Describe the color \(\bs{880088}\text{.}\)
  4. Give a possible code for aqua (bright green-blue mix).

Subsection 9.2.I Exercises for 9.2.D Hex as a Shorthand for Binary

26. Explore.

Consider the integer
\begin{equation*} n = (a_7a_6a_5a_4a_3a_2a_1a_0)_2 = (b_1b_0)_{16}\text{.} \end{equation*}
Find a formula for \(b_1\) and \(b_0\) in terms of the \(a_i\text{.}\) Hint: Write
\begin{equation*} n=a_72^7+a_62^6+a_52^5+a_42^4+a_32^3+a_22^2+a_12^1+a_02^0 \end{equation*}
and factor \(16=2^4\) out of the first four terms.
Check.
Hints: \(2^7=2^4(2^3)\text{,}\) \(2^6=2^4(2^2)\text{,}\) \(2^5=2^4(2)\text{,}\) and \(2^4=2^4(1)\text{.}\) Each of \(b_1\) and \(b_0\) is of the form
\begin{equation*} \underline{\hspace{.1in}}2^3+ \underline{\hspace{.1in}}2^2+ \underline{\hspace{.1in}}2+ \underline{\hspace{.1in}} \end{equation*}