Skip to main content

Section 2.1 Organized Listing

It is often helpful to have a list. We might be trying to solve a problem by looking for a pattern among a list of examples. Or, we might want to check for every possibility using a list of all possible examples. In this section, we practice listing.
We begin this section by giving you the opportunity to list on your own, so that you can appreciate the challenges. Try not to get frustrated, just try your best. Later in the section, we describe a few strategies to help create organized lists, including considering cases and constructing possibility trees, that can make the process a little less frustrating.

Subsection 2.1.A Squares and Dominoes

We begin with a puzzle.

Activity 2.1.A Squares and Dominoes Puzzle.

You have a large supply of \(1 \times 1\) (striped) squares and \(1 \times 2\) (gray) dominoes with which to tile a \(1 \times n\) board. That is, you want to cover every square on the board with either a square or a domino so that there is no overlap. For example, there are three different ways to tile a \(1 \times 3\) board shown in FigureΒ 2.1.2. Notice that the order of the tiles matters.
Figure 2.1.2. Three ways to tile the \(1 \times 3\) board with squares and dominoes.
We write a dot (\(\bullet\)) for each square and a dash (\(\boldsymbol{-}\)) for each domino to obtain the shorthand listed below each tiling.
  1. There is one way to tile the \(1\times 1\) board. What is it? Use our shorthand.
  2. There are two ways to tile the \(1\times 2\) board. List them using our shorthand.
  3. We have already seen that there are three ways to tile the \(1\times 3\text{.}\) You might expect there to be four ways to tile the \(1\times 4\) board, but there are actually five ways. List them.
  4. List the ways to tile the \(1 \times 5\) board. How many ways are there?
  5. List all the ways to tile the \(1\times 6\) board. Hint: first list all the ways that start with a square (\(\bullet\)) and then list all the ways that start with a domino (\(\boldsymbol{-}\)).
  6. Make a table to record the number of ways to tile the \(1 \times n\) board for \(n=1,2,3,4,5,6\text{.}\)
  7. Conjecture the number of ways to tile a \(1\times 10\) board. Explain your reasoning and show your work. Your answer should be a specific number.
  8. Conjecture the number of ways to tile a \(1\times n\) board.
Make sure that you have tried ActivityΒ 2.1.A before reading on.

Example 2.1.3 Squares and dominoes tiling of a \(1 \times 6\) board.

Β 
  1. As in ActivityΒ 2.1.A, list all the ways to tile a \(1 \times 6\) board with squares and dominoes by first listing the ways that start with a square (\(\bullet\)) and then listing all the ways that start with a domino (\(\boldsymbol{-}\)).
    Solution.
    First, we list the ways that start with a square. After the square, there is effectively a \(1 \times 5\) board to tile. Therefore, we copy all the ways to tile the \(1 \times 5\) board (shown with a square bracket) and put a square in front of each, as shown in FigureΒ 2.1.4.
    \begin{equation*} \bullet \underline{\bullet \bullet \bullet \bullet \bullet~}~, \bullet \underline{\bullet \bullet \bullet \boldsymbol{-}~}~, \bullet \underline{\bullet \bullet \boldsymbol{-} \bullet~}~,\bullet \underline{\bullet \boldsymbol{-} \bullet \bullet~}~, \end{equation*}
    \begin{equation*} \bullet \underline{\bullet \boldsymbol{-} \boldsymbol{-}~}~, \bullet \underline{\boldsymbol{-} \bullet \bullet \bullet~}~, \bullet \underline{\boldsymbol{-} \bullet \boldsymbol{-}~}~, \bullet \underline{\boldsymbol{-} \boldsymbol{-}\bullet~} \end{equation*}
    Figure 2.1.4. Tiling the \(1 \times 6\) board starting with a square.
    Next, we list the ways that start with a domino. After the domino, there is effectively a \(1 \times 4\) board to tile. Therefore, we copy all the ways to tile the \(1 \times 4\) board (shown with a square bracket) and put a domino in front of each, as shown in FigureΒ 2.1.5.
    \begin{equation*} \boldsymbol{-} \underline{\bullet \bullet \bullet \bullet~}~, \boldsymbol{-} \underline{\bullet \bullet \boldsymbol{-}~}~, \boldsymbol{-} \underline{\bullet \boldsymbol{-} \bullet~}~, \boldsymbol{-} \underline{\boldsymbol{-} \bullet \bullet~}~, \boldsymbol{-} \underline{\boldsymbol{-} \boldsymbol{-}~} \end{equation*}
    Figure 2.1.5. Tiling the \(1 \times 6\) board starting with a domino.
    Since every tiling of a \(1 \times 6\) board either starts with a square or with a domino, we have listed all ways to tile a \(1 \times 6\) board.
  2. How many ways are there to tile a \(1 \times 6\) board? Explain how your answer related to the number of ways to tile a \(1 \times 5\) board and the number of ways to tile a \(1 \times 4\) board.
    Solution.
    We listed a total of 13 ways to tile a \(1 \times 6\) board. Because we get one tiling of a \(1 \times 6\) board for each of the eight ways to tile a \(1 \times 5\) board and we get one tiling of a \(1 \times 6\) board for each of the five ways to tile a \(1 \times 4\) board, , the number of ways to tile a \(1 \times 6\) board equals the sum of the number of ways to tile a \(1 \times 5\) board plus the number of ways to tile a \(1 \times 4\) board. That is, there are \(8+5=13\) ways to tile a \(1 \times 6\) board.
In ActivityΒ 2.1.A and ExampleΒ 2.1.3, we saw our first example of a recursive solution where we use tilings of smaller boards to tile a larger board. Specifically, we can tile a \(1 \times n\) board using the tilings for the next two smaller boards: a \(1 \times (n-1)\) board and a \(1 \times (n-2)\) board. We study recursions in ChapterΒ 8 Recursion and Induction. We can use this recursion to count the number of tilings on a \(1 \times n\) board.

Example 2.1.6 Counting squares and dominoes tilings of a \(1 \times 8\) board.

Β 
  1. Based on the recursive solution to tile a \(1 \times n\) board using squares and dominoes in ExampleΒ 2.1.3, how many ways can we tile a \(1 \times 8\) board?
    Solution.
    We saw in ExampleΒ 2.1.3 that there are \(8+5=13\) ways to tile a \(1 \times 6\) board: eight are obtained by putting a square in front of each tiling of a \(1 \times 5\) board and five are obtained by putting a domino in front of each tiling of a \(1 \times 4\) board.
    Similarly, there are \(13+8=21\) ways to tile a \(1 \times 7\) board: 13 are obtained by placing a square in front of each tiling of a \(1 \times 6\) board and eight are obtained by placing a domino in front of each tiling of a \(1 \times 5\) board.
    Continuing this reasoning, there are \(21+13 = 34\) tilings of a \(1 \times 8\) board.
  2. Conjecture the number of ways to tile a \(1 \times n\) board.
    Solution.
    The one-shorter board is \(1 \times (n-1)\) and the two-shorter board is \(1 \times (n-2)\text{.}\) Since we got one tiling of the \(1 \times n\) board for each tiling of a \(1 \times (n-1)\) board and for each tiling of a \(1 \times (n-2)\) board, the number of tilings of a \(1 \times n\) equals the sum of the number of tilings of a \(1 \times (n-1)\) board and the number of tilings of a \(1 \times (n-2)\) board. That last sentence is a mouthful. Using sequence notation, which we introduce formally in SectionΒ 6.5, we might write
    \begin{equation*} b_n=b_{n-1}+b_{n-2} \end{equation*}
    where the subscript on \(b_k\) represents the number of ways to tile a \(1 \times k\) board.
The number of ways to tile a \(1 \times n\) board with squares and dominoes is a Fibonacci number– it is the sum of the previous two Fibonacci numbers, usually starting with \(0,1\text{.}\) We revisit the Fibonacci numbers again in SectionΒ 8.5. The first few Fibonacci numbers are
\begin{equation*} 0,1,1,2,3,5,8,13,21,34,55,89,\ldots \end{equation*}

Subsection 2.1.B Sets of Digits

Throughout this course, we use mathematical structures. One structure is a set, which is understood to be an unordered collection of elements. For example, the set \(\{1,4,5\}\) has three elements: 1, 4, and 5. The set \(\{4,1,5\}\) is the same as the set \(\{1,4,5\}\) because \(\{4,1,5\}\) has the same three elements: 1, 4, and 5. That is, the order in which we list the elements in a set does not matter. There is no need to repeat elements within a set because it does not change the set. For example, the set \(\{2,7,2\}\) is the same as the set \(\{2,7\}\) because each set has two elements: 2 and 7. Sets are very important in mathematics. In fact, we might say that
Sets are the most fundamental structure of mathematics because all of mathematics can be defined using sets.
Since discrete mathematics comes from all areas of mathematics, it should not be surprising that this textbook uses a large mathematical vocabulary. Some words in that vocabulary are not defined. For example, the words β€œset” or β€œelement” are not defined in the previous paragraph, although we hope that their meaning is clear from the narrative. It turns out that any vocabulary must be built on a set of undefined words because you have to start somewhere. We try to keep the list of undefined terms as short as possible.
When we can, we give a formal mathematical definition of a new word that states what the word means in mathematics. We sometimes add a quick example or note, but those additions are not officially part of the definition. Definitions in mathematics also serve another purpose. There might be several different, but equivalent, ways to explain the meaning of a word. In such situations, a definition establishes an agreement on which of those different explanations is the official mathematical definition of the word.
Here are a few examples of definitions. First, there are a few ways to refer to types of numbers.

Definition 2.1.7 Integers.

Β 
  1. The numbers \(\ldots, -3, -2, -1, 0, 1, 2, 3, \ldots\) are integers.
  2. The numbers \(0, 1, 2, 3, \ldots\) are natural numbers (or non-negative integers)
     1 
    You may find that other mathematics classes have the natural numbers starting with \(1\)
    . For example, the phrase β€œfor any natural number \(n\)” means β€œfor any integer \(n \ge 0\)”.
  3. The numbers \(1, 2, 3, \ldots\) are positive integers. For example, the phrase β€œfor any positive integer \(n\)” means β€œfor any integer \(n \ge 1\)”.
The integers \(0,1,2,3,4,5,6,7,8,9\) have a special name.
We also have a name for the result of adding, subtracting, or multiplying two integers.

Definition 2.1.9 Sum, difference, and product.

Β 
  1. The sum (or total) of two integers \(n\) and \(k\) is \(n+k\text{.}\) For example, the sum of 2 and 3 is 5 and the sum of 3 and \(t\) is \(3+t\text{.}\)
  2. In any sum, terms are the integers that are added. For example, in the sum \(3+t\text{,}\) the terms are 3 and \(t\text{.}\)
  3. The negative of the integer \(s\) is the integer
    \begin{equation*} -s=(-1)s\text{.} \end{equation*}
    Note that \(-s\) could be positive, negative, or 0. For example, the negative of 5 is \(-5\text{,}\) the negative of \(-17\) is \(17\text{,}\) and the negative of 0 is 0.
  4. The difference of the integers \(n\) and \(s\text{,}\) in that order, is the integer
    \begin{equation*} n-s=n+(-s)\text{.} \end{equation*}
    Note that if we subtract in the opposite order, we get the negative. For example, \(7-4=3\) and \(4-7=-3\text{.}\) That is, \(n-s\) and \(s-n\) are negatives of each other.
  5. The product of the integers \(n\) and \(s\) is \(n \times s\text{,}\) which is normally written as \(ns\text{.}\) For example, the product of 2 and 3 is 6 and the product of 5 and \(k\) is \(5k\text{.}\) Multiplication is shorthand for addition, so officially
    \begin{equation*} ns = \underbrace{s+s+\ldots+s.}_{n \text{ times } } \end{equation*}
  6. In any product, the factors are the integers being multiplied. For example, in the product \(5k\text{,}\) the factors are 5 and \(k\text{.}\)
Here is an example that uses these definitions.

Example 2.1.10 2-digit sets.

Β 
  1. List all sets of two distinct nonzero digits where the sum of the digits is 14.
    Solution.
    Since \(5+9=14\) and \(6+8=14\text{,}\) two such sets are \(\{5,9\}\) and \(\{6,8\}\text{.}\) Notice that \(7+7=14\text{,}\) but the digits that are added are not distinct. There are no other sets because the largest digit is 9, and so the smallest digit we might use is \(14-9=5\text{.}\) The final list is \(\{5,9\}\) and \(\{6,8\}\text{.}\)
  2. List all sets of two distinct digits where the product of the digits is 12.
    Solution.
    Start with the smallest digit 1. We know \(1 \times 12 = 12\text{,}\) but 12 is not a digit. The next digit is 2 and \(2 \times 6 = 12\text{.}\) Thus, one set is \(\{2,6\}\text{.}\) Next, we have the digit 3 and \(3 \times 4 = 12\text{.}\) Thus, another set is \(\{3,4\}\text{.}\) The final list is \(\{2,6\}\text{,}\) \(\{3,4\}\text{.}\)
Try working with sets.

Activity 2.1.B Digit sums.

Be sure to write sets in set notation using curly brackets.
  1. List all sets of two distinct nonzero digits where the sum of the digits is seven.
  2. List all sets of three distinct nonzero digits where the sum of the digits is nine.
  3. List all sets of four distinct nonzero digits where the sum of the digits is 21.
  4. How might you organize your lists to avoid accidentally listing the same set twice, to make it easy to compare answers with a classmate, and to determine if you included all the possibilities?
As we saw in ActivityΒ 2.1.A and ActivityΒ 2.1.B, there are two key challenges to making a list.
The short version of the answer is that we try to be organized, and if possible, we try to write the list in a standard order. For example, in ActivityΒ 2.1.A you might have organized your list based on whether the tiling started with a square or a domino, or you might have organized your list based on the number of dominoes. In ActivityΒ 2.1.B you might have organized your work by considering the smallest or largest element in your set. In general, we can create an organized list by breaking the problem into special cases.

Example 2.1.12 Using cases to list digit sums.

Use cases based on the largest digit to list all sets of four distinct nonzero digits where the sum of the digits is 17.
Solution.
We consider cases based on the largest digit in the set.
Case 1: The largest digit is 9. The other three distinct nonzero digits must be less than 9 and have a sum of \(17-9=8\text{,}\) either \(5+2+1 = 8\) or \(4+3+1=8\text{.}\) The two sets in this case are \(\{1,2,5,9\}\) and \(\{1,3,4,9\}\text{.}\)
Case 2: The largest digit is 8. The other three distinct nonzero digits must be less than 8 and have a sum of \(17-8=9\text{,}\) either \(5+3+1 = 9\) or \(4+3+2=9\text{.}\) The two sets in this case are \(\{1,3,5,8\}\) and \(\{2,3,4,8\}\text{.}\)
Case 3: The largest digit is 7. The other three distinct nonzero digits must be less than 7 and have a sum of \(17-7=10\text{,}\) either \(5+4+1 = 10\) or \(5+3+2=10\text{.}\) The two sets in this case are \(\{1,4,5,7\}\) and \(\{2,3,5,7\}\text{.}\)
Case 4: The largest digit is 6. The other three distinct nonzero digits must be less than 6 have a sum of \(17-6=11\) which must be \(5+4+2 = 11\text{.}\) The only set in this case is \(\{2,4,5,6\}\text{.}\)
Note that the largest digit cannot be 5 because we cannot find three distinct nonzero digits that are less than 5 and add to \(17-5=12\text{.}\) The largest sum of three distinct nonzero less than 5 is \(4+3+2=9\lt 12\text{.}\)
We have found all seven sets of four distinct nonzero digits where the sum of the digits is 17. They are \(\{1,2,5,9\}\text{,}\) \(\{1,3,4,9\}\text{,}\) \(\{1,3,5,8\}\text{,}\) \(\{2,3,4,8\}\text{,}\) \(\{1,4,5,7\}\text{,}\) \(\{2,3,5,7\}\text{,}\) and \(\{2,4,5,6\}\text{.}\)

Subsection 2.1.C Strings

Another example of a mathematical structure is a string. Your passwords are probably all strings. We represented a tiling of a \(1 \times n\) board with squares and dominoes as a string of dots (\(\bullet\)) and dashes (\(\boldsymbol{-}\)) in ActivityΒ 2.1.A. Here is the definition of string and more vocabulary about strings.

Definition 2.1.13 Characters and strings.

Β 
  1. An alpha-numeric character is either a digit, a lowercase English letter, or an uppercase (capital) English letter. There are 26 letters in the English alphabet and each letter has a lower and upper case.
  2. In this textbook (and most of mathematics and computer science), all alphanumeric characters are case-sensitive. For example, \(\str{A}\) and \(\str{a}\) are different characters. There are, \(10+26+26 = 62\) alphanumeric characters
  3. Any other single symbol, such as \(\str{!}\) or \(\str{>}\text{,}\) that is typically found on a keyboard key is a special character.
  4. A character is either an alphanumeric character or a special character.
  5. A string is a finite sequence of characters. For example, \(\str{A0y2%0}\) is a string. Note that characters may be repeated within a string and the order matters. For example, \(\str{00%2Ay}\) is a different string.
  6. The length of a string is the total number of characters in the string. For example, \(\str{A0y2%0}\) is a string of length six.
In our next example, we highlight two organizational strategies for creating lists: considering cases or drawing a possibility tree
 2 
Possibility trees get their name from natural trees because they have branches.
.

Example 2.1.14 2-strings.

List all strings of length two where the first character is \(\str{a}\text{,}\) \(\str{b}\text{,}\) or \(\str{c}\) and the second character is \(\str{2}\) or \(\str{6}\text{.}\)
  1. Construct your list by considering cases based on the first character.
    Solution.
    Let’s consider cases based on the first character.
    Case 1: If the first character is \(\str{a}\text{,}\) then we have \(\str{a2}\) or \(\str{a6}\text{.}\)
    Case 2: If the first character is \(\str{b}\text{,}\) then we have \(\str{b2}\) and \(\str{b6}\text{.}\)
    Case 3: If the first character is \(\str{c}\text{,}\) then we have \(\str{c2}\) and \(\str{c6}\text{.}\)
    The strings are \(\str{a2}\text{,}\) \(\str{a6}\text{,}\) \(\str{b2}\text{,}\) \(\str{b6}\text{,}\) \(\str{c2}\text{,}\) \(\str{c6}\text{.}\)
    Figure 2.1.15. A possibility tree for 2-strings.
  2. Construct your list by drawing a possibility tree.
    Solution.
    In FigureΒ 2.1.15, we begin by drawing a starting point \(\bullet\) on the left. We draw three branches to nodes \(\str{a}\text{,}\) \(\str{b}\text{,}\) \(\str{c}\) which are the possibilities for the first character in the string.
    If the first character is \(\str{a}\text{,}\) then the second character is either \(\str{2}\) or \(\str{6}\text{,}\) and so we draw two branches from \(\str{a}\) to \(\str{a2}\) and from \(\str{a}\) to \(\str{a6}\text{.}\) Similarly we draw branches from \(\str{b}\) to \(\str{b2}\text{,}\) from \(\str{b}\) to \(\str{b6}\text{,}\) from \(\str{c}\) to \(\str{c2}\text{,}\) and from \(\str{c}\) to \(\str{c6}\text{.}\) As before, the strings are: \(\str{a2}\text{,}\) \(\str{a6}\text{,}\) \(\str{b2}\text{,}\) \(\str{b6}\text{,}\) \(\str{c2}\text{,}\) and \(\str{c6}\text{.}\)
    There is a shorthand way to draw the tree where we only list the new character in each spot instead as shown in FigureΒ 2.1.16. In this case, it takes a little less work to draw the tree but a little more work to write out the final list.
    Figure 2.1.16. A possibility tree for 2-strings, shorthand version.
Notice in ExampleΒ 2.1.14 that we considered the letters in alphabetical order, the order of the English alphabet: \(\str{a}\text{,}\) \(\str{b}\text{,}\) \(\str{c}\text{,}\) \(\str{d}\text{,}\) \(\str{e}\text{,}\) \(\str{f}\text{,}\) \(\str{g}\text{,}\) \(\str{h}\text{,}\) \(\str{i}\text{,}\) \(\str{j}\text{,}\) \(\str{k}\text{,}\) \(\str{l}\text{,}\) \(\str{m}\text{,}\) \(\str{n}\text{,}\) \(\str{o}\text{,}\) \(\str{p}\text{,}\) \(\str{q}\text{,}\) \(\str{r}\text{,}\) \(\str{s}\text{,}\) \(\str{t}\text{,}\) \(\str{u}\text{,}\) \(\str{v}\text{,}\) \(\str{w}\text{,}\) \(\str{x}\text{,}\) \(\str{y}\text{,}\) \(\str{z}\)
\(\str{A}\text{,}\) \(\str{B}\text{,}\) \(\str{C}\text{,}\) \(\str{D}\text{,}\) \(\str{E}\text{,}\) \(\str{F}\text{,}\) \(\str{G}\text{,}\) \(\str{H}\text{,}\) \(\str{I}\text{,}\) \(\str{J}\text{,}\) \(\str{K}\text{,}\) \(\str{L}\text{,}\) \(\str{M}\text{,}\) \(\str{N}\text{,}\) \(\str{O}\text{,}\) \(\str{P}\text{,}\) \(\str{Q}\text{,}\) \(\str{R}\text{,}\) \(\str{S}\text{,}\) \(\str{T}\text{,}\) \(\str{U}\text{,}\) \(\str{V}\text{,}\) \(\str{W}\text{,}\) \(\str{X}\text{,}\) \(\str{Y}\text{,}\) \(\str{Z}\) For strings beginning with \(\str{a}\text{,}\) we first list the string ending in \(\str{2}\) and then the string ending in \(\str{6}\text{.}\) That is, we considered the digits in numerical order, from smallest to largest.
Practice using possibility trees to create lists.

Activity 2.1.C Listing strings.

Β 
  1. Use a possibility tree to list all strings of length two where each character is \(\str{a}\text{,}\) \(\str{b}\text{,}\) or \(\str{c}\text{.}\)
  2. Let’s change the rules. Use a possibility tree to list all strings of length three where each character is \(\str{a}\text{,}\) \(\str{b}\text{,}\) \(\str{c}\) if repetitions are not allowed, meaning that each letter is used exactly once.
  3. Look back at the tree you drew in (a). How many strings of length \(10\) are there where each character is \(\str{a}\text{,}\) \(\str{b}\text{,}\) or \(\str{c}\text{?}\) Repetition is allowed. Conjecture without writing a list or drawing a tree.
  4. Look back at the tree you drew in (b). How many strings of length ten are there where each character is \(\str{a}\text{,}\) \(\str{b}\text{,}\) \(\str{c}\text{,}\)…, \(\str{j}\) and repetition is not allowed? Conjecture without writing a list or drawing a tree.
In the possibility trees that we have drawn so far, each branch is of the same length. Let’s look at an example where the branches are different lengths.

Example 2.1.18 Tiling a \(1 \times 5\) board with squares and dominoes.

Draw the possibility tree to list the ways to tile a \(1 \times 5\) board using squares (\(\bullet\)) and dominoes (\(\boldsymbol{-}\)) as in ActivityΒ 2.1.A.
Solution.
The tree in FigureΒ 2.1.19 shows all eight possibilities. Notice that we changed the root symbol to \(\circ\) to avoid confusion with the square symbol (\(\bullet\)). Reading across the top row, for example, gives the all-square tiling \(\bullet\bullet\bullet\bullet\bullet\) and reading the next path from branch to leaf gives the tiling \(\bullet\bullet\bullet\boldsymbol{-}\text{.}\)
Figure 2.1.19. Tiling the \(1 \times 5\) board with squares and dominos.
As we build a tiling of length five, we have to be careful. If we have a tiling of length four, then the only option to finish the tiling is a square because a domino would make length six. For example, the branch that begins \(\bullet\boldsymbol{-}\bullet\) can only be followed by \(\bullet\text{.}\) Once we have a tiling of length five, the branch ends. For example, the branch \(\boldsymbol{-}\bullet\boldsymbol{-}\) ends after three tiles.

Subsection 2.1.D Integer Algebra

Often, the numbers we consider in this textbook are integers. For example, we might make a conjecture that involves an unknown integer. Historically, integers were commonly named using the letters \(i,j,k,l,m\text{,}\) or \(n\) because some computer programming languages, such as Fortran, used to reserve these letters for integer quantities (perhaps because the word β€œinteger” begins with \(i\) and then \(n\)). In this textbook, we use a variety of letters for integers, although we tend to save the letters \(x\text{,}\) \(y\text{,}\) and \(z\) for real-valued (decimal) quantities.
When you studied algebra, you probably worked a lot with quantities named \(x\text{,}\) occasionally with quantities named \(y\text{,}\) \(z\text{,}\) or \(t\text{,}\) and rarely with quantities named \(n\text{,}\) \(m\text{,}\) \(k\text{,}\) or other common letters for integers. The rules of algebra remain the same for whatever letters we use, but it can take some practice to be comfortable working with a variety of letters. In this section, we discuss integer arithmetic. To start with, it is useful to name various arithmetic properties of the integers.

Definition 2.1.20 Integer algebra and the order of operations.

Β 
  1. When several operations are involved in a single calculation, we need to know the order of operations (PEMDAS), the priority ranking for arithmetic operations. The order is
    First, calculate anything inside Parentheses.
    Next, calculate Exponents \(\wedge\text{,}\) in order from left to right.
    Then, Multiply Γ— and Divide \(\div\text{,}\) in order from left to right.
    Last, Add \(+\) and Subtract \(-\text{,}\) in order from left to right.
  2. The commutative properties of the integers tell us that
    \begin{equation*} n+s=s+n \ \ \text{ and } sn=ns\text{.} \end{equation*}
    We often use the commutative property to rewrite sums or products in standard order. For example, products are usually written alphabetically (\(ns\) is standard, not \(sn\)) and in products numbers come before letters (\(2k\) is standard, not \(k2\)). In sums, numbers often come after letters (\(n+1\) is common, although \(1+n\) is also acceptable).
  3. The associative properties of the integers tells us that
    \begin{equation*} (n+s)+t = n+(s+t) \ \ \text{ and } (ns)t = n(st)\text{.} \end{equation*}
    We often use the associative property to write an expression such as \(n+3k+2\) without parentheses, since the location of parentheses would not change the sum.
  4. We factor an integer by writing it as a product of two integers. For example, we can factor \(6\) as \(2 \times 3\) which we could write as \(6=2 \times 3\) or \(6=(2)(3)\text{.}\) Although it is correct to factor \(6\) as \(1 \times 6\text{,}\) if an activity or exercise asks you to β€œfactor,” the answer should not use the factor \(1\text{.}\) Notice that β€œfactor” can be a noun, which means the quantity we are multiplying, or a verb, which means write as a product.
  5. The distributive property of the integers tells us that
    \begin{equation*} n(s+t)=ns+nt\text{.} \end{equation*}
    Reading this equation from left to right tells us how to expand (or distribute or multiply out). For example,
    \begin{equation*} 2(n+4) = (2)(n) + (2)(4) = 2n + 8\text{.} \end{equation*}
    Equations tell us that two things are equal, so we can equally well read this equation from right to left
    \begin{equation*} ns+nt=n(s+t) \end{equation*}
    which tells us how to factor. For example,
    \begin{equation*} 5n-10 = (5)(n) + (5)(-2) = 5(n+(-2)) = 5(n-2)\text{.} \end{equation*}
Let’s practice working with the vocabulary factor and term.

Example 2.1.21 Factors and terms.

Β 
  1. Describe the quantity \(2(n+1)\) using factors and terms.
    Solution.
    There are two factors: 2 and \(n+1\text{.}\) The second factor has two terms: \(n\) and 1.
  2. Describe the quantity \(2n+1\) using factors and terms.
    Solution.
    There are two terms: \(2n\) and 1. The first term has two factors: 2 and \(n\text{.}\)
We can use the distributive propensity to combine like terms, which means terms having a common factor.

Example 2.1.22 Combining like terms.

Simplify the expression \(2n+3n\text{.}\)
Solution.
You have seen \(2x+3x=5x\text{.}\) You might have learned that this equation is analogous to saying that if I have 2 apples plus another 3 apples, then I have a total of 5 apples. In the same way, \(2n+3n=5n\text{.}\)
Alternatively, we can use the definition of the product. Since \(2n = n+n\) and \(3n = n+n+n\text{,}\) together we have
\begin{equation*} 2n + 3n = \underbrace{(n+n)}_{2 \text{ times } } +\underbrace{(n+n+n)}_{3 \text{ times } } = \underbrace{n+n+n+n+n}_{5 \text{ times } } = 5n \end{equation*}
Yet another way of thinking about this simplification is to use the distributive property to factor
\begin{equation*} 2n+3n=(2+3)n=5n \end{equation*}
Each of these approaches is useful. So, even if you favor one approach, learn the other methods as well.
Now it is your turn to practice some integer algebra.

Subsection 2.1.E Exercises

Subsubsection Exercises for 2.1.A Squares and Dominoes

1. Practice.

Β 
  1. Using the strategy in ExampleΒ 2.1.6, conjecture the number of ways to tile a \(1 \times 12\) board.
  2. Using the strategy and results in ExampleΒ 2.1.3, list all 21 ways to tile a \(1 \times 7\) board using squares and dominoes.
Check.
  1. Hint: The eight ways that start with a domino are \(\boldsymbol{-}\bullet\bullet\bullet\bullet\bullet\text{,}\) \(\boldsymbol{-}\bullet\bullet\bullet\boldsymbol{-}\text{,}\) \(\boldsymbol{-}\bullet\bullet\boldsymbol{-}\bullet\text{,}\) \(\boldsymbol{-}\bullet\boldsymbol{-}\bullet\bullet\text{,}\) \(\boldsymbol{-}\bullet\boldsymbol{-}\boldsymbol{-}\text{,}\) \(\boldsymbol{-}\boldsymbol{-}\bullet\bullet\bullet\text{,}\) \(\boldsymbol{-}\boldsymbol{-}\bullet\boldsymbol{-}\text{,}\) and \(\boldsymbol{-}\boldsymbol{-}\boldsymbol{-}\bullet\text{.}\) Each is a domino followed by a way to tile a \(1 \times 6\) board. There are also 13 ways to start with a square.

2. Understand.

Suppose we have \(1 \times 1\) squares (\(\bullet\)), \(1 \times 2\) dominoes (\(\boldsymbol{-}\)), and new \(1 \times 3\) trominoes (\(\thicksim\)).
  1. List the ways to tile \(1 \times 1\text{,}\) \(1 \times 2\text{,}\) \(1 \times 3\text{,}\) and \(1 \times 4\) boards using squares, dominoes, and trominoes.
  2. List the ways to tile \(1 \times 1\text{,}\) \(1 \times 2\text{,}\) \(1 \times 3\text{,}\) and \(1 \times 4\) boards using only squares and trominoes.
Check.
  1. Hint: The \(1 \times 1\text{,}\) \(1 \times 2\text{,}\) and \(1 \times 3\) only involve squares and dominoes, so you should have the same list as before. For \(1 \times 4\text{,}\) the list is: \(\bullet\bullet\bullet\bullet\text{,}\) \(\bullet\bullet\boldsymbol{-}\text{,}\) \(\bullet\boldsymbol{-}\bullet\text{,}\) \(\bullet\thicksim\text{,}\) \(\boldsymbol{-}\bullet\bullet\text{,}\) \(\boldsymbol{-}\boldsymbol{-}\text{,}\) and \(\thicksim\bullet\text{.}\)
  2. Now there is one way for \(1 \times 1\text{,}\) one way for \(1 \times 2\text{,}\) two ways for \(1 \times 3\text{,}\) and three ways for \(1 \times 4\text{.}\)

3. Recap.

Do you know …
  1. What does it mean to tile a \(1 \times n\) board with squares and tiles?
  2. How to create a list of ways to tile a \(1 \times n\) board with squares and dominoes using the lists from the next two smaller boards?
  3. What the phrase "recursive solution" means?
  4. How to generate a list of Fibonacci numbers?

4. Explore.

Suppose we have squares, dominoes, and trominoes, as in Exercise 2.
  1. Conjecture the number of ways to tile a \(1 \times n\) board with squares, dominoes, and trominoes. Explain your reasoning and make sure you get the correct number when \(n=1,2,3,4\text{.}\)
  2. Conjecture the number of ways to tile a \(1 \times n\) board with only squares and trominoes. Explain your reasoning and make sure you get the correct number when \(n=1,2,3,4\text{.}\)

Subsubsection Exercises for 2.1.B Sets of Digits

5. Practice.

Β 
  1. List all sets of three distinct nonzero digits where the sum of the digits is 10.
  2. List all sets of three distinct nonzero digits where the sum of the digits is 18.
Check.
  1. Hint: \(\{1,2,7\}\text{,}\) \(\{1,3,6\}\text{,}\) \(\{1,4,5\}\text{,}\) and there is one more that does not use 1.
  2. Hint: \(\{1,8,9\}\text{,}\) \(\{2,7,9\}\text{,}\) \(\{3,6,9\}\text{,}\) \(\{3,7,8\}\text{,}\) and three more.

6. Understand.

We define the term prime later in the course. For this problem, you only need to know that the first few primes are
\begin{equation*} 2, 3, 5, 7, 11, 13, 17, 19, 23, 29\text{.} \end{equation*}
List all positive integers less than 50 that are the product of two distinct primes.
Check.
Hint: The list includes \(2 \times 3\text{,}\) \(2 \times 5\text{,}\) …, \(2 \times 23\text{,}\) \(3 \times 5\text{,}\) …, \(3 \times 13\text{,}\) and \(5 \times 7\text{.}\)

7. Understand.

Β 
  1. The only set of two distinct nonzero digits whose sum is 16 is \(\{7,9\}\text{.}\) Find all other integers \(n\) where there is exactly one set of two distinct nonzero digits whose sum is \(n\) and list the corresponding set. Hint: the smallest possible value is \(n=1+2 = 3\) and the largest possible value is \(n =8+9=17\text{.}\)
  2. Give an example of a number \(m\) where there is exactly one set of three distinct nonzero digits where the sum of the digits is \(m\text{.}\) Are there other examples? Can you list all possible examples?
Check.
  1. 3, 4, 16, and 17
  2. One example is \(m=6\) where the only set is \(\{1,2,3\}\text{.}\) Yes, there are others. Hint: There are four such numbers \(m\text{.}\)

9. Explore.

A Kakuro puzzle is like a crossword puzzle but with digits instead of letters. The clues are written within the puzzle. The number in an upper triangle tells you the sum of the digits in the row to the right of the clue, and the number in a lower triangle tells you the sum of the digits in the column below the clue. Each box can be filled in with any digit from 1 to 9, except that no digit is repeated within an answer.
  1. Play Kakuro Conquest and take a screenshot of your solution to the largest puzzle that you can solve. Try to figure out what each cell must be without any guessing and don’t overuse the β€œCHECK” feature.
  2. Play Kakuro Number Puzzle Game and take a screenshot of your solution to the puzzle of the highest difficulty that you can solve. Try to figure out what each cell must be without any guessing. The β€œNotes On” option allows you to list the possibilities for each cell. Click on β€œNotes On” again to go back to enter your guesses.

10. Explore.

This exercise is based on the Kakuro puzzle introduced in Exercise 9. We use the shorthand clue β€œn-in-k” to mean a set of \(k\) digits 1-9 without repeats whose sum is \(n\text{.}\) For example, β€œ20-in-3” could be
\begin{equation*} \{3, 8, 9\}, \{4, 7, 9\}, \{5, 6, 9\}, \text{ or } \{5,7,8\}\text{.} \end{equation*}
We cannot use that \(8 + 8 + 4 = 20\) because \(8\) would repeat. In the actual puzzle, the digits would be filled in the cells in some order, such as 479 or 947.
A kakuro is a clue having only one possible set. For example, β€œ17-in-2” is a kakuro because the only set is \(\{8,9\}\) while β€œ20-in-3” is not a kakuro because there were four possible sets. Kakuros are very helpful for solving Kakuro puzzles. We found kakuros of the form \(n\)-in-2 and \(n\)-in-3 in Exercise 7.
  1. What is the only digit that the kakuros β€œ3-in-2” and β€œ4-in-2” have in common?
  2. What is the only digit that the kakuros β€œ15-in-5” and β€œ29-in-4” have in common?
  3. List all kakuros of the form β€œ\(n\)-in-4.”
  4. List all kakuros of the form β€œ\(n\)-in-8.” Hint: what is \(1+2+3+4+5+6+7+8+9\text{?}\)

Subsubsection Exercises for 2.1.C Strings

11. Practice.

Β 
  1. Calculate the length of the string \(\str{8fG\#tt8}\text{.}\)
  2. Are there special characters in the string \(\str{8fG\#tt8}\text{?}\) Explain.
  3. How many times does the digit \(\str{8}\) appear in the string \(\str{8fG\#tt8}\text{?}\)
  4. How many times does the letter \(\str{g}\) appear in the string \(\str{8fG\#tt8}\text{?}\) Be careful.
Check.
  1. Seven
  2. Yes, #
  3. Zero. Note that \(\str{G}\) is different from \(\str{g}\text{.}\)

12. Practice.

Β 
  1. Look back at the tree you drew in ActivityΒ 2.1.C (b). Conjecture the number of strings of length four where each character is \(\str{a}\text{,}\) \(\str{b}\text{,}\) \(\str{c}\text{,}\) or \(\str{d}\) and repetition is not allowed.
  2. Use a possibility tree to list all strings of length four where each character is \(\str{a}\text{,}\) \(\str{b}\text{,}\) \(\str{c}\text{,}\) or \(\str{d}\) and repetition is not allowed. Do not forget to state the final list.
  3. How many strings are in your list in part 12.(b)? Compare your answer to your conjecture.
Check.
  1. Hint: The first branches go to \(\str{a}\text{,}\) \(\str{b}\text{,}\) \(\str{c}\text{,}\) and \(\str{d}\text{,}\) but after that the list narrows. For example, from \(\str{a}\text{,}\) there are branches only to \(\str{b}\text{,}\) \(\str{c}\text{,}\) and \(\str{d}\text{.}\)
  2. Hint: You should get 24 again.

13. Understand.

Β  Use a possibility tree to list all strings of length three where each character is \(\str{a}\text{,}\) \(\str{b}\text{,}\) or \(\str{c}\) if repetition is allowed, but not consecutively. For example, \(\str{aba}\) is allowed but \(\str{baa}\) is not. Do not forget to state the final list.
Check.
Hint: the list begins \(\str{aba}\text{,}\) \(\str{abc}\text{,}\) \(\str{aca}\text{,}\) \(\str{acb}\text{,}\) …, \(\str{cbc}\text{.}\) There are 12 possible strings.

14. Understand.

There are four tasks on my to-do list: laundry (L), cleaning (C), grocery shopping (G), and exercise (E). I plan to complete two of the four tasks today. Use a possibility tree to list all possible ordered list of tasks in each situation.
  1. I do one task this morning and then a different task this afternoon.
  2. I do laundry or clean in the morning and then have a different task in the afternoon.
  3. I do one task this morning and then a different task this afternoon, but I refuse to do laundry and cleaning on the same day.
Check.
  1. Hint: The possible to-do lists are: LC, LG, LE, CL, CG, CE, GL, GC, GE, EL, EC, EG, where the first letter represents the morning chore and the second letter represents the afternoon chore.
  2. Hint: only keep the to-do lists that start with L or C.
  3. Hint: Keep all possible to-do lists except for LC and CL.

16. Recap.

Do you know …
  1. What is the distinction between a set and a string?
  2. Whether \(\str{y}\) and \(\str{Y}\) are considered the same character?
  3. How to calculate the length of a string or construct a string of a given length?
  4. How to create an organized list using alphabetical or numerical order?
  5. How to create an organized list by considering cases?
  6. How to draw a possibility tree and how to use a possibility tree to create an organized list?

17. Explore.

A permutation of the set \(\{\str{1},\str{2},\str{3},\str{4}\}\) is a string of length four using each of the digits \(\bs{1}\text{,}\) \(\str{2}\text{,}\) \(\str{3}\text{,}\) and \(\str{4}\) exactly once.
  1. Use a possibility tree to list all permutations of the set \(\{\str{1},\str{2},\str{3},\str{4}\}\) starting with \(\bs{1}\text{.}\)
  2. Use a possibility tree to list all permutations of the set \(\{\str{1},\str{2},\str{3},\str{4}\}\) starting with \(\str{2}\text{.}\)
  3. Based on your answer to the previous parts, make a conjecture about the total number of permutations of the set \(\{\str{1},\str{2},\str{3},\str{4}\}\text{.}\) Explain your reasoning using cases.
Check.
  1. Hint: Your tree should produce the list \(\str{1234}\text{,}\) \(\str{1243}\text{,}\) \(\str{1324}\text{,}\) \(\str{1342}\text{,}\) \(\str{1423}\text{,}\) \(\str{1432}\text{.}\)
  2. Hint: You should again get six permutations.
  3. Hint: Use case 1: starts with \(\bs{1}\text{,}\) case 2: starts with \(\str{2}\text{,}\) case 3: starts with \(\str{3}\text{,}\) and case 4: starts with \(\str{4}\text{.}\) There are six permutations in each case.

18. Explore.

In each part, use a possibility tree to list the permutations of \(\{\str{1},\str{2},\str{3},\str{4}\}\) meeting the given condition.
  1. The first first two characters are odd (\(\bs{1}\) or \(\str{3}\)) and the second two characters are even (\(\str{2}\) or \(\str{4}\)). For example, we might have the string \(\str{1342}\text{.}\)
  2. The \(\bs{1}\) appears before \(\str{2}\) and \(\str{3}\) appears before \(\str{4}\text{.}\) For example, we might have the string \(\str{3142}\text{.}\)
  3. There is only one decrease, meaning that there is only one place in the permutation of the set where a digit is followed by a smaller digit. For example, \(\str{1324}\) is allowed because \(\str{32}\) is the only decrease, but \(\str{3142}\) is not allowed because both \(\str{31}\) and \(\str{42}\) are decreases.
Check.
  1. Hint: The first branches go to \(\bs{1}\) and \(\str{3}\text{.}\) From \(\bs{1}\) there is a single branch to \(\str{3}\) and vice versa. Next, there is a branch from each endpoint to \(\str{2}\) and \(\str{4}\text{.}\) Lastly, from each \(\str{2}\) there is a single branch to \(\str{4}\) and vice versa. In all, there are four such permutations.
  2. Hint: The permutation must begin with \(\bs{1}\) or \(\str{3}\text{.}\) There are three such permutations in each case.
  3. Hint: Consider cases. Case 1: The decrease happens from first to second digits. There are three such strings: \(\str{2134}\text{,}\) \(\str{3124}\text{,}\) and \(\str{4123}\text{.}\) Case 2: The decrease happens from second to third digit. There are five such strings (list them). Case 3: The decrease happens from third to fourth digit. There are three such strings (list them).

Subsubsection Exercises for 2.1.D Integer Algebra

22. Explore.

The square of the integer \(n\) is
\begin{equation*} n^2 = n \times n \end{equation*}
  1. Use this definition to calculate \(3^2\text{.}\)
  2. Simplify \(k \times k\text{.}\)
  3. Simplify \(2k \times 3k\text{.}\) Hint: first, use the associative property to write the product as \((2 \times 3) \times (k \times k)\text{.}\)
  4. Expand \(n(2n-1)\text{.}\)
  5. Factor \(3n^2+9\text{.}\)
  6. Factor \(3n^2+2n\text{.}\)
  7. Factor \(k^2 - k\text{.}\)
Check.
  1. \(\displaystyle k^2\)
  2. Hint: See the hint.
  3. Hint: The answer begins with \(2n^2\text{.}\)
  4. Hint: Factor out the three.
  5. Hint: Factor out \(n\text{.}\)
  6. \(\displaystyle k(k-1)\)