• Keine Ergebnisse gefunden

Congruences vs. remainders

Im Dokument Mathematical Problem Solving (Seite 52-57)

3. Number Theory I: Divisibility and congruence

3.3. Congruences vs. remainders

Let us now come back to division with remainder. As we mentioned above, the entries of the pair (q,r) in Theorem 3.1.8 have names; let us also give them nota-tions44:

Definition 3.3.1. Let n be a positive integer. Let u ∈ Z. Theorem 3.1.8 shows that there exists a unique pair(q,r)∈ Z× {0, 1, . . . ,n−1} such that u=qn+r.

Consider this pair.

(a)We denote the integerqbyu//n, and refer to it as thequotient of the division of u by n (or as thequotient obtained when u is divided by n).

(b)We denote the integerrbyu%n, and refer to it as theremainder of the division of u by n (or as theremainder obtained when u is divided by n).

Here are some basic properties of these integers:

Proposition 3.3.2. Let nbe a positive integer. Let u∈ Z.

(a)Then, u%n ∈ {0, 1, . . . ,n−1}and u%n≡umodn.

(b)We have n| uif and only ifu%n=0.

(c)If c ∈ {0, 1, . . . ,n−1}is such that c ≡umodn, thenc =u%n.

(d)We have u= (u//n)n+ (u%n).

44Warning: The notationsu//nandu%nare not standard across the literature; I have taken them from the Python programming language. Various authors writeumodnfor what I callu%n, but the notationumodntypically means a different things (which we will meet in a later chapter), so I prefer not to overload it thus.

Proposition 3.3.3. Let nbe a positive integer. Let u,v∈ Z.

(a)We have u%n+v%n−(u+v)%n∈ {0,n}. (b)We have (u+v)//n−u//nv//n ∈ {0, 1}.

Proposition 3.3.4. Let n be a positive integer. Let u and v be integers. Then, u≡vmodnif and only ifu%n=v%n.

Proposition 3.3.5. Let n be a positive integer. Let u ∈ Z. Then, u//n = ju n k

. (See Section 1.1 for the definition of the floor ju

n k

of u n.)

(The first three of these four propositions are proved in [19s, §2.6]; all four are easy to prove.)

Note that Proposition 3.3.4 can be viewed as another definition of congruence modulo n(at least whenn is a positive integer).

Recall that an integer is said to beeven if it is divisible by 2, and odd if it is not.

The following exercise illustrates how remainders interact with congruence:

Exercise 3.3.1. Prove that the sum of any two odd integers is even.

Solution to Exercise 3.3.1. Let aandb be two odd integers. We must prove thata+b is even.

The integer ais odd, i.e., not divisible by 2 (by the definition of “odd”). In other words, we don’t have 2| a.

Proposition 3.3.2 (b) (applied to n = 2 and u = a) yields that we have 2 | a if and only if a%2 = 0. Thus, we don’t have a%2 = 0 (since we don’t have 2 | a).

But Proposition 3.3.2 (a)(applied to n =2 andu =a) yields that a%2∈ {0, 1} and a%2≡amod 2. Froma%2∈ {0, 1}, we obtain a%2=1 (since we don’t have a%2= 0). But from a%2 ≡ amod 2, we obtain a ≡ a%2 mod 2 (by Proposition 3.2.6 (c)).

This rewrites as a≡1 mod 2 (sincea%2 =1). Similarly,b ≡1 mod 2. Adding these two congruences45, we obtain a+b ≡ 1+1 mod 2. But 1+1 =2 ≡0 mod 2 (since 2 |2−0). Hence, a+b ≡1+1 ≡0 mod 2. In other words, 2 | (a+b)−0 =a+b.

In other words, a+b is divisible by 2. In other words, a+b is even. This solves Exercise 3.3.1.

The following simple exercises (see [19s, §2.7] for solutions) collect various basic properties of even and odd integers:

Exercise 3.3.2. Let ube an integer.

(a)Prove that u is even if and only ifu%2=0.

(b)Prove that u is odd if and only ifu%2=1.

(c)Prove that u is even if and only ifu≡0 mod 2.

(d)Prove that u is odd if and only ifu≡1 mod 2.

45i.e., applying (36)

(e)Prove that u is odd if and only ifu+1 is even.

(f)Prove that exactly one of the two numbers uand u+1 is even.

(g)Prove that u(u+1)≡0 mod 2.

(h)Prove that u2 ≡ −u≡umod 2.

(i)Let vbe a further integer. Prove thatu≡vmod 2 holds if and only ifu and vare either both odd or both even.

Exercise 3.3.3. (a)Prove that each even integer usatisfies u2 ≡0 mod 4.

(b)Prove that each odd integer u satisfiesu2 ≡1 mod 4.

(c)Prove that no two integers xand ysatisfy x2+y2 ≡3 mod 4.

(d) Prove that if x and y are two integers satisfying x2+y2 ≡2 mod 4, then x and yare both odd.

As an application of these simple facts, let us prove something a little bit less trivial:

Exercise 3.3.4. Let nbe an odd integer. Prove that 8 |n2−1.

Solution to Exercise 3.3.4. Exercise 3.3.2 (d) (applied to u = n) shows that n is odd if and only if n ≡ 1 mod 2. Hence, n ≡ 1 mod 2 (since n is odd). In other words, 2 | n−1. In other words, there exists an integer c such that n−1 = 2c. Consider this c. From n−1 =2c, we obtain n =2c+1, hencen2 = (2c+1)2 =4c2+4c+1 and therefore n2−1 = 4c2+4c = 4c(c+1). But Exercise 3.3.2 (g) (applied to u = c) yields c(c+1) ≡0 mod 2; in other words, 2 | c(c+1). Hence, there exists an integer dsuch that c(c+1) =2d. Consider thisd. Now,

n2−1=4c(c+1)

| {z }

=2d

=4·2d=8d.

Thus, 8|n2−1 (sinced is an integer). This solves Exercise 3.3.4.

Here is another, very similar exercise to illustrate how remainders can be used to prove congruences almost mechanically:

Exercise 3.3.5. Let nbe an integer such that 3-n. Prove that 3 | n2−1.

Solution to Exercise 3.3.5. Proposition 3.3.2 (a) (applied to 3 and n instead of n and u) yields that n%3∈ {0, 1, 2} and n%3≡ nmod 3. Symmetry of congruence yields n≡n%3 mod 3 (sincen%3≡nmod 3).

Proposition 3.3.2(b) (applied to 3 and ninstead of n and u) yields that we have 3| n if and only if n%3=0. Since we don’t have 3 |n (because we assumed 3-n), we thus conclude that we don’t haven%3=0.

Thus we know that n%3 ∈ {0, 1, 2}, but we don’t have n%3 = 0. Hence, n%3 ∈ {0, 1, 2} \ {0} ={1, 2}. Hence, we are in one of the following two cases:

Case 1: We haven%3=1.

Case 2: We haven%3=2.

Let us first consider Case 1. In this case, we haven%3=1. Recall thatn ≡n%3= 1 mod 3. We can square both sides of this congruence (by applying Proposition 3.2.7 to 3, n, 1 and 2 instead of n, a, b and k), and thus obtain n2 ≡ 12 = 1 mod 3. In other words, 3| n2−1. Hence, Exercise 3.3.5 is solved in Case 1.

Let us now consider Case 2. In this case, we have n%3 = 2. Recall that n ≡ n%3 = 2 mod 3. We can square both sides of this congruence (by apply-ing Proposition 3.2.7 to 3, n, 2 and 2 instead of n, a, b and k), and thus obtain n2 ≡ 22 =4 ≡1 mod 3 (where the last “≡” sign is a consequence of 3 | 4−1). In other words, 3| n2−1. Hence, Exercise 3.3.5 is solved in Case 2.

We have now solved Exercise 3.3.5 in both possible cases, so we are done.

The solution to Exercise 3.3.5 we just gave is an example of the “try all possible remainders” technique for proving divisibilities and congruences. It should be clear that we could also have used it to get a more-or-less mechanical solution to Exercise 3.3.4: Sincen%8∈ {0, 1, . . . , 7}, we would just have to check that 8| n2−1 holds for all possible values 0, 1, . . . , 7 of n%8. (Out of these 8 values, only 1, 3, 5, 7 are possible, becausenis assumed to be odd in Exercise 3.3.4.) In a similar fashion, we can prove that every integernsatisfies the divisibilities

6| n3−n; 12|n4−n2; 10 |n5−n; 24| n5−n3; 6| n(n+1) (n+2); 24| n(n+1) (n+2) (n+3)

and many others.

As another example for the use of congruence arguments, let us find out when Fibonacci numbers are even and when they are odd. A look at the first values suggests that every third Fibonacci number (starting with f0) is even, while the remaining ones are odd. Equipped with the notion of a congruence (and parts (c) and(d) of Exercise 3.3.2), we can restate this as follows:

Exercise 3.3.6. Let (f0, f1, f2, . . .) be the Fibonacci sequence. Then, fn

(0, if 3 |n;

1, if 3 -n mod 2 (45)

for every nonnegative integern.

Solution to Exercise 3.3.6 (sketched). We shall prove (45) by strong induction onn:

Induction step: Let m ∈ N. Assume (as the induction hypothesis) that (45) holds for all n < m. We must prove that (45) for n = m. In other words, we must prove that

fm

(0, if 3| m;

1, if 3-m mod 2. (46)

Ifm <2, then we can see this directly from f0 =0 and f1 =1. Thus, we WLOG assume that m ≥2. Hence, m−2 and m−1 are nonnegative integers. Since these

two nonnegative integers m−2 and m−1 are < m, we can thus apply (45) to n=m−2 and ton =m−1 (by our induction hypothesis). We thus obtain

fm1

(0, if 3| m−1;

1, if 3-m−1 mod 2 and

fm2

(0, if 3 | m−2;

1, if 3 -m−2 mod 2.

Adding these two congruences, we obtain fm1+ fm2

(0, if 3 |m−1;

1, if 3-m−1 +

(0, if 3 | m−2;

1, if 3 -m−2 mod 2.

This rewrites as fm

(0, if 3 | m−1;

1, if 3 -m−1 +

(0, if 3| m−2;

1, if 3-m−2 mod 2 (47) (since the recursive definition of the Fibonacci sequence yields fm = fm1+ fm2).

Our goal is now to deduce (46) from this congruence. In order to do so, it suffices to show that

(0, if 3| m−1;

1, if 3-m−1 +

(0, if 3 |m−2;

1, if 3-m−2

(0, if 3 | m;

1, if 3 -m mod 2 (48)

(because then, combining (47) with (48) will immediately yield (46) by the transi-tivity of congruence).

The proof of (48) is a straightforward case distinction. Indeed, Proposition 3.3.2 (a)(applied to n =3 and u =m) yields that m%3 ∈ {0, 1, 2} and m%3 ≡ mmod 3.

Symmetry of congruence yields m ≡ m%3 mod 3 (since m%3 ≡ mmod 3). Since m%3∈ {0, 1, 2}, we are in one of the following three cases:

Case 1: We havem%3=0.

Case 2: We havem%3=1.

Case 3: We havem%3=2.

Let me work through Case 1 in detail, leaving the other two cases to the reader (the arguments are closely similar). In Case 1, we havem%3=0. Thus,m ≡m%3= 0 mod 3. According to Proposition 3.2.3 (applied to n = 3 and a = m), we have m ≡ 0 mod 3 if and only if 3 | m. Thus, 3 | m (since m ≡ 0 mod 3). Furthermore, subtracting the congruence 1 ≡ 1 mod 3 from the congruence m ≡ 0 mod 3, we obtain m−1≡0−1=−1 mod 3. Thus, we do not have m−1≡0 mod 3 (because

if we had m−1 ≡ 0 mod 3, then we would have 0 ≡ m−1 ≡ −1 mod 3, or, equivalently, 3 | 0−(−1) = 1, which is absurd). According to Proposition 3.2.3 (applied ton =3 and a =m−1), we havem−1≡0 mod 3 if and only if 3| m1.

Hence, we do not have 3 | m−1 (since we do not have m−1 ≡0 mod 3). In other words, we have 3 - m−1. A similar computation yields 3 - m−2 (since 3 | 2 is as absurd as 3 | 1). Now, we know that 3 | m and 3 - m1 and 3 - m2.

In light of these facts, the congruence (48) (which we need to prove) rewrites as 1+1≡0 mod 2. In other words, it is equivalent to 2| (1+1)−0, which is obvious.

Thus, we have proved (48) in Case 1.

The proof of (48) in Case 2 is similar, except that this time we have m≡1 mod 3 (instead ofm≡0 mod 3) and thus 3| m−1 and 3-mand 3-m−2.

The proof of (48) in Case 3 is similar, too.

Im Dokument Mathematical Problem Solving (Seite 52-57)