$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$

# 7.4: Modular Arithmetic

$$\newcommand{\vecs}{\overset { \rightharpoonup} {\mathbf{#1}} }$$

$$\newcommand{\vecd}{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$

PREVIEW ACTIVITY$$\PageIndex{1}$$: Congruence Modulo 6

For this preview 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$$ (mod 6) and find five different integers $$b$$ such that $$b \equiv 4$$ (mod 6). That is, find five different integers in , the congruence class of 3 modulo 6 and five different integers in , the congruence class of 4 modulo 6.

2. Calculate $$s = a + b$$ using several values of $$a$$ in  and several values of $$b$$ in  from Part (1). For each sum $$s$$ that is calculated, find $$r$$ so that $$0 \le r < 6$$ and $$s \equiv r$$ (mod 6). What do you observe?

3. Calculate $$p = a \cdot b$$ using several values of $$a$$ in  and several values of $$b$$ in  from Part (1). For each product $$p$$ that is calculated, find $$r$$ so that $$0 \le r < 6$$ and $$p \equiv r$$ (mod 6). What do you observe?

4. Calculate $$q = a^2$$ using several values of a in  from Part (1). For each product $$q$$ that is calculated, find $$r$$ so that $$0 \le r < 6$$ and $$q \equiv r$$ (mod 6). What do you observe?

PREVIEW ACTIVITY $$\PageIndex{2}$$: The Remainder When Dividing by 9

If a and b are integers with b > 0, then from the Division Algorithm, we know that there exist unique integers $$q$$ and $$r$$ such that

$$a =bq + r$$ and $$0 \le r < b$$.

In this activity, we are interested in the remainder $$r$$. Notice that $$r = a - bq$$. So, given $$a$$ and $$b$$, if we can calculate $$q$$, then we can calculate $$r$$.

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

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

$$r = a - b \cdot \text{int}(\dfrac{a}{b})$$.

If $$n$$ is a positive integer, we will let $$s(n)$$ denote the sum of the digits of $$n$$. For example, if $$n = 731$$, then

$$s(731) = 7 + 3 + 1 = 11$$.

For each of the following values of $$n$$, 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?

## The Integers Modulo $$n$$

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

Definition: integers modulo $$n$$

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

Corollary 7.17 tells us that

$$\mathbb{Z} =  \cup  \cup  \cup \cdot\cdot\cdot \cup [n - 1]$$.

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

$$\mathbb{Z}_n = \{, , , ... [n - 1]\}$$.

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

The set of integers $$\mathbb{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 $$\mathbb{Z}$$, and we know that $$\mathbb{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$$. For example, in the integers modulo 5, $$\mathbb{Z}_5$$, is it possible to add the congruence classes  and  as follows?

$\begin{array} {rcl} { \oplus } &= & {[4 + 2]} \\ {} &= & {} \\ {} &= & {.} \end{array}$

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

$$9 \equiv 4$$ (mod 5) and so  = . Also,
$$7 \equiv 2$$ (mod 5) and so  = .

Do we get the same result if we add  and  in the way we did when we added  and ? The following computation confirms that we do:

$\begin{array} {rcl} { \oplus } &= & {[9 + 7]} \\ {} &= & {} \\ {} &= & {.} \end{array}$

This is one of the ideas that was explored in Preview Activity $$\PageIndex{1}$$. The main difference is that in this preview activity, we used the relation of congruence, and here we are using congruence classes. All of the examples in Preview Activity $$\PageIndex{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$$ (mod 6) and $$b \equiv 4$$ (mod 6), then $$(a + b) \equiv (3 + 4)$$ (mod 6); $$(a \cdot b) \equiv (3 \cdot 4)$$ (mod 6). If $$[a] = $$ and $$[b] = $$ in $$\mathbb{Z}_6$$, then $$[a + b] = [3 + 4]$$; $$[a \cdot b] = [3 \cdot 4]$$.

These are illustrations of general properties that we have already proved in Theorem 3.28. 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$$.

Theorem 3.28

Let $$n$$ be a natural number and let $$a$$, $$b$$, $$c$$, and $$d$$ be integers. Then

1. If $$a \equiv b$$ (mod $$n$$) and $$c \equiv d$$ (mod $$n$$), then $$(a + c) \equiv (b + d)$$ (mod $$n$$).
2. If $$a \equiv b$$ (mod $$n$$) and $$c \equiv d$$ (mod $$n$$), then $$ac \equiv bd$$ (mod $$n$$).
3. If $$a \equiv b$$ (mod $$n$$) and $$m \in \mathbb{N}$$, then $$a^m \equiv b^m$$ (mod $$n$$).
Proof

Add proof here and it will automatically be hidden

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

Corollary 7.19.

Let $$n$$ be a natural number and let $$a$$, $$b$$, $$c$$, and $$d$$ be integers. Then, in $$\mathbb{Z}_n$$.

1. If $$[a] = [b]$$ and $$[c] = [d]$$, then $$[a + c] = [b + d]$$.
2. If $$[a] = [b]$$ and $$[c] = [d]$$, then $$[a \cdot c] = [b \cdot d]$$.
3. If $$[a] = [b]$$ and $$m \in \mathbb{N}$$, then $$[a]^m = [b]^m$$.

Because of Corollary 7.19, 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}$$. Addition and multiplication in $$\mathbb{Z}_n$$ are defined as follows: For $$[a], [c] \in \mathbb{Z}_n$$,

$$[a] \oplus [c] = [a + c]$$ and $$[a] \odot [c] = [ac]$$.

The term modular arithmetic is used to refer to the operations of addition and multiplication of congruence classes in the integers modulo $$n$$.

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

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

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

$$ \oplus  =  = $$

Similarly, by definition, $$ \odot  = $$, and in $$\mathbb{Z}_3$$,  = . So we write

$$ \odot  =  = $$

The complete addition and multiplication tables for $$\mathbb{Z}_3$$ are Progress Check 7.20 (Modular Arithmetic in $$\mathbb{Z}_2$$, $$\mathbb{Z}_5$$, and $$\mathbb{Z}_6$$)

1. Construct addition and multiplication tables for $$\mathbb{Z}_2$$, the integers modulo 2.

2. Verify that the following addition and multiplication tables for $$\mathbb{Z}_5$$ are correct. 3. Construct complete addition and multiplication tables for $$\mathbb{Z}_6$$.

4. In the integers, the following statement is true. We sometimes call this the zero product property for the integers.
For all $$a, b \in \mathbb{Z}$$, if $$a \cdot b = 0$$, then $$a = 0$$ or $$b = 0$$.
Write the contrapositive of the conditional statement in this property.

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

(a) For all $$[a], [b] \in \mathbb{Z}_5$$, if $$[a] \odot [b] = $$, then $$[a] = $$ or $$[b] = $$.
(b) For all $$[a], [b] \in \mathbb{Z}_6$$, if $$[a] \odot [b] = $$, then $$[a] = $$ or $$[b] = $$.

Add texts here. Do not delete this text first.

## Divisibility Tests

Congruence arithmetic can be used to proof 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$$, 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$$. For example, if $$n = 7319$$, then $$s(7319) = 7 + 3 + 1 + 9 = 20$$. In Preview Activity $$\PageIndex{2}$$, we saw that

$$7319 \equiv 2$$ (mod 9) and $$20 \equiv 2$$ (mod 9).

In fact, for every example in Preview Activity $$\PageIndex{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:

$7319 = (7 \times 10^3) + (3 \times 10^2) + (1 \times 10^1) + (9 \times 10^0).$

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

$\begin{array} {rcl} {} &= & {[(7 \times 10^3) + (3 \times 10^2) + (1 \times 10^1) + (9 \times 10^0)]} \\ {} &= & {[7 \times 10^3] \oplus [3 \times 10^2] \oplus [1 \times 10^1] \oplus [9 \times 10^0]} \\ {} &= & {( \odot [10^3]) \oplus ( \odot [10^2]) \oplus ( \odot [10^1]) \oplus ( \odot ).} \end{array}$

Since $$10^3 \equiv 1$$ (mod 9), $$10^2 \equiv 1$$ (mod 9) and $$10 \equiv 1$$ (mod 9), we can conclude that $$[10^3] = $$, $$[10^2] = $$ and $$ = $$. Hence, we can use these facts and equation (7.4.4) to obtain

$\begin{array} {rcl} {} &= & {( \odot [10^3]) \oplus ( \odot [10^2]) \oplus ( \odot ) \oplus ( \odot )} \\ {} &= & {( \odot ) \oplus ( \odot ) \oplus ( \odot ) \oplus ( \odot )} \\ {} &= & { \oplus  \oplus  \oplus } \\ {} &= & {[7 + 3 + 1 + 9].} \end{array}$

Equation (7.4.5) 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 (7.4.3).

In general, if $$n \in \mathbb{N}$$, and $$n = a_{k}a_{k - 1} \cdot\cdot\cdot a_{1}a_{0}$$ is the decimal representation of $$n$$, then

$$n = (a_k \times 10^{k}) + (a_{k - 1} \times 10^{k-1}) + \cdot\cdot\cdot + (a_{1} \times 10^{1}) + (a_{0} \times 10^{0}).$$

This can also be written using summation notation as follows:

$$n = \sum_{j = 0}^{k} (a_{j} \times 10^{j}).$$

Using congruence classes for congruence modulo 9, we have

$\begin{array} {rcl} {[n]} &= & {[(a_k \times 10^{k}) + (a_{k - 1} \times 10^{k-1}) + \cdot\cdot\cdot + (a_{1} \times 10^{1}) + (a_{0} \times 10^{0})]} \\ {} &= & {[a_k \times 10^{k}] \oplus [a_{k - 1} \times 10^{k-1}] \oplus \cdot\cdot\cdot \oplus [a_{1} \times 10^{1}] \oplus [a_{0} \times 10^{0}]} \\ {} &= & {([a_k] \odot [10^k]) \oplus ([a_{k - 1}] \odot [10^{k - 1}]) \oplus \cdot\cdot\cdot \oplus ([a_1] \odot [10^{1}]) \oplus ([a_0] \odot [10^{0}]).} \end{array}$

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

Proposition 7.21.

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

If we let $$s(n)$$ denote the sum of the digits of $$n$$, then

$$s(n) = a_k + a_{k - 1} + \cdot\cdot\cdot + a_1 + a_0.$$

Now using equation (7.4.6) and Proposition 7.21, we obtain

$\begin{array} {rcl} {[n]} &= & {([a_k] \odot ) \oplus ([a_{k - 1}] \odot ) \oplus \cdot\cdot\cdot \oplus ([a_1] \odot ) \oplus ([a_0] \odot )} \\ {} &= & {[a_k] \oplus [a_{k - 1}] \oplus \cdot\cdot\cdot \oplus [a_1] \oplus [a_0] \\ {} &= & {[a_k + a_{k-1} + \cdot\cdot\cdot + a_1 + a_0].} \\ {} &= & {[s(n)].} \end{array}$

This completes the proof of Theorem 7.22.

Theorem 7.22.

Let $$n \in \mathbb{N}$$ and let $$s(n)$$ denote the sum of the digits of $$n$$. Then

1. $$[n] = [s(n)]$$, using congruence classes modulo 9.
2. $$n \equiv s(n)$$ (mod 9)
3. $$9\ |\ n$$ if and only if $$9\ |\ s(n)$$.

Part (3) of Theorem 7.22 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.

Exercise 7.4

1. (a) Complete the addition and multiplication tables for $$\mathbb{Z}_4$$.
(b) Complete the addition and multiplication tables for $$\mathbb{Z}_7$$.
(c) Complete the addition and multiplication tables for $$\mathbb{Z}_8$$.
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$$, 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 = $$ in $$\mathbb{Z}_4$$
(b) $$[x]^2 = $$ in $$\mathbb{Z}_8$$
(c) $$[x]^4 = $$ in $$\mathbb{Z}_5$$
(d) $$[x]^2 \oplus  \odot [x] = $$ in $$\mathbb{Z}_6$$
(e) $$[x]^2 \oplus  = $$ in $$\mathbb{Z}_5$$
(f) $$ \odot [x] \oplus  = $$ in $$\mathbb{Z}_5$$
(g) $$ \odot [x] \oplus  = $$ in $$\mathbb{Z}_6$$
(h) $$ \odot [x] \oplus  = $$ in $$\mathbb{Z}_9$$

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

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

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

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

5. (a) Prove the following proposition:
For each $$[a] \in \mathbb{Z}_5$$, if $$[a] \ne $$, then $$[a]^2 = $$ or $$[a]^2 = $$.
(b) Does there exist an integer $$a$$ such that $$a^2 = 5, 158, 232, 468, 953, 153$$? Use your work in Part (a) to justify your conclusion. Compare to Exercise (10) in Section 3.5.

6. Use mathematical induction to prove Proposition 7.21.
If $$n$$ is a nonnegative integer, then $$10^n \equiv 1$$ (mod 9), and hence for the equivalence relation of congruence modulo 9, $$[10^n] = $$.

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

8. Let $$n \in \mathbb{N}$$ and let $$s(n)$$ denote the sum of the digits of $$n$$.So if we write
$n = (a_k \times 10^k\) + (a_{k - 1} \times 10^{k - 1} + \cdot\cdot\cdot + (a_1 \times 10^{1}) + (a_0 \times 10^{0}).$
then $$s(n) = a_k + a_{k - 1} + \cdot\cdot\cdot + a_1 + a_0$$. Use the result in Exercise (7) to help prove each of the following:

(a) $$[n] = [s(n)]$$, using congruence classes modulo 3.
(b) $$n \equiv s(n)$$ (mod 3).
(c) $$3\ |\ n$$ if only if $$3\ |\ s(n)$$.

9. Use mathematical induction to prove that if $$n$$ is an integer and $$n ge 1$$, then $$10^n \equiv 0$$ (mod 5). Hence, for congruence classes modulo 5, if $$n$$ is an integer and $$n \ge 1$$, then $$[10^n] = $$.

10. Let $$n \in \mathbb{N}$$ and assume
$n = (a_k \times 10^k) + (a_{k - 1} \times 10^{k - 1} + \cdot\cdot\cdot + (a_1 \times 10^{1}) + (a_0 \times 10^{0}).$
Use the result in Exercise (9) to help prove each of the following:

(a) $$[n] = [a_0]$$, using congruence classes modulo 5.
(b) $$n \equiv a_0$$ (mod 5).
(c) $$5\ |\ n$$ if only if $$5\ |\ a_0$$.

11. Use mathematical induction to prove that if $$n$$ is an integer and $$n ge 2$$, then $$10^n \equiv 0$$ (mod 4). Hence, for congruence classes modulo 4, if $$n$$ is an integer and $$n \ge 2$$, then $$[10^n] = $$.

12. Let $$n \in \mathbb{N}$$ and assume
$n = (a_k \times 10^k) + (a_{k - 1} \times 10^{k - 1} + \cdot\cdot\cdot + (a_1 \times 10^{1}) + (a_0 \times 10^{0}).$
Use the result in Exercise (11) to help prove each of the following:

(a) $$[n] = [10a_1 + a_0]$$, using congruence classes modulo 4.
(b) $$n \equiv (10a_1 + a_0)$$ (mod 5).
(c) $$4\ |\ n$$ if only if $$4\ |\ (10a_1 + a_0)$$.

13. Use mathematical induction to prove that if $$n$$ is an integer and $$n ge 3$$, then $$10^n \equiv 0$$ (mod 8). Hence, for congruence classes modulo 8, if $$n$$ is an integer and $$n \ge 3$$, then $$[10^n] = $$.

14. Let $$n \in \mathbb{N}$$ and assume
$n = (a_k \times 10^k) + (a_{k - 1} \times 10^{k - 1} + \cdot\cdot\cdot + (a_1 \times 10^{1}) + (a_0 \times 10^{0}).$
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 (-1)^n (mod 11)$$. Hence, for congruence classes modulo 11, if $$n$$ is a nonnegative integer, then $$[10^n] = [(-1)^n]$$.

16. Let $$n \in \mathbb{N}$$ and assume
$n = (a_k \times 10^k) + (a_{k - 1} \times 10^{k - 1} + \cdot\cdot\cdot + (a_1 \times 10^{1}) + (a_0 \times 10^{0}).$
Use the result in Exercise (15) to help prove each of the following:

(a) $$n \equiv \sum_{j = 0}^{k} (-1)^j a_j$$ (mod 11).
(b) $$[n] = [\sum_{j = 0}^{k} (-1)^j a_j]$$, using congruence classes modulo 11.
(c) 11 divides $$n$$ if and only if 11 divides $$\sum_{j = 0}^{k} (-1)^j a_j$$

17. (a) Prove the following proposition:
For all $$[a], [b] \in \mathbb{Z}_3$$, if $$[a]^2 + [b]^2 = $$, then $$[a] = 0$$ and $$[b] = $$.
(b) Use Exercise (17a) to prove the following proposition:
Let $$a, b \in \mathbb{Z}$$. If $$(a^2 + b^2) \equiv 0$$ (mod 3), then $$a \equiv 0$$ (mod 3) and $$b \equiv 0$$ (mod 3).
(c) Use Exercise (17b) to prove the following proposition:
Let $$a, b \in \mathbb{Z}$$, if 3 divides $$(a^2 + b^2)$$, then 3 divides $$a$$ and 3 divides $$b$$.

18. Prove the following proposition:
For each $$a \in \mathbb{Z}$$, if there exist integers $$b$$ and $$c$$ such that $$a = b^4 + c^4$$, 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.
For $$n \in \mathbb{Z}$$. If $$n$$ is odd, then $$8\ |\ (n^2 - 1)$$. Hint: What are the possible values of $$n$$ (mod 8)?

20. Prove the following proposition:
For $$n \in \mathbb{Z}$$. If $$n \equiv 7$$ (mod 8), then $$n$$ is not the sum of three squares. That is, there do not exist natural numbers $$a$$, $$b$$, and $$c$$ such that $$n = a^2 + b^2 + c^2$$.

Explorations and Activities

21. 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}$$, then in $$\mathbb{Z}_4$$, $$[n] = $$, $$[n] = $$, $$[n] = $$, or $$[n] = $$.

(a) Prove that if $$n \in \mathbb{Z}$$, then in $$\mathbb{Z}_4$$, $$[n]^2 = $$ or $$[n]^2 = $$. Use this to conclude that in $$\mathbb{Z}_4$$, $$[n^2] = $$ or $$[n^2] = $$.
(b) Translate the equations $$[n^2] = $$ and $$[n^2] = $$ 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}$$, $$0 \le r < 3$$, and
$104\ 257\ 833\ 259 \equiv r \text{ (mod 4).}$
That is, $$[104\ 257\ 833\ 259] = [r]$$ in $$\mathbb{Z}_4$$.
(d) Is the natural number 104 257 833 259 a perfect square? Justify your conclusion.