• Keine Ergebnisse gefunden

Recitation #2: Coprimality and more number theory

Im Dokument Mathematical Problem Solving (Seite 82-91)

3. Number Theory I: Divisibility and congruence

3.8. Recitation #2: Coprimality and more number theory

We shall now discuss a sample of exercises related to divisibility and coprimality.

The following exercise is essentially Problem 1 from the 1st International Math-ematical Olympiad 1959:

Exercise 3.8.1. Let n∈ Z. Prove that 21n+4⊥14n+3.

We shall give two solutions for this exercise:

First solution to Exercise 3.8.1. We shall apply Proposition 3.4.4 similarly to how it is employed in the Euclidean algorithm – using Proposition 3.4.4 (b) to interchange the two arguments in gcd(a,b), and using Proposition 3.4.4(c)to subtract a multi-ple of the first argument from the second in gcd(a,b). We perform these operations in such a way that the two arguments gradually get simpler.

Here is how this looks like:

gcd(21n+4, 14n+3)

=gcd

14n+3, 21n+4

| {z }

=1·(14n+3)+(7n+1)

 (by Proposition 3.4.4(b))

=gcd(14n+3, 1·(14n+3) + (7n+1))

=gcd(14n+3, 7n+1)

(by Proposition 3.4.4 (c), applied to a =14n+3, b=7n+1 andu =1)

=gcd

7n+1, 14n+3

| {z }

=2·(7n+1)+1

 (by Proposition 3.4.4(b))

=gcd(7n+1, 2·(7n+1) +1)

=gcd(7n+1, 1)

(by Proposition 3.4.4 (c), applied to a =7n+1, b=1 andu=2)

=gcd(1, 7n+1) (by Proposition 3.4.4 (b))

=1

(since Exercise 3.5.1 (a) yields 1 ⊥ 7n+1 and thus gcd(1, 7n+1) = 1). In other words, 21n+4⊥14n+3. This solves Exercise 3.8.1.

A second solution to Exercise 3.8.1 can be given using the following converse of Bezout’s theorem:

Proposition 3.8.1. Let a, b, x andy be four integers. Then:

(a)We have gcd(a,b) | xa+yb.

(b)If xa+yb=1, then a⊥b.

Proof of Proposition 3.8.1. (a)Let g =gcd(a,b). Thus, g=gcd(a,b) | a(by Proposi-tion 3.4.4(f)), so thata ≡0 modg. Similarly,b≡0 modg. Now,x a

0 mod|{z}g

+y b

|{z}0 modg

≡ x·0+y·0 = 0 modg. In other words, g | xa+yb. In other words, gcd(a,b) | xa+yb(sinceg =gcd(a,b)). This proves Proposition 3.8.1(a).

(b)We know (from Proposition 3.4.3 (a)) that gcd(a,b) is a nonnegative integer.

But Proposition 3.8.1 (a)yields gcd(a,b) | xa+yb=1. Thus, gcd(a,b)is a divisor of 1, and therefore a nonnegative divisor of 1 (since gcd(a,b) is nonnegative). But the only nonnegative divisor of 1 is 1 itself. Hence, we conclude that gcd(a,b) =1.

In other words,a ⊥b. This proves Proposition 3.8.1(b).

Second solution to Exercise 3.8.1. We have(−2)·(21n+4) +3·(14n+3) = 1. Hence, Proposition 3.8.1(b)(applied toa=21n+4, x =−2, b =14n+3 andy=3) yields 21n+4⊥14n+3. This solves Exercise 3.8.1 again.

This second solution to Exercise 3.8.1 is slick, but how could we have found it? The answer turns out to be “pretty easily, once we made up our mind to apply Proposition 3.8.1 (b)”. Indeed, in order to prove 21n+4 ⊥ 14n+3 us-ing Proposition 3.8.1 (b), it is necessary to find two integers x and y that satisfy x·(21n+4) +y·(14n+3) = 1. In theory, these x and y could depend on n, but the first thing you should try are constants. So you are looking for two (constant) integers x and y that satisfy x·(21n+4) +y·(14n+3) = 1 for each n ∈ Z. But this boils down to a system of infinitely many linear equations in x and y (one for each n); any two of them determine x and y uniquely. Solving the system thus yields x = −2 and y = 3, which is exactly the two numbers used in the solution above.

Here is another little exercise:

Exercise 3.8.2. You have a corridor with 1000 lamps, which are initially all off.

Each lamp has a light switch controlling its state.

Every night, a ghost glides through the corridor (always in the same direction) and flips some of the switches:

On the 1st night, the ghost flips every switch.

On the 2nd night, the ghost flips switches 2, 4, 6, 8, 10, . . ..

On the 3rd night, the ghost flips switches 3, 6, 9, 12, 15, . . ..

etc.

(That is: For each k∈ {1, 2, . . . , 1000}, the ghost spends thek-th night flipping switches k, 2k, 3k, . . ..)

Which lamps will be on after 1000 nights?

Discussion of Exercise 3.8.2. Let us first make the problem more manageable by fo-cussing on a single lamp. So let us fix some m ∈ {1, 2, . . . , 1000} and find out whether lampm is on after 1000 nights.

Indeed, switchmgets flipped on thek-th night if and only if mis a multiple ofk.

In other words, switchm gets flipped on the k-th night if and only ifk is a divisor ofm. Thus, the number of times that switch m gets flipped (during the entire 1000 nights) is precisely the number of positive divisors ofm. Of course, lampmwill be on after 1000 nights if and only if this number of times is odd. Thus, asking which lamps will be on after 1000 nights is equivalent to asking which of the numbers 1, 2, . . . , 1000 have an odd number of positive divisors.

Experiments reveal that among the first 10 positive integers, only three have an odd number of positive divisors: namely, 1, 4 and 9. (For example, 9 has the 3 positive divisors 1, 3 and 9.) This suggests the following:

Exercise 3.8.3. Let n be a positive integer. Prove that the number of positive divisors ofn is even if and only ifnis not a perfect square.

Solution to Exercise 3.8.3 (sketched). A detailed proof can be found in [19s, Proposi-tion 2.14.7], so we shall keep to the main idea. We will use the word “posdiv” as shorthand for “positive divisor”. If d is a posdiv of n, then n

d is an integer and again a posdiv ofn. We shall refer to n

d as thecomplementofd. Note that being the complement is a symmetric relation: Ifdis a posdiv ofn, and ifeis the complement ofd, then dis in turn the complement ofe.

We can thus pair up each posdiv of n with its complement. This results in a “pairing” that covers all posdivs of n, except that it might fail to be a proper pairing: Namely, if a posdiv of n is its own complement, then this posdiv will be paired with itself.

Example 3.8.2. Let us see how this “pairing” looks like:

• If n = 12, then the posdivs of n are 1, 2, 3, 4, 6, 12. Their complements are 12, 6, 4, 3, 2, 1, respectively. Thus, our “pairing” pairs 1 with 12, pairs 2 with 6, and pairs 3 with 4.

• If n = 16, then the posdivs of n are 1, 2, 4, 8, 16. Their complements are 16, 8, 4, 2, 1, respectively. Thus, our “pairing” pairs 1 with 16, pairs 2 with 8, and pairs 4 with itself.

When doesnhave a posdiv that gets paired with itself? In other words, when is there a posdiv d of n that is its own complement? Clearly, this means that d = n

d, or, equivalently,n = d2. If n is a perfect square, then there is exactly one posdiv d that satisfiesn=d2 (namely, √

n); otherwise, there is no suchd. Thus:

• Ifn is a perfect square, then exactly one posdiv ofn gets paired with itself.

• Ifn is not a perfect square, then no posdiv ofngets paired with itself.

Hence:

• If n is a perfect square, then our “pairing” of the posdivs of n leaves exactly one posdiv of n paired with itself, while all others have proper partners.

Therefore, in this case, the number of posdivs ofnis odd.

• Ifn is not a perfect square, then our “pairing” of the posdivs ofn is a proper pairing (i.e., no posdiv gets paired with itself). Therefore, in this case, the number of posdivs ofn is even.

Combining these facts, we conclude that the number of posdivs of n is even if and only if nis not a perfect square. This solves Exercise 3.8.3.

Exercise 3.8.3 quickly yields an answer to Exercise 3.8.2: Namely, the lamps that will be on after 1000 nights are precisely them-th lamps wherem ∈ {1, 2, . . . , 1000} is a perfect square – i.e., the 12-th, 22-th, 32-th etc. lamps.

Exercise 3.8.3 is due to John Wallis (1685, [Wallis85, Additional Treatises, Chapter III, §16]).

Next, we shall discuss some variations on Bezout’s theorem. As a warmup exer-cise, here is an easy one:

Exercise 3.8.4. Let a andb be two coprime integers. Let nbe an integer.

Prove that there exist integers x and ysuch that n=xa+yb.

Solution to Exercise 3.8.4. The numbersaandbare coprime; in other words, gcd(a,b) = 1.

But Theorem 3.4.5 yields that there exist integers x ∈ Z and y ∈ Z such that gcd(a,b) =xa+yb. Consider these xandy, and denote them byx0 andy0. (We do not want to call them x and y, since they are not the x and y we are looking for.) Thus, x0 and y0 are integers satisfying gcd(a,b) = x0a+y0b. Hence, x0a+y0b = gcd(a,b) =1. Multiplying both sides of this equality by n, we find n(x0a+y0b) = n·1 =n. Hence,n=n(x0a+y0b) =nx0a+ny0b. Thus, there exist integers xand y such thatn=xa+yb(namely, x=nx0and y=ny0). This solves Exercise 3.8.4.

Now, what happens if we require x and y to be nonnegative in Exercise 3.8.4?

Then, Exercise 3.8.4 is no longer valid. For example, if a=3 and b =5, then there are no nonnegative integers x and y such that 4 = xa+yb. This is, in a way, due to 4 being “too small”; one is thus tempted to ask whether requiring n to be large enough (for a and b positive) will force those nonnegative x and y to exist. If so, then how large is large enough?

The answer is given by a famous result of J. J. Sylvester (who found it in 1882 when studying invariant theory). We state it as an exercise:

Exercise 3.8.5. Let aand b be two coprime positive integers. Let nbe an integer such that n>ab−a−b.

Prove that there existnonnegative integers xand ysuch that n= xa+yb.

The “n > ab−a−b” bound in Exercise 3.8.5 is sharp: The claim of the exercise would no longer hold if we allowedn =ab−a−b. (See Exercise 4.5.2(b)for why.) Exercise 3.8.5 is often stated in terms of coins: Ifaandbare two coprime positive integers, and if you have unlimited supplies ofa-cent coins and ofb-cent coins, but no other coins, then Exercise 3.8.5 says that you can pay any amount that is larger

than ab−a−b cents57 without asking for change. See Wikipedia on the Sylvester Coin Problem, which also studies the generalization to more than two sorts of coins. (This generalization is significantly harder.)58

Discussion of Exercise 3.8.5. Exercise 3.8.4 yields that there exist integers x and y such that n =xa+yb. Consider these x and y, and denote them by x0 and y0. (We do not want to call themxand y, since they are not thex andywe are looking for.) Thus, x0 and y0 are integers satisfyingn =x0a+y0b.

If x0 and y0 are nonnegative, then we are already done (since we can just take x = x0 and y = y0). But x0 and y0 might not be nonnegative yet. The trick is now to modify x0 and y0 in such a way that they become nonnegative but the sum x0a+y0b is unchanged. (If you want, you can view this as an instance of the “find a not-quite-answer and tweak it until it becomes a full answer” technique; the time-honored regula falsiis another instance of this technique.)

How can we modify x0 and y0 in a way that x0a+y0b is unchanged? A simple way to do so is to addb tox0and subtractafromy0 (because this causesx0a+y0bto become(x0+b)a+ (y0−a)b, which is still the same as x0a+y0b). More generally, we can pick any d ∈ Z and add db to x0 and subtract da from y0. Obviously, if we pick d large enough, then x0 +db will become nonnegative, whereas a small enough d will make y0−da nonnegative. The question is: Is there a (nonempty)

“goldilocks zone” in whichdis sufficiently large for x0+dbto be nonnegative and yet sufficiently small for y0−dato be nonnegative?

We can try to describe this “goldilocks zone” explicitly. The number x0+db is nonnegative if and only if d ≥ −x0

b (check this!); on the other hand, the number y0−dais nonnegative if and only if d ≤ y

0

a. Hence, the “goldilocks zone” for d is the interval

−x0 b ,y0

a

. Let us check whether this interval is nonempty. We have y0

a −−x0 b = x

0a+y0b

ab > ab−a−b

ab since x0a+y0b=n >ab−a−b

=11 a−1

b,

which is ≥ 0 in all interesting cases (the only exception being when a or b is 1, but this case is easy to handle separately). Thus, in all interesting cases, we have

y0

a ≥ −x0 b .

Unfortunately, this is not the whole story. We are not looking for a realnumber d in the interval

−x0 b ,y0

a

, but for an integer d in this interval. Having y0

a ≥ −x0 b

57obviously an integer amount of cents

58See alsohttps://artofproblemsolving.com/community/c6h373for further discussions on what amounts can be paid using two kinds of coins.

guarantees the former but not the latter. How can we guarantee the latter? What must the difference βα of two real numbers α and β satisfy to ensure that the interval [α,β] contains an integer?

It is not hard to see that the answer to this question is “they must satisfy βα ≥ 1”. Unfortunately, this is not true for our “goldilocks zone”; the difference y0

a −−x0 is always <1. So we are stuck. b

Being stuck, let us revisit what we did, in the hopes of finding something im-provable. Did we perhaps throw away some information too early, or make too weak an estimate? One thing that stands out is that we never really used the fact that x0 and y0 are integers.

This turns out to be the key. We said that the number x0+db is nonnegative if and only if d ≥ −x0

b . But we can say something slightly stronger: The number x0+db is nonnegative if and only if d > −x0−1

b . Indeed, we have the following chain of equivalences:

x0+dbis nonnegative

⇐⇒ x0+db≥0

⇐⇒ x0+db>−1

since x0+dbis an integer

⇐⇒ db>−x0−1

⇐⇒

d > −x0−1 b

.

Notice how rewriting “x0+db ≥0” as “x0+db>−1” has improved our inequality!

Likewise, we can see that y0−da is nonnegative if and only if d < y

0+1

a . Thus, our “goldilocks zone”

−x0 b , y0

a

has grown to a wider interval

−x0−1

b ,y0+1 a

(an open interval, not a pair of numbers). And as it turns out, this latter interval has size>1, since

y0+1

a − −x0−1

b = x

0a+y0b+a+b

ab = n+a+b

ab since x0a+y0b =n

>1 (sincen+a+b >ab(because n>ab−a−b)). But an open interval of size>1 must always contain an integer59. Hence, the open interval

−x0−1

b ,y0+1 a

contains an integer d. Picking such a d, we then con-clude that both x0+db andy0−daare nonnegative, and thus there exist nonnega-tive integers x and ysuch that n = xa+yb (namely, x = x0+dband y = y0−da).

Thus, we have found a solution to Exercise 3.8.5.

59Proof. Let (α,β) be an open interval of size > 1. Thus, α and β are real numbers such that βα>1. We must prove that the interval(α,β)contains an integer.

Indeed, it is easy to see thatbαc+1 is an integer contained in this interval(α,β). Check this!

It is instructive to see how short this solution becomes if we forget about the pains we took finding it, and only write down the parts that ended up necessary for the proof:

Solution to Exercise 3.8.5 (final copy). Exercise 3.8.4 yields that there exist integers x and y such that n = xa+yb. Consider these x and y, and denote them by x0 and

+1. Now, we claim the following:

Claim 1: Both integersx0+dband y0daare nonnegative.

We can multiply this inequality byb(sincebis positive), and thus obtain−x0−1<

db. Hence, db > −x0−1, so that x0+db > −1. Since x0+db is an integer, this

(by the first inequality in (56))

+1≥

x01 b

+1=d.

We can multiply this inequality by a (since a is positive), and find y0+1 > da. In other words, y0−da > −1. Since y0−da is an integer, this entails y0−da ≥ 0. In other words,y0−da is nonnegative. This completes our proof of Claim 1.]

Thus, the integers x0+dband y0−daare nonnegative. They furthermore satisfy x0+db

a+ y0−da

b =x0a+dba+y0b−dab =x0a+y0b =n,

so that n = (x0+db)a+ (y0−da)b. Thus, there existnonnegative integers x and ysuch that n= xa+yb(namely, x =x0+dband y=y0−da). This solves Exercise 3.8.5.

Im Dokument Mathematical Problem Solving (Seite 82-91)