Skip to main content

Section 7.4 Modular Arithmetic

Beginning Activity Beginning Activity 1: Congruence Modulo 6

For this activity, we will only use the relation of congruence modulo 6 on the set of integers.

1.

Find five different integers \(a\) such that \(a \equiv 3 \pmod 6\) and find five different integers \(b\) such that \(b \equiv 4 \pmod 6\text{.}\) That is, find five different integers in \([3]\text{,}\) the congruence class of 3 modulo 6 and five different integers in \([4]\text{,}\) the congruence class of 4 modulo 6.

2.

Calculate \(s = a + b\) using several values of \(a\) in \([3]\) and several values of \(b\) in \([4]\) from Exercise 1. For each sum \(s\) that is calculated, find \(r\) so that \(0 \leq r \lt 6\) and \(s \equiv r \pmod 6\text{.}\) What do you observe?

3.

Calculate \(p = a \cdot b\) using several values of \(a\) in \([3]\) and several values of \(b\) in \([4]\) from Exercise 1. For each product \(p\) that is calculated, find \(r\) so that \(0 \leq r \lt 6\) and \(p \equiv r \pmod 6\text{.}\) What do you observe?

4.

Calculate \(q = a^2\) using several values of \(a\) in \([3]\) from Exercise 1. For each product \(q\) that is calculated, find \(r\) so that \(0 \leq r \lt 6\) and \(q \equiv r \pmod 6\text{.}\) What do you observe?

Beginning Activity Beginning Activity 2: The Remainder When Dividing by 9

If \(a\) and \(b\) are integers with \(b > 0\text{,}\) then from the Division Algorithm, we know that there exist unique integers \(q\) and \(r\) such that

\begin{equation*} a = bq + r \text{ and } 0 \leq r \lt b\text{.} \end{equation*}

In this activity, we are interested in the remainder \(r\text{.}\) Notice that \(r = a - bq\text{.}\) So, given \(a\) and \(b\text{,}\) if we can calculate \(q\text{,}\) then we can calculate \(r\text{.}\)

We can use the “int” function on a calculator to calculate \(q\text{.}\) [The “int” function is the “greatest integer function.” If \(x\) is a real number, then \(\operatorname{int}( x )\) is the greatest integer that is less than or equal to \(x\text{.}\)]

So, in the context of the Division Algorithm, \(q = \operatorname{int} \!\left( {\dfrac{a}{b}} \right)\text{.}\) Consequently,

\begin{equation*} r = a - b \cdot \operatorname{int} \!\left( {\frac{a}{b}} \right)\text{.} \end{equation*}

If \(n\) is a positive integer, we will let \(s\left( n \right)\) denote the sum of the digits of \(n\text{.}\) For example, if \(n = 731\text{,}\) then

\begin{equation*} s( {731} ) = 7 + 3 + 1 = 11\text{.} \end{equation*}

For each of the following values of \(n\text{,}\) calculate

  • The remainder when \(n\) is divided by 9, and

  • The value of \(s( n )\) and the remainder when \(s( n )\) is divided by 9.

1.

\(n=498\)

2.

\(n=7319\)

3.

\(n=4672\)

4.

\(n=9845\)

5.

\(n=51381\)

6.

\(n=305877\)

What do you observe?

Subsection The Integers Modulo \(\boldsymbol{n}\)

Let \(n \in \mathbb{N}\text{.}\) Since the relation of congruence modulo \(n\) is an equivalence relation on \(\mathbb{Z}\text{,}\) we can discuss its equivalence classes. Recall that in this situation, we refer to the equivalence classes as congruence classes.

Definition.

Let \(n \in \mathbb{N}\text{.}\) The set of congruence classes for the relation of congruence modulo \(n\) on \(\mathbb{Z}\) is the set of integers modulo \(\boldsymbol{n}\), or the set of integers mod \(n\text{.}\) We will denote this set of congruence classes by \(\mathbb{Z}_{n}\text{.}\)

Corollary 7.21 tells us that

\begin{equation*} \mathbb{Z} = [ 0 ] \cup [ 1 ] \cup [ 2 ] \cup \cdots \cup [ {n - 1} ]\text{.} \end{equation*}

In addition, we know that each integer is congruent to precisely one of the integers \(0, 1, 2, \ldots , n - 1\text{.}\) This tells us that one way to represent \(\mathbb{Z}_{n}\) is

\begin{equation*} \mathbb{Z}_{n} = \left\{ {[ 0 ], [ 1 ], [ 2 ], \ldots, [ {n - 1} ]} \right\}\text{.} \end{equation*}

Consequently, even though each integer has a congruence class, the set \(\mathbb{Z}_{n}\) has only \(n\) distinct congruence classes.

The set of integers \(\Z\) is more than a set. We can add and multiply integers. That is, there are the arithmetic operations of addition and multiplication on the set \(\Z\text{,}\) and we know that \(\Z\) is closed with respect to these two operations.

One of the basic problems dealt with in modern algebra is to determine if the arithmetic operations on one set “transfer” to a related set. In this case, the related set is \(\mathbb{Z}_{n}\text{.}\) For example, in the integers modulo 5, \(\Z_5\text{,}\) is it possible to add the congruence classes \([ 4 ]\) and \([ 2 ]\) as follows?

\begin{align*} \oplus [ 2 ] \amp = [ {4 + 2} ]\\ \amp = [ 6 ]\\ \amp = [ 1 ]\text{.} \end{align*}

We have used the symbol \(\oplus\) to denote addition in \(\mathbb{Z}_{5}\) so that we do not confuse it with addition in \(\mathbb{Z}\text{.}\) This looks simple enough, but there is a problem. The congruence classes \([ 4 ]\) and \([ 2 ]\) are not numbers, they are infinite sets. We have to make sure that we get the same answer no matter what element of \([ 4 ]\) we use and no matter what element of \([ 2 ]\) we use. For example,

\begin{align*} 9 \amp \equiv 4 \pmod 5 \amp \amp \text{ and so } \amp \amp [ 9 ] = [ 4 ]. \text{ Also, }\\ 7 \amp \equiv 2 \pmod 5 \amp \amp \text{ and so } \amp \amp [ 7 ] = [ 2 ]\text{.} \end{align*}

Do we get the same result if we add \([ 9 ]\) and \([ 7 ]\) in the way we did when we added \([ 4 ]\) and \([ 2 ]\text{?}\) The following computation confirms that we do:

\begin{align*} \oplus [ 7 ] \amp = [ {9 + 7} ]\\ \amp = [ {16} ]\\ \amp = [ 1 ]\text{.} \end{align*}

This is one of the ideas that was explored in Beginning Activity 1. The main difference is that in this activity, we used the relation of congruence, and here we are using congruence classes. All of the examples in Beginning Activity 1 should have illustrated the properties of congruence modulo 6 in the following table. The left side shows the properties in terms of the congruence relation and the right side shows the properties in terms of the congruence classes.

If \(a \equiv 3 \pmod 6\) and \(b \equiv 4 \pmod 6\text{,}\) then

  • \(\left( {a + b} \right) \equiv \left( {3 + 4} \right) \pmod 6\text{;}\)

  • \(\left( {a \cdot b} \right) \equiv \left( {3 \cdot 4} \right) \pmod 6\text{.}\)

If \([ a ] = [ 3 ]\) and \([ b ] = [ 4 ]\) in \(\Z_6\text{,}\) then

  • \([ {a + b} ] = [ {3 + 4} ]\text{;}\)

  • \([ {a \cdot b} ] = [ {3 \cdot 4} ]\text{.}\)

These are illustrations of general properties that we have already proved in Theorem 3.34. We repeat the statement of the theorem here because it is so important for defining the operations of addition and multiplication in \(\mathbb{Z}_{n}\text{.}\)

Theorem 3.34 Restated.

Let \(n\) be a natural number and let \(a, b, c, \text{ and } d\) be integers. Then

  1. If \(a \equiv b \pmod n\) and \(c \equiv d \pmod n\text{,}\) then \(\left( {a + c} \right) \equiv \left( {b + d} \right) \pmod n\text{.}\)

  2. If \(a \equiv b \pmod n\) and \(c \equiv d \pmod n\text{,}\) then \(ac \equiv bd \pmod n\text{.}\)

  3. If \(a \equiv b \pmod n\) and \(m \in \mathbb{N}\text{,}\) then \(a^m \equiv b^m \pmod n\text{.}\)

Since \(x \equiv y \pmod n\) if and only if \([ x ] = [ y ]\text{,}\) we can restate the result of this Theorem 3.34 in terms of congruence classes in \(\mathbb{Z}_n\text{.}\)

Because of Corollary 7.24, we know that the following formal definition of addition and multiplication of congruence classes in \(\mathbb{Z}_{n}\) is independent of the choice of the elements we choose from each class. We say that these definitions of addition and multiplication are well defined.

Definition.

Let \(n \in \mathbb{N}\text{.}\) Addition and multiplication in \(\mathbb{Z}_n\) are defined as follows: For \([ a ], [ c ] \in \mathbb{Z}_n\text{,}\)

\begin{equation*} [ a ] \oplus [ c ] = [ {a + c} ] \text{ and } [ a ] \odot [ c ] = [ {ac} ]\text{.} \end{equation*}

The term modular arithmetic is used to refer to the operations of addition and multiplication of congruence classes in the integers modulo \(n\text{.}\)

So if \(n \in \mathbb{N}\text{,}\) then we have an addition and multiplication defined on \(\mathbb{Z}_n\text{,}\) the integers modulo \(n\text{.}\)

Always remember that for each of the equations in the definitions, the operations on the left, \(\oplus \text{ and } \odot\text{,}\) are the new operations that are being defined. The operations on the right side of the equations \(\left( + \text{ and } \cdot \right)\) are the known operations of addition and multiplication in \(\mathbb{Z}\text{.}\)

Since \(\mathbb{Z}_n\) is a finite set, it is possible to construct addition and multiplication tables for \(\mathbb{Z}_n\text{.}\) In constructing these tables, we follow the convention that all sums and products should be in the form \([ r]\text{,}\) where \(0 \leq r \lt n\text{.}\) For example, in \(\Z_3\text{,}\) we see that by the definition, \([1] \oplus [2] = [3]\text{,}\) but since \(3 \equiv 0 \pmod 3\text{,}\) we see that \([3] = [0]\) and so we write

\begin{equation*} [1] \oplus [2] = [3] = [0]\text{.} \end{equation*}

Similarly, by definition, \([2] \odot [2] = [4]\text{,}\) and in \(\Z_3\text{,}\) \([4] = [1]\text{.}\) So we write

\begin{equation*} [2] \odot [2] = [4] = [1]\text{.} \end{equation*}

The complete addition and multiplication tables for \(\Z_3\) are

\(\oplus\) \([ 0 ]\) \([ 1 ]\) \([2]\)
\([ 0 ]\) \([ 0 ]\) \([ 1 ]\) \([2]\)
\([ 1 ]\) \([ 1 ]\) \([ 2 ]\) \([0]\)
\([ 2 ]\) \([ 2 ]\) \([ 0 ]\) \([1]\)
\(\odot\) \([ 0 ]\) \([ 1 ]\) \([2]\)
\([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([0]\)
\([ 1 ]\) \([ 0 ]\) \([ 1 ]\) \([2]\)
\([ 2 ]\) \([ 0 ]\) \([ 2 ]\) \([1]\)

Progress Check 7.25. Modular Arithmetic in \(\boldsymbol{\Z_2}\text{,}\) \(\boldsymbol{\Z_5}\text{,}\) and \(\boldsymbol{\Z_6}\).

(a)

Construct addition and multiplication tables for \(\Z_2\text{,}\) the integers modulo 2.

Solution.

\(\oplus\) \([ 0 ]\) \([ 1 ]\)
\([ 0 ]\) \([ 0 ]\) \([ 1 ]\)
\([ 1 ]\) \([ 1 ]\) \([ 0 ]\)
\(\odot\) \([ 0 ]\) \([ 1 ]\)
\([ 0 ]\) \([ 0 ]\) \([ 0 ]\)
\([ 1 ]\) \([ 0 ]\) \([ 1 ]\)

(b)

Verify that the following addition and multiplication tables for \(\mathbb{Z}_5\) are correct.

\(\oplus\) \([ 0 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\) \([ 4 ]\)
\([ 0 ]\) \([ 0 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\) \([ 4 ]\)
\([ 1 ]\)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 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\)
\([ 5 ]\) \([ 5 ]\) \([ 0 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\) \([ 4 ]\)
\(\odot\) \([ 0 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\) \([ 4 ]\) \([ 5 ]\)
\([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([ 0 ]\)
\([ 1 ]\) \([ 0 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\) \([ 4 ]\) \([ 5 ]\)
\([ 2 ]\) \([ 0 ]\) \([ 2 ]\) \([ 4 ]\) \([ 0 ]\) \([ 2 ]\) \([ 4 ]\)
\([ 3 ]\) \([ 0 ]\) \([ 3 ]\) \([ 0 ]\) \([ 3 ]\) \([ 0 ]\) \([ 3 ]\)
\([ 4 ]\) \([ 0 ]\) \([ 4 ]\) \([ 2 ]\) \([ 0 ]\) \([ 4 ]\) \([ 2 ]\)
\([ 5 ]\) \([ 0 ]\) \([ 5 ]\) \([ 4 ]\) \([ 3 ]\) \([ 2 ]\) \([ 1 ]\)

(d)

In the integers, the following statement is true. We sometimes call this the zero product property for the integers.

For all \(a, b \in \Z\text{,}\) if \(a \cdot b = 0\text{,}\) then \(a = 0\) or \(b = 0\text{.}\)
Write the contrapositive of the conditional statement in this property.

Solution.

For all \(a, b \in \Z\text{,}\) if \(a \ne 0\) and \(b \ne 0\text{,}\) then \(ab \ne 0\text{.}\)

(e)

Are the following statements true or false? Justify your conclusions.

(i)

For all \([ a ], [ b ] \in \Z_5\text{,}\) if \([ a ] \odot [ b ] = [ 0 ]\text{,}\) then \([ a ] = [ 0 ]\) or \([ b ] = [ 0 ]\text{.}\)

Solution.

The statement in (i) is true.

(ii)

For all \([ a ], [ b ] \in \Z_6\text{,}\) if \([ a ] \odot [ b ] = [ 0 ]\text{,}\) then \([ a ] = [ 0 ]\) or \([ b ] = [ 0 ]\text{.}\)

Solution.

The statement in (ii) is false. For example, in \(\Z_6\text{,}\) \([ 2 ] \odot [ 3 ] = [ 0 ]\text{.}\)

Subsection Divisibility Tests

Congruence arithmetic can be used to prove certain divisibility tests. For example, you may have learned that a natural number is divisible by 9 if the sum of its digits is divisible by 9. As an easy example, note that the sum of the digits of 5823 is equal to \(5 + 8 + 2 + 3 = 18\text{,}\) and we know that 18 is divisible by 9. It can also be verified that 5823 is divisible by 9. (The quotient is 647.) We can actually generalize this property by dealing with remainders when a natural number is divided by 9.

Let \(n \in \mathbb{N}\) and let \(s( n )\) denote the sum of the digits of \(n\text{.}\) For example, if \(n = 7319\text{,}\) then \(s( {7319} ) = 7 + 3 + 1 + 9 = 20\text{.}\) In Beginning Activity 2, we saw that

\begin{equation*} 7319 \equiv 2 \pmod 9 \text{ and } 20 \equiv 2 \pmod 9\text{.} \end{equation*}

In fact, for every example in Beginning Activity 2, we saw that \(n\) and \(s( n )\) were congruent modulo 9 since they both had the same remainder when divided by 9. The concepts of congruence and congruence classes can help prove that this is always true.

We will use the case of \(n = 7319\) to illustrate the general process. We must use our standard place value system. By this, we mean that we will write \(7319\) as follows:

\begin{equation} 7319 = \left( {7 \times 10^3 } \right) + \left( {3 \times 10^2 } \right) + \left( {1 \times 10^1 } \right) + \left( 9 \times 10^0 \right)\text{.}\tag{63} \end{equation}

The idea is to now use the definition of addition and multiplication in \(\mathbb{Z}_9\) to convert equation (1) to an equation in \(\mathbb{Z}_9\text{.}\) We do this as follows:

\begin{align} \amp = [ {\left( {7 \times 10^3 } \right) + \left( {3 \times 10^2 } \right) + \left( {1 \times 10^1 } \right) + \left( 9 \times 10^0 \right)} ]\notag\\ \amp = [ {7 \times 10^3 } ] \oplus [ {3 \times 10^2 } ] \oplus [ {1 \times 10^1 } ] \oplus [ {9 \times 10^0 } ]\notag\\ \amp = \left( {[ 7 ] \odot [ {10^3 } ]} \right) \oplus \left( {[ 3 ] \odot [ {10}^2 ]} \right) \oplus \left( {[ 1 ] \odot [ 10^ 1 ]} \right) \oplus \left( [ 9 ] \odot [ 1 ] \right)\tag{64} \end{align}

Since \(10^3 \equiv 1 \pmod 9\text{,}\) \(10^2 \equiv 1 \pmod 9\) and \(10 \equiv 1 \pmod 9\text{,}\) we can conclude that \([ 10^3 ] = [ 1 ]\text{,}\) \([ {10^2 } ] = [ 1 ]\) and \([ {10} ] = [ 1 ]\text{.}\) Hence, we can use these facts and equation (64) to obtain

\begin{align} [ {7319} ] \amp =\left( {[ 7 ] \odot [ {10^3 } ]} \right) \oplus \left( {[ 3 ] \odot [ {10^2} ]} \right) \oplus \left( {[ 1 ] \odot [ 10 ]} \right) \oplus \left( [ 9 ] \odot [ 1 ] \right)\notag\\ \amp = \left( {[ 7 ] \odot [ 1 ]} \right) \oplus \left( {[ 3 ] \odot [ 1 ]} \right) \oplus \left( {[ 1 ] \odot [ 1 ]} \right) \oplus \left( [ 9 ] \odot [ 1 ] \right)\notag\\ \amp = [ 7 ] \oplus [ 3 ] \oplus [ 1 ] \oplus [ 9 ]\notag\\ \amp = [ {7 + 3 + 1 + 9} ]\tag{65} \end{align}

Equation (65) tells us that 7319 has the same remainder when divided by 9 as the sum of its digits. It is easy to check that the sum of the digits is 20 and hence has a remainder of 2. This means that when 7319 is divided by 9, the remainder is 2.

To prove that any natural number has the same remainder when divided by 9 as the sum of its digits, it is helpful to introduce notation for the decimal representation of a natural number. The notation we will use is similar to the notation for the number 7319 in equation (63).

In general, if \(n \in \mathbb{N}\text{,}\) and \(n = a_k a_{k - 1} \cdots a_1 a_0\) is the decimal representation of \(n\text{,}\) then

\begin{equation*} n = \left( {a_k \times 10^k } \right) + \left( {a_{k - 1} \times 10^{k - 1} } \right) + \cdots + \left( {a_1 \times 10^1 } \right) + \left( {a_0 \times 10^0 } \right)\!\text{.} \end{equation*}

This can also be written using summation notation as follows:

\begin{equation*} n = \sum\limits_{j = 0}^k {\left( {a_j \times 10^j } \right)}\text{.} \end{equation*}

Using congruence classes for congruence modulo 9, we have

\begin{align} \amp = [ {\left( {a_k \times 10^k } \right) + \left( {a_{k - 1} \times 10^{k - 1} } \right) + \cdots + \left( {a_1 \times 10^1 } \right) + \left( {a_0 \times 10^0 } \right)} ]\notag\\ \amp = [ {a_k \times 10^k } ] \oplus [ {a_{k - 1} \times 10^{k - 1} } ] \oplus \cdots \oplus [ {a_1 \times 10^1 } ] \oplus [ {a_0 \times 10^0 } ]\notag\\ \amp = \left( {[ {a_k } ] \odot [ {10^k } ]} \right) \oplus \left( {[ {a_{k - 1} } ] \odot [ {10^{k - 1} } ]} \right) \oplus \cdots\notag\\ \amp \hspace{5cm} \oplus \left( {[ {a_1 } ] \odot [ {10^1 } ]} \right) \oplus \left( {[ {a_0 } ] \odot [ {10^0 } ]} \right)\!\tag{66} \end{align}

One last detail is needed. It is given in Proposition 7.26. The proof by mathematical induction is Exercise 6.

If we let \(s( n )\) denote the sum of the digits of \(n\text{,}\) then

\begin{equation*} s( n ) = a_k + a_{k - 1} + \cdots + a_1 + a_0\text{,} \end{equation*}

Now using equation (66) and Proposition 7.26, we obtain

\begin{align*} [ n ] \amp = \left( {[ {a_k } ] \odot [ 1 ]} \right) \oplus \left( {[ {a_{k - 1} } ] \odot [ 1 ]} \right) \oplus \cdots \oplus \left( {[ {a_1 } ] \odot [ 1 ]} \right) \oplus \left( {[ {a_0 } ] \odot [ 1 ]} \right)\\ \amp = [ {a_k } ] \oplus [ {a_{k - 1} } ] \oplus \cdots \oplus [ {a_1 } ] \oplus [ {a_0 } ]\\ \amp = [ {a_k + a_{k - 1} + \cdots + a_1 + a_0 } ].\\ \amp = [ s( n ) ]\text{.} \end{align*}

This completes the proof of Theorem 7.27.

Item 3 of Theorem 7.27 is called a divisibility test. If gives a necessary and sufficient condition for a natural number to be divisible by 9. Other divisibility tests will be explored in the exercises. Most of these divisibility tests can be proved in a manner similar to the proof of the divisibility test for 9.

Exercises Exercises

1.

Complete the addition and multiplication tables for the following.

(a)

\(\mathbb{Z}_4\text{.}\)

Answer.

\(\oplus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([ 5 ]\) \([ 6 ]\) \([ 0 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\) \([ 4 ]\)
\([ 6 ]\) \([ 6 ]\) \([ 0 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\) \([ 4 ]\) \([ 5 ]\)

\(\odot\) \([ 0 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\) \([ 4 ]\) \([ 5 ]\) \([ 6 ]\)
\([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([ 0 ]\) \([ 0 ]\)
\([ 1 ]\) \([ 0 ]\) \([ 1 ]\) \([ 2 ]\) \([ 3 ]\) \([ 4]\) \([ 5 ]\) \([ 6 ]\)
\([ 2 ]\) \([ 0 ]\) \([ 2 ]\) \([ 4 ]\) \([ 6 ]\) \([ 1 ]\) \([ 3 ]\) \([ 5 ]\)
\([ 3 ]\) \([ 0 ]\) \([ 3 ]\) \([ 6 ]\) \([ 2 ]\) \([ 5 ]\) \([ 1 ]\) \([ 4 ]\)
\([ 4 ]\) \([ 0 ]\) \([ 4 ]\) \([ 1 ]\) \([ 5 ]\) \([ 2 ]\) \([ 6 ]\) \([ 3 ]\)
\([ 5 ]\) \([ 0 ]\) \([ 5 ]\) \([ 3 ]\) \([ 1 ]\) \([ 6 ]\) \([ 4 ]\) \([ 2 ]\)
\([ 6 ]\) \([ 0 ]\) \([ 6 ]\) \([ 5 ]\) \([ 4 ]\) \([ 3 ]\) \([ 2 ]\) \([ 1 ]\)

(c)

\(\mathbb{Z}_8\text{.}\)

2.

The set \(\mathbb{Z}_n\) contains \(n\) elements. One way to solve an equation in \(\mathbb{Z}_n\) is to substitute each of these \(n\) elements in the equation to check which ones are solutions. In \(\mathbb{Z}_n\text{,}\) when parentheses are not used, we follow the usual order of operations, which means that multiplications are done first and then additions. Solve each of the following equations:

(a)

\([ x ]^2 = [ 1 ]\) in \(\mathbb{Z}_4\)

Answer.

\([ x ] = [ 1 ]\) or \([ x ] = [ 3 ]\)

(b)

\([ x ]^2 = [ 1 ]\) in \(\mathbb{Z}_8\)

(c)

\([ x ]^4 = [ 1 ]\) in \(\mathbb{Z}_5\)

(d)

\([ x ]^2 \oplus [ 3 ] \odot [ x ] = [ 3 ]\) in \(\mathbb{Z}_6\)

(e)

\([ x ]^2 \oplus [ 1 ] = [ 0 ]\) in \(\mathbb{Z}_5\)

Answer.

\([ x ] = [ 2 ]\) or \([ x ] = [ 3 ]\)

(f)

\([ 3 ] \odot [ x ] \oplus [ 2 ] = [ 0 ]\) in \(\mathbb{Z}_5\)

(g)

\([ 3 ] \odot [ x ] \oplus [ 2 ] = [ 0 ]\) in \(\mathbb{Z}_6\)

Answer.

The equation has no solution.

(h)

\([ 3 ] \odot [ x ] \oplus [ 2 ] = [ 0 ]\) in \(\mathbb{Z}_9\)

3.

In each case, determine if the statement is true or false.

(a)

For all \([ a ] \in \mathbb{Z}_6\text{,}\) if \([ a ] \ne [ 0 ]\text{,}\) then there exists a \([ b ] \in \mathbb{Z}_6\) such that \([ a ] \odot [ b ] = [ 1 ]\text{.}\)

Answer.

The statement is false. By using the multiplication table for \(\mathbb{Z}_6\text{,}\) we see that a counterexample is \(\left[ a \right] = \left[ 2 \right]\text{.}\)

(b)

For all \([ a ] \in \mathbb{Z}_5\text{,}\) if \([ a ] \ne [ 0 ]\text{,}\) then there exists a \([ b ] \in \mathbb{Z}_5\) such that \([ a ] \odot [ b ] = [ 1 ]\text{.}\)

Answer.

The statement is true. By using the multiplication table for \(\mathbb{Z}_5\text{,}\) we see that:

\begin{align*} \left[ 1 \right] \amp \odot \left[ 1 \right] = \left[ 1 \right]. \amp \left[ 2 \right] \amp \odot \left[ 3 \right] = \left[ 1 \right]\\ \left[ 3 \right] \amp \odot \left[ 2 \right] = \left[ 1 \right]. \amp \left[ 4 \right] \amp \odot \left[ 4 \right] = \left[ 1 \right] \end{align*}

4.

In each case, determine if the statement is true or false.

(a)

For all \([ a ], [ b ] \in \mathbb{Z}_6\text{,}\) if \([ a ] \ne [ 0 ]\) and \([ b ] \ne [ 0 ]\text{,}\) then \([ a ] \odot [ b ] \ne [ 0 ]\text{.}\)

(b)

For all \([ a ], [ b ] \in \mathbb{Z}_5\text{,}\) if \([ a ] \ne [ 0 ]\) and \([ b ] \ne [ 0 ]\text{,}\) then \([ a ] \odot [ b ] \ne [ 0 ]\text{.}\)

5.

Complete the following.

(a)

Prove the following proposition:

For each \([ a ] \in \Z_5\text{,}\) if \([ a ] \ne [ 0 ]\text{,}\) then \([ a ]^2 = [ 1 ]\) or \([ a ]^2 = [ 4 ]\text{.}\)

Answer.

The proof consists of the following computations:

\begin{align*} [ 1 ]^2 \amp = [ 1 ]\\ [ 2 ]^2 \amp = [ 4 ]\\ [ 3 ]^2 \amp = [ 9 ] = [ 4 ]\\ [ 4 ]^2 \amp = [ 16 ] = [ 1 ] \end{align*}
(b)

Does there exist an integer \(a\) such that \(a^2 = 5,158,232,468,953,153\text{?}\) Use your work in Task 5.a to justify your conclusion. Compare to Exercise 11 in Section 3.5.

6.

Use mathematical induction to prove Proposition 7.26.

If \(n\) is a nonnegative integer, then \(10^n \equiv 1 \pmod 9\text{,}\) and hence for the equivalence relation of congruence modulo 9, \([ {10^n } ] = [ 1 ]\text{.}\)

7.

Use mathematical induction to prove that if \(n\) is a nonnegative integer, then \(10^n \equiv 1 \pmod 3\text{.}\) Hence, for congruence classes modulo 3, if \(n\) is a nonnegative integer, then \([ {10^n } ] = [ 1 ]\text{.}\)

8.

Let \(n \in \mathbb{N}\) and let \(s( n )\) denote the sum of the digits of \(n\text{.}\) So if we write

\begin{equation*} n = \left( {a_k \times 10^k } \right) + \left( {a_{k - 1} \times 10^{k - 1} } \right) + \cdots + \left( {a_1 \times 10^1 } \right) + \left( {a_0 \times 10^0 } \right)\text{,} \end{equation*}

then \(s( n ) = a_k + a_{k - 1} + \cdots + a_1 + a_0\text{.}\) Use the result in Exercise 7 to help prove each of the following:

(a)

\([ n ] = [ {s( n )} ]\text{,}\) using congruence classes modulo 3.

(b)

\(n \equiv s( n ) \pmod 3\text{.}\)

(c)

\(3 \mid n\) if and only if \(3 \mid s( n )\text{.}\)

9.

Use mathematical induction to prove that if \(n\) is an integer and \(n \geq 1\text{,}\) then \(10^n \equiv 0 \pmod 5\text{.}\) Hence, for congruence classes modulo 5, if \(n\) is an integer and \(n \geq 1\text{,}\) then \([ {10^n } ] = [ 0 ]\text{.}\)

10.

Let \(n \in \mathbb{N}\) and assume

\begin{equation*} n = \left( {a_k \times 10^k } \right) + \left( {a_{k - 1} \times 10^{k - 1} } \right) + \cdots + \left( {a_1 \times 10^1 } \right) + \left( {a_0 \times 10^0 } \right)\!\text{.} \end{equation*}

Use the result in Exercise 9 to help prove each of the following:

(a)

\([ n ] = [ {a_0 } ]\text{,}\) using congruence classes modulo 5.

(b)

\(n \equiv a_0 \pmod 5\text{.}\)

(c)

\(5 \mid n\) if and only if \(5 \mid a_0\text{.}\)

11.

Use mathematical induction to prove that if \(n\) is an integer and \(n \geq 2\text{,}\) then \(10^n \equiv 0 \pmod 4\text{.}\) Hence, for congruence classes modulo 4, if \(n\) is an integer and \(n \geq 2\text{,}\) then \([ {10^n } ] = [ 0 ]\text{.}\)

12.

Let \(n \in \mathbb{N}\) and assume

\begin{equation*} n = \left( {a_k \times 10^k } \right) + \left( {a_{k - 1} \times 10^{k - 1} } \right) + \cdots + \left( {a_1 \times 10^1 } \right) + \left( {a_0 \times 10^0 } \right)\!\text{.} \end{equation*}

Use the result in Exercise 11 to help prove each of the following:

(a)

\([ n ] = [ {10a_1 + a_0 } ]\text{,}\) using congruence classes modulo 4.

(b)

\(n \equiv \left( {10a_1 + a_0 } \right) \pmod 4\text{.}\)

(c)

\(4 \mid n\) if and only if \(4 \mid \left( {10a_1 + a_0 } \right)\text{.}\)

13.

Use mathematical induction to prove that if \(n\) is an integer and \(n \geq 3\text{,}\) then \(10^n \equiv 0 \pmod 8\text{.}\) Hence, for congruence classes modulo 8, if \(n\) is an integer and \(n \geq 3\text{,}\) then \([ {10^n } ] = [ 0 ]\text{.}\)

14.

Let \(n \in \mathbb{N}\) and assume

\begin{equation*} n = \left( {a_k \times 10^k } \right) + \left( {a_{k - 1} \times 10^{k - 1} } \right) + \cdots + \left( {a_1 \times 10^1 } \right) + \left( {a_0 \times 10^0 } \right)\!\text{.} \end{equation*}

Use the result in Exercise 13 to help develop a divisibility test for 8. Prove that your divisibility test is correct.

15.

Use mathematical induction to prove that if \(n\) is a nonnegative integer then \(10^n \equiv \left( -1 \right)^{n} \pmod {11}\text{.}\) Hence, for congruence classes modulo 11, if \(n\) is a nonnegative integer, then \([ {10^n } ] = [ \left( -1 \right)^{n} ]\text{.}\)

16.

Let \(n \in \mathbb{N}\) and assume

\begin{equation*} n = \left( {a_k \times 10^k } \right) + \left( {a_{k - 1} \times 10^{k - 1} } \right) + \cdots + \left( {a_1 \times 10^1 } \right) + \left( {a_0 \times 10^0 } \right)\!\text{.} \end{equation*}

Use the result in Exercise 15 to help prove each of the following:

(a)

\(n \equiv \sum\limits_{j = 0}^k {\left( { - 1} \right)^j a_j } \pmod {11}\text{.}\)

(b)

\([ n ] = [ {\sum\limits_{j = 0}^k {\left( { - 1} \right)^j a_j } } ]\text{,}\) using congruence classes modulo 11.

(c)

\(11\) divides \(n\) if and only if \(11\) divides \(\sum\limits_{j = 0}^k {\left( { - 1} \right)^j a_j }\text{.}\)

17.

Prove the following propositions.

(a)

For all \([ a ], [ b ] \in \mathbb{Z}_3\text{,}\) if \([ a ]^2 + [ b ]^2 = [ 0 ]\text{,}\) then \([ a ] = 0\) and \([ b ] = [ 0 ]\text{.}\)

Answer.

Prove the contrapositive by calculating \([ a ]^2 + [ b ]^2\) for all nonzero \([ a ]\) and \([ b ]\) in \(\Z_3\text{.}\)

(b)

Let \(a, b \in \mathbb{Z}\text{.}\) If \(\left( {a^2 + b^2 } \right) \equiv 0 \pmod 3\text{,}\) then \(a \equiv 0 \pmod 3\) and \(b \equiv 0 \pmod 3\text{.}\)

(Use Task 17.a.)

(c)

For all \(a, b \in \mathbb{Z}\text{,}\) if 3 divides \(\left( {a^2 + b^2 } \right)\text{,}\) then 3 divides \(a\) and 3 divides \(b\text{.}\)

(Use Task 17.b.)

18.

Prove the following proposition:

For each \(a \in \mathbb{Z}\text{,}\) if there exist integers \(b\) and \(c\) such that \(a = b^4 + c^4\text{,}\) then the units digit of \(a\) must be 0, 1, 2, 5, 6, or 7.

19.

Is the following proposition true or false? Justify your conclusion.

Let \(n \in \mathbb{Z}\text{.}\) If \(n\) is odd, then \(8 \mid \left( {n^2 - 1} \right)\text{.}\)

Hint.

What are the possible values of \(n\) (mod 8)?

20.

Prove the following proposition:

Let \(n \in \mathbb{N}\text{.}\) If \(n \equiv 7 \pmod 8\text{,}\) then \(n\) is not the sum of three squares. That is, there do not exist natural numbers \(a\text{,}\) \(b\text{,}\) and \(c\) such that \(n = a^2 + b^2 + c^2\text{.}\)

Activity 46. Using Congruence Modulo 4.

The set \(\mathbb{Z}_n\) is a finite set, and hence one way to prove things about \(\mathbb{Z}_n\) is to simply use the \(n\) elements in \(\mathbb{Z}_n\) as the \(n\) cases for a proof using cases. For example, if \(n \in \mathbb{Z}\text{,}\) then in \(\mathbb{Z}_4\text{,}\) \([ n ] = [ 0 ]\text{,}\) \([ n ] = [ 1 ]\text{,}\) \([ n ] = [ 2 ]\text{,}\) or \([ n ] = [ 3 ]\text{.}\)

(a)

Prove that if \(n \in \mathbb{Z}\text{,}\) then in \(\mathbb{Z}_4\text{,}\) \([ n ]^2 = [ 0 ]\) or \([ n ]^2 = [ 1 ]\text{.}\) Use this to conclude that in \(\mathbb{Z}_4\text{,}\) \([ {n^2 } ] = [ 0 ]\) or \([ {n^2 } ] = [ 1 ]\text{.}\)

(b)

Translate the equations \(\left[ {n^2 } \right] = [ 0 ]\) and \(\left[ {n^2 } \right] = [ 1 ]\) in \(\mathbb{Z}_4\) into congruences modulo 4.

(c)

Use a result in Exercise 12 to determine the value of \(r\) so that \(r \in \mathbb{Z}\text{,}\) \(0 \leq r \lt 3\text{,}\) and

\begin{equation*} {104 \ 257 \ 833 \ 259} \equiv r \pmod 4\!\text{.} \end{equation*}

That is, \([ {104 \ 257 \ 833 \ 259} ] = [ r ]\) in \(\mathbb{Z}_4\text{.}\)

(d)

Is the natural number \(104 \ 257 \ 833 \ 259\) a perfect square? Justify your conclusion.