\(\newcommand{\newpara}{}
\newcommand{\nats}{\mathbb{N}}
\newcommand{\subcountawry}{\bf{When\ Counting\ Goes\ Awry}}
\newcommand{\seccountingstepscases}{\bf{Counting\ with\ Steps\ and\ Cases}}
\newcommand{\subalgfac}{\bf{Algebra:\ Factorials}}
\newcommand{\seccountingsubsets}{\bf{Counting\ Subsets}}
\newcommand{\secbitstrings}{\bf{Counting\ Bit\ Strings}}
\newcommand{\subhs}{Counting Handshakes}
\newcommand{\circled}[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\newcommand{\xcircle}[1]{\circled{#1}}
\newcommand{\subdiscrete}{What is Discrete Mathematics?}
\newcommand{\sublearning}{Learning Discrete Mathematics}
\newcommand{\exerR}{Recap}
\newcommand{\subcountingawry}{When Counting Goes Awry}
\newcommand{\exerP}{Practice}
\newcommand{\subfactorials}{Algebra: Factorials}
\newcommand{\exerU}{Understand}
\newcommand{\subsubsetschoose}{Subsets and the Binomial Coefficients}
\newcommand{\exerE}{Explore}
\newcommand{\subcombinecount}{Combining Counting Techniques}
\newcommand{\subproofscountnosums}{Proof Format: Combinatorial Proof}
\newcommand{\subbitstrings}{Bit Strings}
\newcommand{\subcountbitstrings}{Number of Bit Strings}
\newcommand{\subrephrasingsubset}{Detour: Rephrasing the Question}
\newcommand{\subexplog}{Algebra: Exponential Notation and Logarithms}
\newcommand{\subbridges}{Crossing Bridges}
\newcommand{\subdefngraph}{The Definition of a Graph}
\newcommand{\subgraphcomp}{Graph Complements}
\newcommand{\subdegseq}{Degree Sequences}
\newcommand{\substdgraphs}{Standard Graphs}
\newcommand{\subadjmat}{The Adjacency Matrix of a Graph}
\newcommand{\subcolormaps}{Coloring Maps}
\newcommand{\subchromatic}{Coloring Graphs}
\newcommand{\subgraphconj}{Graph Conjectures}
\newcommand{\subplanarity}{Planarity}
\newcommand{\subisograph}{Isomorphic Graphs}
\newcommand{\subgraphtrees}{Subgraphs and Trees}
\newcommand{\subnonisograph}{Nonisomorphic Graphs}
\newcommand{\subgraphclassification}{Graph Classification}
\newcommand{\subrobots}{Detour: Robots}
\newcommand{\sublockers}{Opening and Closing Lockers}
\newcommand{\subevenodd}{Even and Odd Integers}
\newcommand{\subdivides}{Divisibility}
\newcommand{\subfractions}{Algebra: Equivalent Fractions}
\newcommand{\subdivalg}{The Division Algorithm, \fn{div}, and \fn{mod}}
\newcommand{\subpolys}{Algebra: Polynomials}
\newcommand{\subpffcases}{Proof Format: Proof by Cases}
\newcommand{\subnotlast}{Not Last Game}
\newcommand{\submod}{The Mod Clock}
\newcommand{\subzn}{The Integers mod $n$}
\newcommand{\subprimes}{Primes and Composites}
\newcommand{\subprimefact}{Prime Factorization}
\newcommand{\subcountdiv}{Detour: Listing and Counting Divisors}
\newcommand{\subgcd}{Greatest Common Divisor}
\newcommand{\subea}{The Euclidean Algorithm}
\newcommand{\subcoprime}{Coprime Integers}
\newcommand{\subandor}{And and Or}
\newcommand{\subpffandor}{Proof Formats: $\land$ and $\lor$ by Cases}
\newcommand{\subequivneg}{Logical Equivalence and Negations}
\newcommand{\subpffcontra}{Proof Format: Contradiction}
\newcommand{\subsetgame}{The Game SET}
\newcommand{\subquant}{Quantifiers}
\newcommand{\subpffquants}{Proof Formats: $\forall$ and $\exists$}
\newcommand{\subcex}{Negating Quantified Statements and Counterexamples}
\newcommand{\subifthen}{Promises: Conditional Statements}
\newcommand{\subpffifthen}{Proof Format: Direct Proof of $\to$}
\newcommand{\subnegcond}{Broken Promises: Negating Conditional Statements}
\newcommand{\subpfforimplication}{Proof Formats: Proof of $\lor$ Using Implication}
\newcommand{\subconv}{The Converse and Biconditional Statements}
\newcommand{\subpffiff}{Proof Format: $\leftrightarrow$}
\newcommand{\subcp}{The Contrapositive}
\newcommand{\subpffcp}{Proof Format: $\to$ Using the Contrapositive}
\newcommand{\subequiv}{Logical Equivalence}
\newcommand{\subneg}{Simplifying Negations}
\newcommand{\subinference}{Logical Inference}
\newcommand{\subinfsetsnumbers}{Infinite sets of numbers}
\newcommand{\subdefnfnnotation}{Function Notation and Vocabulary}
\newcommand{\subpiecewise}{Piecewise-defined Functions}
\newcommand{\subfndotgraphs}{Dot Diagrams and Graphs of Functions}
\newcommand{\subfloorceiling}{Floor and Ceiling}
\newcommand{\subnumberfn}{Number-theoretic Functions}
\newcommand{\subfngraphs}{Graph-theoretic Functions}
\newcommand{\subbitstringfunctions}{Functions Involving Bit Strings}
\newcommand{\suborderedpair}{Ordered Pairs and the Definition of Function}
\newcommand{\subpairing}{Pairings}
\newcommand{\subonetooneonto}{One-to-one and Onto}
\newcommand{\subperms}{Permutations}
\newcommand{\subinverses}{Inverse Functions}
\newcommand{\subpffunique}{Proof Format: Uniqueness}
\newcommand{\subdefnseq}{The Definition of Sequence}
\newcommand{\submodelseq}{Modeling with Explicitly-defined Sequences}
\newcommand{\subseqprimes}{Detour: Sequences Involving Primes}
\newcommand{\subelements}{Elements of a Set}
\newcommand{\subsetbuild}{Set-Builder Notation}
\newcommand{\subsetops}{Set Operations}
\newcommand{\subsubsets}{Subsets of a Set}
\newcommand{\subbsrepsubset}{Bit String Representation of Subsets}
\newcommand{\subsetsofsets}{Sets of Sets}
\newcommand{\subsetfn}{Detour: Set-theoretic Functions}
\newcommand{\subdefnpartition}{The Definition of Partition}
\newcommand{\subselfconj}{Conjugate Partitions}
\newcommand{\subbulgsol}{Collecting Coins}
\newcommand{\subcartprod}{The Cartesian Product of Sets}
\newcommand{\subfncartprod}{Functions Involving Cartesian Products}
\newcommand{\subdefnrelation}{Relations and Their Representations}
\newcommand{\subrelppty}{Properties of Relations}
\newcommand{\subequivclass}{Equivalence Relations and Equivalence Classes}
\newcommand{\subcongmod}{Congruence mod $n$}
\newcommand{\subhanoi}{The Towers of Hanoi}
\newcommand{\subrecdefseq}{Recursively-defined Sequences}
\newcommand{\subntr}{Modeling with Recursively-defined Sequences}
\newcommand{\subpffmathind}{Proof Format: Mathematical Induction}
\newcommand{\subalgind}{Algebra: Evaluating $f(n-1)$}
\newcommand{\subpffindseq}{Proof Format: Special Case of Mathematical Induction for Proving an Explicit Rule for a Recursively-defined Sequence}
\newcommand{\submatpowers}{Matrix Products and Powers}
\newcommand{\subpffindmatrix}{Proof Format: Special Case of Mathematical Induction for Proving an Explicit Formula for the Power of a Matrix}
\newcommand{\subgroups}{Finite Groups}
\newcommand{\subproperbs}{Proper Bit Strings}
\newcommand{\subrecsets}{Recursively-defined Sets}
\newcommand{\subrecgraphs}{Recursively-defined Graphs}
\newcommand{\subfib}{The Fibonacci Sequence and Higher Order Recursions}
\newcommand{\submodelhigher}{Modeling with Higher Order Recursions}
\newcommand{\subfibpatterns}{Detour: Fibonacci Patterns and Proof}
\newcommand{\subpffstrongind}{Proof Format: Strong Mathematical Induction}
\newcommand{\subhowmanysq}{Counting Squares}
\newcommand{\subfactrep}{Factorial Representations}
\newcommand{\subsigmapi}{Sum and Product Notation}
\newcommand{\subbaseb}{Base $b$ Representation}
\newcommand{\subbinary}{Binary Representation}
\newcommand{\subhex}{Hexadecimal Representation}
\newcommand{\subhexforbinary}{Hex as a Shorthand for Binary}
\newcommand{\subsumconj}{Sum Conjectures}
\newcommand{\subprodconj}{Product Conjectures}
\newcommand{\subsumfib}{Detour: Fibonacci Sums}
\newcommand{\subfactorpolys}{Algebra: Factoring Polynomials}
\newcommand{\subarithtri}{The Arithmetic Triangle}
\newcommand{\subpascalpatterns}{Patterns in the Arithmetic Triangle}
\newcommand{\subbinomthm}{The Binomial Theorem}
\newcommand{\subfactorialbinom}{Explicit Formula for Binomial Coefficients}
\newcommand{\subpffsumproofsind}{Proof Format: Special Case of Mathematical Induction for Proving Sum and Product Formulas}
\newcommand{\subpffcombsums}{Proof Format: Combinatorial Proof of Sums}
\newcommand{\subspecialsum}{Detour: Special Sums}
\newcommand{\subfracalg}{Algebra: Fraction Arithmetic}
\newcommand{\subhotelinf}{Hotel Infinity}
\newcommand{\subdefndiscrete}{The Definition of Discrete}
\newcommand{\seclisting}{Organized Listing}
\newcommand{\vocab}{\textbf}
\newcommand{\str}{\texttt}
\newcommand{\fn}{\texttt}
\newcommand{\bs}{\texttt}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section4.3Excursion: Modular Arithmetic
Many applications of number theory use a new number system based on remainders (\(\fn{mod}\)), which we introduce in this section.
In this puzzle, we introduce a game. To play the game, you will need an opponent (another person) and a pile of small objects such as coins, poker chips, candies, dried beans, etc.
The Not Last game starts with a pile of coins and two players, A and B. Player A removes one or two coins, their choice. Then player B removes one or two coins, their choice. Then A goes again and then B. They continue alternating until all the coins have been removed. At each turn each player must remove one or two coins. Whoever takes the last coin loses (misΓ¨re) and, thus, each playerβs goal is to be βnot lastβ.
For example, suppose the game begins with a pile of seven coins. I, as the first player (A), remove two coins leaving a pile of five coins. My opponent (B) decides to remove only one coin, thus leaving a pile of four. I remove one more coin, leaving a pile of three. My opponent chuckles as she removes two coins, leaving me to remove the last coin. I lose.
I wonder if there is a different strategy where I could win with seven coins. In general, for a pile of \(n\) coins, is there a strategy by which the first player (A) can definitely win? We assume, as is the custom, that both players are fully knowledgeable about the game, equally clever, and driven to win.
Play four rounds of Not Last with seven coins to get a sense of the game and list the diagram for each.
When \(n=4\text{,}\) there is no strategy A can use to win. Draw diagrams for each option (A takes one coin or A takes two coins) showing that B wins in either case.
Before we try larger values of \(n\text{,}\) it is helpful to shift our perspective slightly. As we play the game with \(n\) coins, suppose there are eventually \(k\) coins left. For the purpose of this puzzle, \(k\) is a losing position if the player who goes next eventually loses and \(k\) is a winning position if the player who goes next eventually wins. Explain why \(k=1\) is a losing position, but \(k=2\) and \(k=3\) are winning positions.
Letβs revisit the 4-coin game with this new perspective. If A takes one coin, then \(k=3\) which is a winning position and B goes next, so B wins. If A takes two coins instead, then \(k=2\) which is also a position number and B goes next, so B wins. We can draw the simpler diagram, using the \(\implies\) arrow to indicate a set of moves with known outcome.
\begin{equation*}
4 \xrightarrow{A-1} 3 \implies \text{ B wins } \ \ \text{ OR } 4 \xrightarrow{A-2} 2 \implies \text{ B wins }\text{.}
\end{equation*}
We have just learned that \(k=4\) is a losing position. Find a strategy by which A wins when \(n = 5\text{.}\) Explain and draw the diagram. Hint: How can A leave B in a losing position?
When \(n = 6\text{,}\) is there a strategy by which A wins? Explain and draw the diagram. Remember, A is trying to leave B in a losing position, and vice versa.
Make a table showing \(n=1,2,3,\ldots, 10\) in the top row and the winner (A or B) for each starting number of \(n\) coins in the bottom row. Be sure you check that the answer is correct for yourself, but you are not expected to explain your reasoning here.
To find \(a\)\(\fn{mod}\)\(n\) when \(n \ge 1\text{,}\) imagine an \(n\) hour βclockβ with hours marked \(0, 1, 2, \ldots, n-1\) hours. To find the value of \(a\)\(\bs{mod}\)\(n\) when \(a\) is positive, we count \(a\) hours clockwise from \(0\text{.}\) For example, the \(\bs{mod}\) 12 is shown in FigureΒ 4.3.3 and the \(mod\) 5 clock is shown in FigureΒ 4.3.3 The end mark is \(a\)\(\bs{mod}\)\(n\text{.}\) When \(a\) is negative, we instead count counterclockwise.
Example4.3.5Evaluating \(\fn{mod}\) using the Mod Clock.
Β
Use the 12-hour clock (marked \(0,1, \ldots, 11\) instead of the usual \(1,2, \ldots 12\)) shown in FigureΒ 4.3.3 to calculate 20 \(\fn{mod}\) 12.
Solution.
Use the 5-hour clock shown in FigureΒ 4.3.4 to calculate 67 \(\fn{mod}\) 5.
Solution.
Instead of counting off 67 hours, note that 50 hours will take us around the clock 10 times, ending at 0. That leaves us \(67-50-17\) hours to count from there. Note that \(15 = 3 \times 5\text{,}\) so 15 hours will take us around the clock 3 times, ending at 0. That leaves us \(17-15 = 2\) hours to count from there, which ends at 2. Thus, 67 \(\fn{mod}\) 5 = 2.
True or false? If \(a \otimes b = 0\) in \(\mathbb{Z}_4\text{,}\) then \(a = 0\) or \(b = 0\text{.}\)Solution.
The question is asking if there are any 0s in the multiplication table other than in the row and column headed by 0. It turns out there are and so this statement is false. As a counterexample, \(2 \neq 0\text{,}\) but \(2 \otimes 2 = 4~\fn{mod}~4= 0\) in \(\mathbb{Z}_4\text{.}\)
For which values of \(a \in \mathbb{Z}_{4}\text{,}\) does \(a \otimes x = 1\) have a solution?
Solution.
The question is asking which rows in the multiplication table have a one in them? The rows headed by 1 and 3 each have a 1 because \(1 \otimes 1 = 1\) and also \(3 \otimes 3 = 1\text{.}\) The answer is \(a = 1, 3\text{.}\) (It is coincidence that the corresponding solutions are \(x=1, 3\text{.}\))
Write the addition and multiplication tables for \(\mathbb{Z}_5\) and \(\mathbb{Z}_6\text{.}\) Hint: If you are working with a partner, then one of you should do \(\mathbb{Z}_5\) while the other does \(\mathbb{Z}_6\text{,}\) just check each otherβs work. We need these tables for later parts of this activity.
This exercise refers to the Not Last game introduced in ActivityΒ 4.3.A. We know that one and four are losing positions, whereas two and three are winning positions.
Suppose that you are in a winning position \(n\) while playing the Not Last game introduced in ActivityΒ 4.3.A. What is your strategy for deciding whether to take one or two coins? Be specific. Hint: Your answer should involve \(n\) and use \(\fn{mod}\text{.}\)
In this exercise we define a new game, Half, which starts with a pile of coins and two players, A and B. Player A goes first and then A and B take turns removing coins from the pile. The rule is that at each turn, a player must remove at least one coin and at most half of the coins, with the exception that if there is one coin left, then they must take it. For example, if there are six or seven coins, the next player can take one, two, or three coins. As in the Not Last game, whoever takes the last coin loses the Half game.
Who wins the Half game when \(n=1,2,3\text{,}\) the first player (A) or the second player (B)? Explain.
Suppose that you are in a winning position \(n\) while playing Half. What is your strategy for deciding how many coins to take? Hint: your answer should involve \(n\text{.}\)
In each part of this exercise, draw the relevant mod clock and show how to use it to evaluate the quantity. Recall that we rotate clockwise for positive integers.
23 \(\fn{mod}\) 5. Hint: Copy the mod 5 clock from FigureΒ 4.3.4.
In each part of this exercise, draw the relevant mod clock and show how to use it to evaluate the quantity. Recall that we rotate counterclockwise for negative integers.
Use the idea of a mod \(n\) clock to explain why \(-1\)\(\fn{mod}\)\(n=n-1\) and \(-2\)\(\fn{mod}\)\(n=n-2\text{.}\) Hint: The mod \(n\) clock has labels \(0,1,2,\ldots,n-1\text{.}\)
Solve \(3 \otimes x \oplus 1 = 3\) in \(\mathbb{Z}_5\text{.}\) Note that the usual order of operations applies, so this equation means \((3 \otimes x) \oplus 1 = 3\)
For which values of \(a \in \mathbb{Z}_{10}\text{,}\) does \(a \otimes x = 1\) have a solution? You should be able to answer without writing the multiplication table.
For which values of \(a \in \mathbb{Z}_8\text{,}\) does \(a \otimes x = 1\) have a solution? You should be able to answer without writing the multiplication table.
In \(\mathbb{Z}_n\text{,}\) we write \(2^k=\underbrace{2 \otimes 2 \otimes 2 \otimes \cdots \otimes 2}_{k \text{ times } }\text{.}\) On this exercise, you are welcome to use computational technology.
In \(\mathbb{Z}_5\text{,}\) calculate \(2^1\text{,}\)\(2^2\text{,}\)\(2^3\text{,}\)\(2^4\text{,}\)\(2^5\text{,}\)\(2^6\text{,}\)\(2^7\text{,}\) and \(2^8\text{.}\)
In \(\mathbb{Z}_6\text{,}\) calculate \(2^1\text{,}\)\(2^2\text{,}\)\(2^3\text{,}\)\(2^4\text{,}\)\(2^5\text{,}\)\(2^6\text{,}\)\(2^7\text{,}\) and \(2^8\text{.}\)
Β An element \(a\) of \(\mathbb{Z}_n\) is a zero divisor if \(a \neq 0\) but there is an element \(b\) of \(\mathbb{Z}_n\) with \(b \neq 0\) also, and yet \(ab = 0\text{.}\) That is, if there is more than one 0 in the row for \(a\) in the multiplication table for \(\mathbb{Z}_n\text{.}\) Exercise 13 asked for an example of a zero divisor in \(\mathbb{Z}_{10}\) and asked whether there were zero divisors in \(\mathbb{Z}_5\text{.}\) Conjecture which integers \(n\) have the property that \(\mathbb{Z}_n\) has zero divisors and which integers \(n\) have the property that \(\mathbb{Z}_n\) does not have zero divisors.