Sign in

Libre University uses your GitHub account. Signing in is only needed to sit a final test, so the score is kept on your profile.

Direct proof and proof by cases

Knowing exactly what a statement claims does not tell you how to establish it, and most statements worth proving are conditionals about every number of some kind.

The previous lesson gave the language: "for all", "there exists", and the rules for negating them. It closed on a claim it could state but not prove, that the square of every odd integer is one more than a multiple of 8. This lesson supplies the method, the direct proof, and proves that claim along the way. Along the way it proves the division algorithm, which settles a question the first lesson left open (every integer is even or odd, and none is both), and it covers proofs by cases, inequalities, "if and only if", existence with and without a witness, and disproof by counterexample. It assumes the definitions of parity from the first lesson: an integer n is even when n=2k for some integer k, and odd when n=2k+1 for some integer k.

Assume the hypothesis, reach the conclusion

A conditional P⇒Q is false in exactly one situation: P true and Q false. So to prove it, there is only one situation to rule out. Assume P, and derive Q from it, using definitions, axioms and results already proved. If P happens to be false, the conditional is true anyway, which is why a proof never has to say anything about that case. This is a direct proof: it starts at the hypothesis and walks forward to the conclusion.

Most theorems are also universal. "If an integer is divisible by 4, it is even" means ∀n∈ℤ(4dividesn⇒nis even), and no list of cases can cover every n. The move that does is to let n be arbitrary: name an integer n, assume nothing about it except the hypothesis, and reason about it. Whatever follows then follows for every integer, because nothing in the argument depended on which one was named. The proofs in the previous lesson that ended "as x was arbitrary, the statement holds" used exactly this.

Why does an argument about one n prove the claim for every n?

Because the argument is a template. Take any particular integer, say 12, and substitute it for n in every line of the proof. Each line stays justified, since each justification appealed only to the hypothesis and to rules of algebra that hold for all integers. So the written proof stands for infinitely many proofs, one for each integer, and writing it once with a letter is how a finite text covers an infinite domain.

Logicians call the final step universal generalisation: from a proof of P(n) for an arbitrary n, conclude ∀nP(n). The rule carries a restriction, and every misuse of it breaks the restriction. The name must be genuinely arbitrary: nothing may be assumed about it beyond what the statement's hypothesis grants.

Here is the first way to break it. "Let n be an even integer, so n=2k for some integer k. Then n2=4k2, a multiple of 4. Since n was arbitrary, the square of every integer is a multiple of 4." The n was an arbitrary even integer, not an arbitrary integer, so the conclusion is only that the square of every even integer is a multiple of 4, which is true. The claim about every integer is false: 32=9.

The second way is subtler. "There is a prime; call it p. Then p≥2. Since p was arbitrary, every integer is at least 2." Here p was never arbitrary. It came from an existential statement, so it names one particular object that happens to be unknown to us, and a fact about it is a fact about that one object. The wording marks the difference: "let n be an integer" introduces an arbitrary object, while "there is an integer k with n=2k" introduces a fixed one. In the game of the previous lesson, the sceptic chooses the arbitrary objects, and the proof must win whatever they are.

The Logic course states this rule and its restriction formally, in its lesson on proof with quantifiers, where the restriction becomes a checkable condition on where a name may appear.

Together these fix the opening and closing lines of almost every proof in this course. The first sentence names the arbitrary object and states the hypothesis: "Let n be an integer divisible by 4." The last sentence states the conclusion and says which definition it satisfies: "so n is even." Everything in between is the work, and each line of it must be justified by what came before. In outline, a proof of ∀x(P(x)⇒Q(x)) reads: let x be arbitrary and suppose P(x); then a chain of justified steps; therefore Q(x); since x was arbitrary, the statement holds for every x.

Once n is named, the proof may not quietly assume it is positive, or prime, or small, unless the hypothesis says so. Checking n=4, 8 and 12 is not a proof about an arbitrary n; it is three examples. Nor may two objects share a letter they have not earned. If a and b are both even, then a=2k and b=2m for some integers k and m; writing a=2k and b=2k would prove the claim only for a=b.

Finding a proof usually runs the other way. On scrap paper, write the conclusion out by its definition, so that "n is even" becomes "n=2× (some integer)", and ask what would produce that expression. Then write the argument forwards, from hypothesis to conclusion, for the reader. The scrap paper is how you found the route; the proof is the route. A later section shows what goes wrong when the scrap paper is handed in as the proof.

Divisibility

For integers a and b, a divides b, written a∣b, if there is an integer k with b=ak. Equivalent phrasings are "a is a divisor (or factor) of b" and "b is a multiple of a". So 3∣12 because 12=3×4, and −4∣12 because 12=(−4)(−3). Every integer divides 0, since 0=a×0, and 1 divides every integer. On the other hand 0∣b only when b=0, since 0×k is always 0.

Two points about the notation catch almost everyone once. First, a∣b is a statement, true or false, while ba is a number: "3∣12" is true, and writing "3∣12=4" mixes a sentence with a calculation. Second, the order matters: 3∣12 is true and 12∣3 is false, because no integer k gives 3=12k. The definition avoids division on purpose: it uses only multiplication of integers, so it makes sense even for a=0.

The definition has the same shape as the definitions of even and odd, a "there is an integer k", and it is used in the same two ways. To use a∣b, name the k and write b=ak. To prove a∣b, produce an integer k with b=ak. Parity is a special case: an integer n is even exactly when 2∣n.

Example. Prove that for all integers a, b and c, if a∣b and b∣c, then a∣c.

Let a, b and c be integers with a∣b and b∣c. By the definition of divisibility, there is an integer k with b=ak, and there is an integer m with c=bm. Substituting the first equation into the second gives c=(ak)m=a(km). Since k and m are integers, km is an integer. So c is a times an integer, and by the definition of divisibility, a∣c.

The two quotients get different letters, k and m, because nothing says they are equal. The scrap-paper route was short: the goal asked for c in terms of a, and the hypotheses chain c to b and b to a. This property, transitivity, lets divisibility pass along a chain: from 3∣12 and 12∣60, without any division, 3∣60.

Now you. Prove that for all integers a, b and c, if a∣b and a∣c, then a∣(bx+cy) for all integers x and y.

Answer

Let a, b and c be integers with a∣b and a∣c, and let x and y be any integers. By the definition of divisibility, there are integers k and m with b=ak and c=am. Then bx+cy=akx+amy=a(kx+my). Since k, m, x and y are integers, kx+my is an integer, so by the definition of divisibility, a∣(bx+cy). Taking x=y=1 gives a∣(b+c), and taking x=1, y=−1 gives a∣(b−c).

An expression bx+cy with integer x and y is called an integer linear combination of b and c, and the Now you says that a common divisor of two numbers divides every such combination. It is the most used fact about divisibility. Here it is at work: if d divides both n and n+1, then d divides (n+1)−n=1, so d is 1 or −1. Two consecutive integers share no factor greater than 1.

Divisibility also controls size. The next two facts are used constantly, and the second needs a small case split.

Proposition. Let a and b be integers.

(i) If a∣b and b≠0, then |a|≤|b|.

(ii) If a∣b and b∣a, then a=b or a=−b.

Proof. (i) Suppose a∣b and b≠0, so b=ak for some integer k. If k were 0 then b would be 0, so k≠0, and a non-zero integer has |k|≥1. Therefore |b|=|a||k|≥|a|. (The rule |ak|=|a||k| is proved in the section on absolute value below.)

(ii) Suppose a∣b and b∣a. If a=0, then b∣0 tells us nothing, but a∣b says b=0×k=0, so a=b. If a≠0, then b≠0 as well, since 0∣a would force a=0. Now (i) applies both ways: |a|≤|b| and |b|≤|a|, so |a|=|b|, which means a=b or a=−b. □

Part (i) is the reason no integer greater than 1 divides 1, a fact the next lesson leans on in Euclid's proof that the primes never run out. Part (ii) shows why the sign needs care: 3∣−3 and −3∣3, and 3≠−3.

Three things divisibility does not do are worth knowing before they are needed. It does not cancel freely: 4∣2×6 does not give 4∣6. It does not distribute over sums in reverse: a∣b+c does not give a∣b. And "a∣b" is not "a≤b": 5∣−10 and 5∣0 although 5 exceeds both.

Working backwards, writing forwards

Inequalities show the gap between finding a proof and writing one most sharply. Take the claim that x2+y2≥2xy for all real numbers x and y. The natural scrap work starts from the goal: x2+y2≥2xy, so x2−2xy+y2≥0, so (x−y)2≥0, which is true because squares are never negative. Every line is correct algebra and the claim is true. But as written, the argument runs from the claim to a known fact, so what it proves is the conditional "if x2+y2≥2xy, then (x−y)2≥0", which is the wrong way round.

To see that an argument of this shape proves nothing, run it on a false claim. "Claim: −2=2. Proof: squaring both sides gives 4=4, which is true." The algebra is flawless and the claim is false. The truth table of the conditional explains it: P⇒Q is true when P is false and Q is true, so a false statement can imply a true one. Truth travels forwards along an implication, from hypothesis to conclusion, and never backwards. Reaching a true statement from the claim says nothing about the claim.

The repair is to run the scrap work in reverse. Let x and y be real numbers. The square of a real number is non-negative, so (x−y)2≥0. Expanding, x2−2xy+y2≥0, and adding 2xy to both sides gives x2+y2≥2xy. Now each line follows from the one before, and the chain starts at a known fact. The reversal worked because every step of the scrap work could be undone; if one of them cannot, the scrap work has found no proof at all.

Example. Prove that for all non-negative real numbers x and y, xy≤x+y2, with equality exactly when x=y.

The two sides are the geometric mean and the arithmetic mean of x and y. On scrap paper: the goal is 2xy≤x+y, that is, 0≤x−2xy+y. Since x and y are non-negative, x=(x)2, y=(y)2 and xy=xy, so the right-hand side is (x−y)2. That suggests where the written proof should start.

Let x and y be non-negative real numbers. Then x and y are real numbers with (x)2=x, (y)2=y and xy=xy (that square roots exist is proved in the lesson on the real numbers). The square of the real number x−y is non-negative, so

0≤(x−y)2=x−2xy+y

Adding 2xy to both sides and dividing by 2 gives xy≤x+y2. Equality holds exactly when (x−y)2=0, that is, when x=y, and since the square root of a non-negative number determines the number, that is exactly when x=y.

The hypothesis earned its place: for x=y=−1 the left side is 1=1 and the right side is −1. Geometrically, a rectangle with sides x and y has area xy, and the square with the same perimeter has side x+y2, so the inequality says that the square encloses at least as much.

Now you. Prove that x+1x≥2 for every positive real number x, and find when equality holds. Where does the proof use that x is positive?

Answer

Scrap work: multiplying the goal by x gives x2+1≥2x, which is (x−1)2≥0. Written forwards:

Let x be a positive real number. Then (x−1)2≥0, so x2−2x+1≥0, and so x2+1≥2x. Dividing both sides by the positive number x keeps the direction of the inequality, and gives x+1x≥2. Equality holds exactly when (x−1)2=0, that is, when x=1.

Positivity was used in the division. It cannot be dropped: at x=−1, x+1x=−2. Another route is the Example with y=1x: then xy=1, and 1≤12(x+1x).

Is it ever safe to argue from the conclusion?

Yes, when every step is reversible and the proof says so. A chain P⟺P1⟺P2⟺⋯⟺Pn in which Pn is known to be true does prove P, because read from right to left it is a chain of implications ending at P. A proof in this style writes "⟺", or "which holds if and only if", at each step, and the reader must check each step in both directions. That doubles the checking, which is why the forward version is usually preferred.

Some operations can always be undone. Adding the same number to both sides of an equation or inequality is reversed by subtracting it. Multiplying both sides of an equation by a non-zero number is reversed by dividing. Multiplying both sides of an inequality by a positive number is reversed the same way. Squaring is reversible for non-negative quantities: if a≥0 and b≥0, then a≤b exactly when a2≤b2. To see this, write b2−a2=(b−a)(b+a). If a+b>0, the product has the same sign as b−a; if a+b=0, both are 0 and both inequalities hold.

Other operations cannot be undone. Squaring numbers whose signs are unknown loses information, as (−2)2=22 showed. Multiplying by something that might be 0 turns any equation into 0=0. Multiplying an inequality by something that might be negative can reverse its direction.

School algebra meets the same issue under another name. Solve x+2=x by squaring: x+2=x2, so (x−2)(x+1)=0 and x=2 or x=−1. The first works, since 4=2. The second does not, since 1=1≠−1. The "extraneous root" is exactly the backward direction failing: squaring showed that every solution is among 2 and −1, not that both are solutions. Whenever a step is not reversible, the argument proves only one direction, and the other must be checked separately.

Division with remainder

Dividing 17 by 5 gives quotient 3 and remainder 2, since 17=5×3+2. School arithmetic takes for granted that such a pair always exists and that there is only one. Both halves need proof, and both are needed here: existence gives every integer a remainder, and uniqueness makes the remainder a label that can be relied on.

The existence proof rests on one property of the natural numbers, which this course takes as basic.

The well-ordering principle. Every non-empty set of natural numbers has a least element.

It is not true of every number system. The integers have no least element, and neither do the positive rationals, since half of any positive rational is a smaller one. The principle holds equally for sets of non-negative integers: add 1 to every member of such a set, take the least element of the resulting set of natural numbers, and subtract 1 again. The induction lesson shows that well-ordering and the principle of induction are two forms of the same fact about ℕ.

Theorem (the division algorithm). Let a and b be integers with b>0. There are unique integers q and r with a=bq+r and 0≤r<b.

The number q is the quotient and r the remainder on dividing a by b, and the remainder is written amodb. Despite its traditional name, the result is a theorem, not a procedure, and its two parts, existence and uniqueness, get separate proofs.

Proof of existence. Let S be the set of all non-negative integers of the form a−bk, where k is an integer. First, S is not empty. Take k=−|a|. Then a−bk=a+b|a|≥a+|a|≥0, using b≥1 for the first inequality and |a|≥−a for the second. So by the well-ordering principle, S has a least element r, and since r is in S, r=a−bq for some integer q. Then a=bq+r and r≥0.

It remains to show r<b. Consider r−b=a−b(q+1). It has the form a−bk, and it is smaller than r because b>0. Since r is the least element of S, the number r−b is not in S, and a number of the form a−bk can be missing from S only by being negative. So r−b<0, that is, r<b.

Proof of uniqueness. Suppose a=bq+r and a=bq′+r′, where q, q′, r, r′ are integers with 0≤r<b and 0≤r′<b. The two representations play identical roles, so we may name them so that r≤r′. Then 0≤r′−r<b, since r′<b and r≥0. Subtracting the two equations gives r′−r=b(q−q′), so 0≤b(q−q′)<b, and dividing by the positive number b gives 0≤q−q′<1. The only integer in that range is 0, so q=q′, and then r=a−bq=a−bq′=r′. □

Why does the existence proof need the well-ordering principle?

The informal argument is: subtract b from a over and over (or add it, if a is negative) until the result lands in the range 0 to b−1. It lands there because the values move in steps of exactly b, the width of the target, so they cannot jump over it. The question a proof must answer is why the process stops, and "the values a, a−b, a−2b, and so on decrease, and a decreasing sequence of non-negative integers cannot go on for ever" is the well-ordering principle in other words. The formal proof goes straight to where the process ends: the least non-negative value of a−bk.

The property is special to the integers. Among the positive rationals there is no least element at all, which is why "divide 12 by 13 with remainder" needs the quotient to be declared an integer before it means anything. With the quotient an integer, the theorem does extend to real a and b, but then the existence proof needs a new ingredient, the fact that the integers are not bounded above inside ℝ, which is part of what makes the real numbers the real numbers.

The theorem is the start of number theory. Applied repeatedly, it gives Euclid's algorithm for the greatest common divisor, the subject of the Discrete Mathematics lesson on divisibility, and arithmetic that keeps only remainders is modular arithmetic. It also generalises. Polynomials with real coefficients can be divided with remainder, with degree playing the part of size: for polynomials f and g with g not the zero polynomial, there are unique polynomials q and r with f=gq+r and either r=0 or r of smaller degree than g. The existence proof is this one again, taking an r of least degree. Number systems with such a division are called Euclidean domains, and most of the theory of the integers carries over to them.

The condition 0≤r<b decides what happens for negative a: −17=5×(−4)+3, so −17mod5=3. The pair q=−3, r=−2 also satisfies −17=5q+r, but r is out of range, and uniqueness says 3 is the only remainder in range.

Uniqueness gives a test for divisibility: b∣a exactly when amodb=0. If the remainder is 0, then a=bq. Conversely, if a=bk for some integer k, then a=bk+0 is a representation with remainder in range, so by uniqueness the remainder is 0.

It also pays the debt from the first lesson.

Corollary. Every integer is even or odd, and no integer is both.

Proof. Let n be an integer. Dividing by 2 gives n=2q+r with 0≤r<2, so r=0 or r=1. If r=0 then n=2q is even, and if r=1 then n=2q+1 is odd. Now suppose n=2k and n=2m+1 for integers k and m. These are two representations n=2q+r with remainders 0 and 1, both in range, so uniqueness would make 0=1. Hence no integer is both. □

The same argument with b=3 shows that every integer has exactly one of the forms 3k, 3k+1, 3k+2, and in general, for b>0, every integer has exactly one of the forms bk, bk+1, and so on up to bk+(b−1). That splits the integers into b classes, and a proof about all integers can take them one at a time.

Proof by cases

Sometimes no single argument covers every value, but a few arguments do, each covering part. A proof by cases splits the hypothesis into possibilities that together exhaust it, and gives a direct proof in each. Its logic is the rule for "or": if P1∨P2 holds, and P1⇒Q and P2⇒Q both hold, then Q holds.

The commonest split is by parity, which the corollary above has now made legitimate. Take the claim that n2+n is even for every integer n.

Let n be an integer. If n is even, then n=2k for some integer k, and n2+n=4k2+2k=2(2k2+k), which is even. If n is odd, then n=2k+1 for some integer k, and n2+n=(4k2+4k+1)+(2k+1)=2(2k2+3k+1), which is even. Since every integer is even or odd, n2+n is even in every case.

A result once proved becomes a tool. Here is the previous lesson's open claim. Let n be an odd integer, so n=2k+1 for some integer k. Then n2=4k2+4k+1=4(k2+k)+1. By the result just proved, applied to the integer k, there is an integer m with k2+k=2m. So n2=8m+1, and 8∣(n2−1). For n=7 that is 49=8×6+1, and for n=11 it is 121=8×15+1. No case split was needed in this proof; the one inside the lemma did the work.

Two things make a case split sound. The cases must between them cover everything: a proof about all integers that treats n=3k and n=3k+1 has proved nothing about 5. And each case must be proved using only what that case supplies, plus what was assumed for all of them. The cases may overlap harmlessly, for instance "x≥0" and "x≤0" share x=0, but none may be missing.

Parity is division by 2, and the division algorithm allows division by anything. Splitting by the remainder on division by 4, or 3, or 10, is how most facts about squares and powers are proved.

Example. Prove that no integer of the form 4k+3 is a sum of two squares of integers.

The claim says a certain thing does not exist, and the previous lesson turned such a claim into a universal one: ¬∃ is ∀¬. So the claim is that for all integers x and y, the sum x2+y2 does not leave remainder 3 on division by 4, and that has a direct proof. First a lemma about single squares.

Lemma. The square of every integer has the form 4m or 4m+1 for some integer m. Let n be an integer. If n is even, n=2k, and n2=4k2, which has the form 4m with m=k2. If n is odd, n=2k+1, and n2=4k2+4k+1=4(k2+k)+1, which has the form 4m+1.

Now let x and y be integers. By the lemma, x2=4s+e and y2=4t+f for some integers s and t, where each of e and f is 0 or 1. Then x2+y2=4(s+t)+(e+f), and e+f is 0, 1 or 2. In every case this writes x2+y2=4q+r with 0≤r<4 and r≠3. By the uniqueness of the remainder, the remainder of x2+y2 on division by 4 is not 3, so x2+y2 is not of the form 4k+3.

So 3, 7, 11, 15, 19 and every fourth number after them are never sums of two squares, a fact about infinitely many numbers and all pairs of integers, settled by four small cases. The converse fails: 21=4×5+1 is not a sum of two squares, since none of 21−0, 21−1, 21−4, 21−9, 21−16 is a square. Remainders give a necessary condition, not a sufficient one. For primes the full answer is a famous theorem: Fermat claimed in a letter to Marin Mersenne on Christmas Day 1640 that an odd prime is a sum of two squares exactly when it has the form 4k+1, as 5=1+4, 13=4+9 and 29=4+25 do. The Example is the easy half; Euler proved the hard half more than a century later.

Now you. Prove that the square of every integer has the form 3m or 3m+1, and deduce that no integer of the form 3k+2 is a perfect square.

Answer

Let n be an integer. By the division algorithm, n has exactly one of the forms 3k, 3k+1, 3k+2 for some integer k.

If n=3k, then n2=9k2=3(3k2). If n=3k+1, then n2=9k2+6k+1=3(3k2+2k)+1. If n=3k+2, then n2=9k2+12k+4=3(3k2+4k+1)+1. In each case n2 has the form 3m or 3m+1 with m an integer.

So the remainder of any square on division by 3 is 0 or 1, and by uniqueness of the remainder it is never 2. Hence no integer of the form 3k+2 is a square. For instance 2, 5, 8, 11 and 1000000001=3×333333333+2 are not squares. Notice that the third case lands on remainder 1 only because 4=3+1: the remainder of the square depends only on the remainder of the number.

How many cases can a proof have?

As many as can be checked. Logic puts no limit on the number: a proof by cases, or proof by exhaustion, is valid when the cases provably cover everything and each is proved. What separates it from checking examples is that first requirement. Checking n=1 to a million covers a million cases out of infinitely many, while the four cases above cover every integer because the division algorithm says so.

In 1976 Kenneth Appel and Wolfgang Haken proved the four colour theorem, that every map drawn in the plane can be coloured with four colours so that regions sharing a border differ, by reducing it to nearly two thousand configurations and checking each by computer, over some twelve hundred hours of machine time. The proof was controversial, since no person could read all of it. In 1996 Neil Robertson, Daniel Sanders, Paul Seymour and Robin Thomas gave a cleaner proof with 633 configurations, still checked by machine, and in 2005 Georges Gonthier verified the whole argument in the Coq proof assistant, software that checks every logical step. Thomas Hales's proof of the Kepler conjecture (that no packing of equal spheres is denser than the greengrocer's stack of oranges), announced in 1998, went the same way: the referees reported being "99% certain" of the computer case analysis, and a formal verification by Hales's Flyspeck project was completed in 2014.

These are proofs by cases in exactly this lesson's sense. The computer changes who checks the cases, not what makes the argument valid, and the doubts they raised were answered by making every step checkable by a program far smaller than the proof.

Absolute value and the triangle inequality

The absolute value of a real number is itself defined by cases: |x|=x if x≥0, and |x|=−x if x<0. So |5|=5 and |−5|=−(−5)=5. Geometrically, |x| is the distance from x to 0 on the number line, and |x−y| is the distance between x and y. Any claim about absolute values invites a proof by cases on signs, because in each case the bars can be replaced by something plain. The basic facts come first.

Lemma. For all real numbers x, y and a:

(i) |x|≥0, with |x|=0 only when x=0;

(ii) |−x|=|x| and |xy|=|x||y|;

(iii) −|x|≤x≤|x|;

(iv) |x|≤a if and only if −a≤x≤a.

Proof. (i) If x≥0, then |x|=x≥0, and |x|=0 means x=0. If x<0, then |x|=−x>0.

(ii) For |xy|=|x||y|, split on signs. If x≥0 and y≥0, then xy≥0, so |xy|=xy=|x||y|. If x<0 and y<0, then xy>0, so |xy|=xy=(−x)(−y)=|x||y|. If x≥0 and y<0, then xy≤0, so |xy|=−xy=x(−y)=|x||y|; here, when xy=0, both readings of |xy| give 0, so the formula |xy|=−xy is still right. The case x<0≤y is the same with x and y exchanged. Taking y=−1 gives |−x|=|x||−1|=|x|.

(iii) If x≥0, then x=|x|, and −|x|=−x≤0≤x. If x<0, then |x|=−x, so −|x|=x, and x<0<|x|.

(iv) Suppose |x|≤a. By (iii), x≤|x|≤a and −a≤−|x|≤x. Conversely, suppose −a≤x≤a. If x≥0, then |x|=x≤a. If x<0, then |x|=−x≤a, because −a≤x. □

Part (iv) says that |x|≤a means "x lies within a of 0", and it is how inequalities with absolute values are unpacked in practice. The same proof with strict inequalities shows that |x|<a exactly when −a<x<a.

Theorem (the triangle inequality). For all real numbers x and y, |x+y|≤|x|+|y|.

First proof, by cases. Let x and y be real numbers. There are three cases, according to their signs.

If x≥0 and y≥0, then x+y≥0, so |x+y|=x+y=|x|+|y|.

If x<0 and y<0, then x+y<0, so |x+y|=−(x+y)=(−x)+(−y)=|x|+|y|.

If one is non-negative and the other negative, the claim is symmetric in x and y, so we may suppose x≥0>y. Then |x|=x and |y|=−y. Now |x+y| is either x+y or −(x+y). In the first event, x+y<x≤x−y=|x|+|y|, since y<0. In the second, −(x+y)=−x−y≤−y≤x−y=|x|+|y|, since x≥0.

The three cases exhaust all pairs of real numbers, and the inequality holds in each. □

Checking only the first two cases would prove nothing about x=3, y=−5, and that is where the inequality is strict: |3+(−5)|=2, while |3|+|−5|=8.

Second proof, from the lemma. Let x and y be real numbers. By (iii), −|x|≤x≤|x| and −|y|≤y≤|y|. Adding these inequalities gives −(|x|+|y|)≤x+y≤|x|+|y|, and by (iv), with a=|x|+|y|, this says |x+y|≤|x|+|y|. □

The second proof is shorter because the cases were paid for once, in the lemma, and then reused. That is the usual pattern: a case split belongs at the lowest level where it is needed, inside a lemma that is proved once, rather than repeated in every theorem that uses it.

The name comes from geometry. Replace x by x−y and y by y−z, and the inequality becomes

|x−z|≤|x−y|+|y−z|

for all real x, y and z: the distance from x to z is at most the distance travelled by going through y. In the plane, it says that one side of a triangle is no longer than the other two together. Rearranged, it also gives a lower bound.

Corollary (the reverse triangle inequality). For all real numbers x and y, ||x|−|y||≤|x−y|.

Proof. Let x and y be real. Since x=(x−y)+y, the triangle inequality gives |x|≤|x−y|+|y|, so |x|−|y|≤|x−y|. Exchanging the roles of x and y gives |y|−|x|≤|y−x|, and |y−x|=|x−y| by (ii), so −|x−y|≤|x|−|y|. Together, −|x−y|≤|x|−|y|≤|x−y|, and by (iv) this says ||x|−|y||≤|x−y|. □

These two inequalities are the everyday tools of analysis. The lesson on limits uses the triangle inequality to prove that a sequence cannot converge to two different limits and that the limit of a sum is the sum of the limits, and the reverse form shows that if an→L then |an|→|L|.

Without loss of generality

The first proof of the triangle inequality treated the case x≥0>y and skipped the case y≥0>x. That was honest because the statement is symmetric in x and y: exchanging the two letters turns |x+y|≤|x|+|y| into |y+x|≤|y|+|x|, which says the same thing. So the written argument for x≥0>y, with the letters exchanged throughout, is an argument for y≥0>x, and writing it out again would add nothing. The phrase for this move is without loss of generality, often shortened to WLOG: "without loss of generality, x≥0>y". The uniqueness half of the division algorithm used it too, when it named the two remainders so that r≤r′.

The phrase is a promise that the omitted cases follow from the treated one by a symmetry, and a reader is entitled to ask which symmetry. The test is mechanical: apply the symmetry to the whole statement, hypotheses included, and check that the same statement comes back. Good writing names it: "the statement is symmetric in x and y, so we may assume x≤y."

Here is what failing the test looks like. "Claim: for all real numbers x and y, y−x≥0. Proof: without loss of generality x≤y, and then y−x≥0." Exchanging x and y turns the claim into x−y≥0, a different statement, so the case x>y was lost, not saved; the claim fails at x=1, y=0. Hypotheses must survive the exchange too. In "let a be even and b odd; without loss of generality a≤b", the exchange would make b the even one, so the assumption is not free.

Used properly, the move saves a great deal. A statement symmetric in three variables allows "without loss of generality x≤y≤z", one ordering in place of six, and a statement unchanged when n is replaced by −n allows "without loss of generality n≥0". When the symmetry is not obvious, write the second case out.

If and only if

A biconditional P⟺Q is the conjunction of two conditionals, P⇒Q and Q⇒P, so a proof of it is two proofs. Label them, so the reader knows which is which: the forward direction (⇒) assumes P and reaches Q, and the backward direction (⇐) assumes Q and reaches P. The two may need quite different arguments, and either may be proved by any method, including a contrapositive, which proves Q⇒P in the form ¬P⇒¬Q.

The classic mistake is to prove one direction and believe both are done, usually because the easy direction was proved and the other looked like "the same thing backwards". Take "an integer n is even if and only if n2 is even". The forward direction is one line: n=2k gives n2=2(2k2). The backward direction is the claim this lesson cannot yet prove, as its last section explains.

A convention to know: definitions are written with "if" but mean "if and only if". "An integer is even if it is twice an integer" also means that an integer that is not twice an integer is not even. Theorems do not get this licence; in a theorem, "if" means only "if".

Example. Prove that for every integer n, 6∣n if and only if 2∣n and 3∣n.

Let n be an integer.

(⇒) Suppose 6∣n, so n=6k for some integer k. Then n=2(3k) and n=3(2k), and 3k and 2k are integers, so 2∣n and 3∣n.

(⇐) Suppose 2∣n and 3∣n, so n=2k and n=3m for some integers k and m. The goal is a factor of 6, and 6 appears if each expression for n is multiplied by the other divisor. Since n=3n−2n,

n=3(2k)−2(3m)=6k−6m=6(k−m)

and k−m is an integer, so 6∣n.

The backward direction is not a formality, and it does not hold for every pair of divisors: 2∣4 and 4∣4, but 8 does not divide 4. It worked because 3×1−2×1=1, an integer combination of 2 and 3 equal to 1. The same trick shows that whenever ax+by=1 for some integers x and y, a number divisible by both a and b is divisible by ab. For 2 and 4 no such combination exists, since 2x+4y is always even.

Now you. Prove that for all integers a and b, a−b is even if and only if a and b have the same parity (both even or both odd).

Answer

Let a and b be integers.

(⇒) Suppose a−b is even, so a−b=2k for some integer k, and a=b+2k. By the corollary to the division algorithm, b is even or odd. If b is even, b=2m, and a=2(m+k) is even, so both are even. If b is odd, b=2m+1, and a=2(m+k)+1 is odd, so both are odd. Either way a and b have the same parity.

(⇐) If both are even, a=2k and b=2m, so a−b=2(k−m). If both are odd, a=2k+1 and b=2m+1, so a−b=2(k−m). Either way a−b is even.

Each direction was a proof by cases, split on different things: the forward direction on the parity of b, the backward direction on which kind of "same parity" was assumed.

Longer lists of equivalent statements are proved in a cycle. To show that P, Q and R are all equivalent, it is enough to prove P⇒Q, Q⇒R and R⇒P: three proofs instead of six, since any one of the statements leads round the cycle to each of the others. Textbooks announce this as "the following are equivalent", and the order of the cycle is chosen to make each step easy.

Proving that something exists

A claim ∃xP(x) is proved most plainly by producing an x and checking P(x). Such a proof is constructive. When the claim is ∀k∃n, the n may depend on k, so the proof must give a recipe that turns each k into a suitable n.

Take the claim that for every natural number k there are k consecutive natural numbers, none of them prime. Let k be a natural number and write N=(k+1)!, the product 1×2×⋯×(k+1). Consider the k numbers N+2,N+3,…,N+(k+1). Each has the form N+j with 2≤j≤k+1. Then j∣N, since j is one of the factors of N, and j∣j, so j∣(N+j) because a common divisor divides a sum. As 2≤j<N+j, the number N+j has a divisor other than 1 and itself, so it is not prime.

For k=5 the recipe gives N=720 and the run 722 to 726. It is far from the first such run, which is 24 to 28. A constructive proof must produce a witness, not the best one. The result also says something that sounds like the opposite of the next lesson's theorem that the primes never run out: there are gaps between consecutive primes as long as you like.

Many theorems claim more than existence: there is exactly one such object. That is two claims, and each needs its own proof. Existence is proved as above. Uniqueness is a universal claim, "any two objects with the property are equal", and is proved by letting two such objects be arbitrary and showing they coincide, as the division algorithm did with (q,r) and (q′,r′). Showing that one candidate works and that no other one comes to mind proves existence only.

Some existence proofs never say which object works. Here is the classic, which assumes that 2 is irrational (the next lesson proves it).

Example. Prove that there are irrational numbers a and b with ab rational.

Consider the real number 22. It is either rational or irrational. If it is rational, take a=b=2: both are irrational and ab=22 is rational. If it is irrational, take a=22 and b=2, both irrational, and then ab=(22)2=22⋅2=22=2, which is rational. In either case a suitable pair exists.

This is a proof by cases in which the cases are never resolved. It establishes that one of two pairs works without saying which, so it is non-constructive. The argument was published by Dov Jarden in 1953. The answer is known from outside the proof: a theorem proved independently by Aleksandr Gelfond and Theodor Schneider in 1934 implies that 22 is irrational (indeed not the root of any polynomial with integer coefficients), so the second pair is the one.

Now you. Given that 2 and log29 are irrational, give a constructive proof of the same claim.

Answer

Take a=2 and b=log29, both irrational. Since 2=212, we get ab=212log29=2log23=3, using 12log29=log2912=log23. So ab is rational, and this time the pair is named. (That log29=2log23 is irrational follows from the irrationality of log23, which the next lesson proves.)

Some mathematicians, the constructivists, reject non-constructive proofs, because they rest on the claim that every statement is true or false even when nobody can say which.

Is a proof that names no witness really a proof?

In the mathematics taught in this course, yes. The Example uses one principle beyond the definitions, the law of excluded middle: for every statement P, either P or ¬P. Applied to "22 is rational", it licenses the case split, and each case is then proved. Accept the law, and the proof is complete.

Not everyone accepts it. Early in the twentieth century the Dutch mathematician L. E. J. Brouwer argued that, for statements about infinite collections, asserting "P or not P" claims knowledge nobody has, and that to prove something exists is to show how to find it. His intuitionism, and the constructive mathematics that grew from it, rejects the law of excluded middle, and with it the Example. David Hilbert answered in 1927 that taking the law of excluded middle from the mathematician would be like denying the telescope to the astronomer or the use of his fists to the boxer. Mainstream mathematics sided with Hilbert, but the constructive view never went away, and it returned with computers: in constructive logic, a proof of ∀x∃yP(x,y) contains a program computing y from x, and some proof assistants are built on this idea.

Non-constructive proofs can say surprising things. Chomp, a game popularised by David Gale in 1974, is played on a rectangular bar of chocolate whose bottom-left square is poisoned; players alternately choose a square and eat it together with every square above and to the right of it, and whoever must eat the poisoned square loses. The game always ends and cannot be drawn, and in such a game one of the two players has a winning strategy. On any rectangle larger than one square it is the first player. For suppose the second player could always win, and let the first player open by eating only the top-right square. The second player has a winning reply to that. But every move eats the top-right square along with the rest, so the first player could have made that same reply as the opening move, reaching the same position, and then won by following the second player's strategy. So the second player cannot always win. The argument proves a winning first move exists without naming it, and for most rectangles nobody knows what it is.

Examples, counterexamples and finite checks

A universal claim over an infinite domain is proved only by an argument about an arbitrary element, and no number of examples will do. It is disproved by a single counterexample: one value that satisfies the hypothesis and fails the conclusion. A disproof should state the counterexample and verify it, since a value that fails the hypothesis refutes nothing.

Many exercises, and most real questions, say "prove or disprove", and the first job is to decide which. Try examples first, and choose them to be awkward: 0, 1 and −1, negative numbers, equal values, the smallest case the hypothesis allows. If a counterexample appears, the question is settled. If none does, attempt a proof and watch where it strains: a step that fails usually points to the values where the claim fails.

Example. Prove or disprove each claim. (a) The sum of any three consecutive integers is divisible by 3. (b) The sum of any four consecutive integers is divisible by 4.

(a) Examples: 1+2+3=6, 4+5+6=15, −1+0+1=0, all divisible by 3. So attempt a proof. Let n be an integer; the three consecutive integers starting at n are n, n+1 and n+2, and their sum is 3n+3=3(n+1). Since n+1 is an integer, 3 divides the sum. The claim is true.

(b) The first example, 1+2+3+4=10, already fails: 10=4×2+2, so 4 does not divide it. The claim is false, and this one counterexample disproves it. The attempted proof shows more. The sum n+(n+1)+(n+2)+(n+3)=4n+6=4(n+1)+2 always leaves remainder 2, so the sum of four consecutive integers is never divisible by 4. A counterexample settles the question; the algebra explains it.

Now you. Prove or disprove each claim, for all integers a, b and c. (a) If a∣b+c and a∣b−c, then a∣2b. (b) If a∣b+c and a∣b−c, then a∣b.

Answer

(a) True. Let a, b and c be integers with a∣b+c and a∣b−c. A common divisor of two integers divides their sum, and (b+c)+(b−c)=2b, so a∣2b.

(b) False. Take a=2 and b=c=1. Then b+c=2 and b−c=0, both divisible by 2, but 2 does not divide 1.

Part (a) suggests the repair. The claim in (b) becomes true when a is odd: writing a=2t+1, we have b=ab−t(2b), and a divides both ab and 2b, hence divides b. This is the combination trick from the section on "if and only if", with a×1−2×t=1.

Checking examples is a proof in one situation: when the domain is finite, and every element is checked. The division algorithm can make an infinite domain finite. Take the claim that the last digit of every perfect square is 0, 1, 4, 5, 6 or 9. Let n be an integer, and divide by 10: n=10q+r with 0≤r≤9. Then

n2=100q2+20qr+r2=10(10q2+2qr)+r2

so n2 and r2 leave the same remainder on division by 10 (write r2=10t+s with 0≤s≤9 and apply uniqueness), and the remainder of a non-negative integer on division by 10 is its last digit. So the last digit of n2 is the last digit of one of 0,1,4,9,16,25,36,49,64,81, which is one of 0,1,4,9,6,5,6,9,4,1. That is ten checks, and they settle every integer, because the division algorithm proves that the ten remainders are all there are. So 1234567 is not a square, and no search was needed to see it.

Where the direct route stalls

Every proof above ran forwards: unpack the hypothesis by its definition, then rearrange, split into cases or construct, until the conclusion's definition appears. Try the same on "for every integer n, if n2 is even then n is even". Let n be an integer with n2 even, so n2=2k for some integer k. The goal is n=2× (an integer), and all the hypothesis offers is n=±2k, which is not visibly twice anything.

The hypothesis is about n2 and the conclusion is about n, and information does not flow backwards through squaring. Cases on the parity of n only help by ruling the odd case out, which is a different method in disguise. The statement is true, and the next lesson proves it by turning the conditional round, the same move that proves 2 irrational.

Problems

Work each problem on paper before opening anything; for Core and Challenge problems, try the hint before the solution.

Warm-up

1. Using only the definition of divisibility, decide which of these are true: −6∣42, 42∣−6, 0∣0, 0∣5, 11∣0.

Solution

−6∣42 is true, since 42=(−6)(−7) and −7 is an integer.

42∣−6 is false: by part (i) of the proposition on divisibility and size, it would give 42≤|−6|=6.

0∣0 is true, since 0=0×1. The statement is true even though 00 is undefined, which is one more reason to keep "a∣b" (a statement) apart from "ba" (a number).

0∣5 is false, since 0×k=0≠5 for every integer k.

11∣0 is true, since 0=11×0.

2. For each pair, find the integers q and r given by the division algorithm, so that a=bq+r and 0≤r<b: (a) a=100, b=7; (b) a=−100, b=7; (c) a=5, b=12; (d) a=−1, b=12.

Solution

(a) 100=7×14+2, so q=14 and r=2.

(b) −100=7×(−15)+5, since 7×(−15)=−105. So q=−15 and r=5. The tempting answer q=−14 gives −100=−98−2, with remainder −2, which is out of range.

(c) 5=12×0+5, so q=0 and r=5. When 0≤a<b, the quotient is 0 and the remainder is a itself.

(d) −1=12×(−1)+11, so q=−1 and r=11.

In each case 0≤r<b holds, so by uniqueness these are the only answers.

3. Prove that for all integers a, b and c: (a) if a∣b then a∣bc; (b) if a∣b then a2∣b2; (c) if a∣b then −a∣b and a∣−b.

Solution

Let a, b and c be integers with a∣b, so b=ak for some integer k.

(a) Then bc=(ak)c=a(kc), and kc is an integer, so a∣bc.

(b) Then b2=a2k2=a2(k2), and k2 is an integer, so a2∣b2.

(c) Then b=(−a)(−k) and −b=a(−k), and −k is an integer, so −a∣b and a∣−b.

4. Prove that for all real numbers x and a, |x−3|<a if and only if 3−a<x<3+a. Use this to find all real x with |2x−6|<1.

Solution

Let x and a be real numbers. By the strict form of part (iv) of the lemma on absolute value, applied to the number x−3, we have |x−3|<a if and only if −a<x−3<a. Adding 3 to each part is reversible (subtract 3 to undo it), so this holds if and only if 3−a<x<3+a.

For the second part, |2x−6|=|2(x−3)|=|2||x−3|=2|x−3| by part (ii) of the lemma. So |2x−6|<1 if and only if |x−3|<12, which by the first part holds if and only if 52<x<72. These are exactly the real numbers within 12 of 3.

Core

5. Prove that for every odd integer n, the number n4−1 is divisible by 16. Show by an example that 16 cannot be replaced by 32.

Hint

Factor n4−1 as a difference of two squares, and use the fact proved in the lesson that the square of an odd integer has the form 8m+1.

Solution

Let n be an odd integer. By the result proved in the section on proof by cases, n2=8m+1 for some integer m. Then

n4−1=(n2−1)(n2+1)=(8m)(8m+2)=16m(4m+1)

and m(4m+1) is an integer, so 16∣n4−1.

For n=3, n4−1=80=16×5, and 32 does not divide 80, since 80=32×2+16 has remainder 16. So the claim with 32 in place of 16 is false, and n=3 is a counterexample.

6. Prove or disprove each claim, for all integers a, b and c. (a) If ab∣c then a∣c. (b) If a∣c and b∣c then ab∣c. (c) If a2∣b then a∣b. (d) If a∣b2 then a∣b.

Hint

Two are true and have one-line proofs. For the other two, try small values, including a=b in (b) and a perfect square for a in (d).

Solution

(a) True. Let a, b, c be integers with ab∣c, so c=abk for some integer k. Then c=a(bk), and bk is an integer, so a∣c.

(b) False. Take a=b=c=2. Then a∣c and b∣c, but ab=4 does not divide 2 (by part (i) of the proposition, a divisor of 2 has size at most 2). The claim does hold when a and b have an integer combination equal to 1, by the argument in the section on "if and only if", and 2 and 2 do not.

(c) True. Let a, b be integers with a2∣b, so b=a2k for some integer k. Then b=a(ak), and ak is an integer, so a∣b.

(d) False. Take a=9 and b=3. Then b2=9 and 9∣9, but 9 does not divide 3, since a divisor of 3 has size at most 3.

7. Find the flaw in this proof, show that the claim is false, and state and prove a correct claim about the sum of an even and an odd integer.

Claim. The sum of an even integer and an odd integer is one more than a multiple of 4.

Proof. Let m be even and n odd. Then m=2k and n=2k+1 for some integer k. So m+n=4k+1, which is one more than a multiple of 4.

Hint

Ask what the proof has assumed about how m and n are related.

Solution

The definitions give m=2k for some integer k and n=2j+1 for some integer j, and nothing says j=k. By using one letter for both, the proof assumed n=m+1, so it proved the claim only for an even integer and the odd integer immediately after it. For those it is correct: m+(m+1)=4k+1.

The claim itself is false. Take m=2 and n=5: then m+n=7=4×1+3, which by uniqueness of the remainder is not of the form 4q+1.

A correct claim is that the sum of an even integer and an odd integer is odd. Let m be even and n odd, so m=2k and n=2j+1 for some integers k and j. Then m+n=2(k+j)+1, and k+j is an integer, so m+n is odd.

8. Find the flaw in this argument.

Let a and b be real numbers with a=b and b≠0. Multiplying both sides by a gives a2=ab. Subtracting b2 gives a2−b2=ab−b2. Factorising, (a+b)(a−b)=b(a−b). Dividing by a−b gives a+b=b. Since a=b, this says 2b=b, and dividing by b gives 2=1.

Hint

Each step but one is valid algebra. Which operation is only allowed under a condition, and does the condition hold here?

Solution

The flaw is the division by a−b. Since a=b, the number a−b is 0, and division by 0 is not defined. The rule being used is cancellation: if xz=yz and z≠0, then x=y. Without the condition z≠0 the rule is false, since 3×0=5×0 while 3≠5.

Every line up to and including (a+b)(a−b)=b(a−b) is true: with a=b both sides are 0. The line a+b=b does not follow from it, and it is false, because a=b≠0 gives a+b=2b≠b. The final division by b is legitimate, because the hypothesis says b≠0.

9. For real numbers x and y, let max(x,y) be x if x≥y and y otherwise, and let min(x,y) be y if x≥y and x otherwise. Prove that for all real x and y,

max(x,y)=x+y+|x−y|2min(x,y)=x+y−|x−y|2
Hint

Check that both sides of each equation are unchanged when x and y are exchanged. Then one case is enough.

Solution

First, the statement is symmetric in x and y. Exchanging them leaves max(x,y) and min(x,y) unchanged: if x≠y both are defined by which of the two is larger, and if x=y every expression involved equals x. It also leaves the right-hand sides unchanged, since y+x=x+y and |y−x|=|−(x−y)|=|x−y| by part (ii) of the lemma on absolute value. So the pair of equations for (y,x) is the same pair as for (x,y), and without loss of generality x≥y.

Let x≥y. Then x−y≥0, so |x−y|=x−y, and by definition max(x,y)=x and min(x,y)=y. Now

x+y+(x−y)2=2x2=xx+y−(x−y)2=2y2=y

which are max(x,y) and min(x,y), as required. The case x<y follows by exchanging the letters.

10. Prove that |x−1|+|x−3|≥2 for every real number x, and that equality holds if and only if 1≤x≤3.

Hint

The signs of x−1 and x−3 change at 1 and 3, which suggests three cases. For the inequality alone, there is also a one-line proof by the triangle inequality.

Solution

Let x be a real number, and write f(x)=|x−1|+|x−3|. The three cases below cover every real number.

If x<1, then x−1<0 and x−3<0, so f(x)=(1−x)+(3−x)=4−2x. Since x<1, 2x<2, so f(x)>2.

If 1≤x≤3, then x−1≥0 and x−3≤0, so |x−1|=x−1 and |x−3|=3−x (when x=3 both readings give 0). So f(x)=(x−1)+(3−x)=2.

If x>3, then x−1>0 and x−3>0, so f(x)=(x−1)+(x−3)=2x−4. Since x>3, 2x>6, so f(x)>2.

In every case f(x)≥2. For the equality: if 1≤x≤3 then f(x)=2 by the middle case; conversely, if f(x)=2, then x is not in the first or third case, where f(x)>2, so 1≤x≤3.

The inequality alone also follows from the triangle inequality: |x−1|+|x−3|=|x−1|+|3−x|≥|(x−1)+(3−x)|=2. Geometrically, the sum of the distances from x to 1 and to 3 is at least the distance between 1 and 3.

11. Let a and b be integers with b>0. Prove that there are unique integers q and r with a=bq+r and −b2<r≤b2. Find q and r for a=18, b=5 and for a=−18, b=5.

Hint

For existence, start from the division algorithm and move the remainder down by b when it is too big. For uniqueness, follow the uniqueness proof in the lesson: the two remainders now lie in a range of width b that includes one end and not the other.

Solution

Existence. By the division algorithm, a=bq0+r0 for integers q0 and r0 with 0≤r0<b. If r0≤b2, take q=q0 and r=r0; then −b2<0≤r≤b2. If r0>b2, take q=q0+1 and r=r0−b. Then bq+r=bq0+b+r0−b=a. Also r<0≤b2, because r0<b, and r>b2−b=−b2, because r0>b2. So in both cases the pair has the required properties.

Uniqueness. Suppose a=bq+r=bq′+r′ with q, q′, r, r′ integers and both r and r′ in the range −b2<r≤b2. The two representations play identical roles, so without loss of generality r≤r′. Then r′−r≥0, and r′−r<b2+b2=b, because r′≤b2 and −r<b2. Subtracting the equations gives r′−r=b(q−q′), so 0≤b(q−q′)<b, and dividing by b>0 gives 0≤q−q′<1. Hence q−q′=0, so q=q′ and r=a−bq=r′.

For a=18, b=5: the division algorithm gives 18=5×3+3, and 3>52, so q=4 and r=−2, that is, 18=5×4−2. For a=−18: −18=5×(−4)+2, and 2≤52, so q=−4 and r=2.

12. Prove that an integer n can be written as a2−b2 for some integers a and b if and only if n does not have the form 4k+2 for any integer k.

Hint

For the backward direction, compute (k+1)2−k2 and (k+1)2−(k−1)2. For the forward direction, use the lemma that every square has the form 4m or 4m+1.

Solution

Let n be an integer.

(⇐) Suppose n is not of the form 4k+2. By the division algorithm, n has one of the forms 4k, 4k+1, 4k+3 for some integer k. If n=4k+1=2(2k)+1 or n=4k+3=2(2k+1)+1, then n is odd, say n=2j+1 for an integer j, and (j+1)2−j2=2j+1=n. If n=4k, then

(k+1)2−(k−1)2=(k2+2k+1)−(k2−2k+1)=4k=n

In every case n is a difference of two squares of integers.

(⇒) Suppose n=a2−b2 for integers a and b. By the lemma in the section on proof by cases, a2=4s+e and b2=4t+f for some integers s and t, with each of e and f equal to 0 or 1. Then n=4(s−t)+(e−f), and e−f is −1, 0 or 1. If e−f is 0 or 1, then n leaves remainder 0 or 1 on division by 4. If e−f=−1, then n=4(s−t−1)+3 leaves remainder 3. In no case is the remainder 2, so by uniqueness of the remainder, n is not of the form 4k+2.

For example, 7=42−32 and 12=42−22, while 2, 6 and 10 are not differences of two squares.

Challenge

13. Prove that n=1 is the only natural number for which n4+4 is prime.

Hint

Add and subtract 4n2: then n4+4 is a difference of two squares.

Solution

Let n be a natural number. Then

n4+4=(n4+4n2+4)−4n2=(n2+2)2−(2n)2=(n2+2n+2)(n2−2n+2)

For n=1, n4+4=5, which is prime.

Now let n≥2. The second factor is n2−2n+2=(n−1)2+1≥1+1=2, since n−1≥1. The first factor is n2+2n+2=(n2−2n+2)+4n, which exceeds the second, so it is greater than 2 as well. So n4+4 is the product of two integers each greater than 1, which by definition makes it composite, and hence not prime. For instance 34+4=85=17×5, and the factors are 9+6+2 and 9−6+2.

So n4+4 is prime for n=1 and for no other natural number. The factorisation is a case of an identity named after Sophie Germain: a4+4b4=(a2+2ab+2b2)(a2−2ab+2b2). Finding it is the whole difficulty.

14. Prove that n5−n is divisible by 30 for every integer n.

Hint

Factor n5−n completely over the integers. Show separately that 2, 3 and 5 divide it, using cases on remainders, and then combine the three facts with the trick from the Example in the section on "if and only if".

Solution

Let n be an integer and write N=n5−n. Factoring,

N=n(n4−1)=n(n2−1)(n2+1)=(n−1)n(n+1)(n2+1)

Throughout, if an integer d divides one factor of a product, it divides the product (Problem 3(a)).

Divisibility by 2. The product n(n+1)=n2+n is even, as proved in the lesson, and it is a factor of N, so 2∣N.

Divisibility by 3. By the division algorithm, n=3k, 3k+1 or 3k+2 for some integer k. In the first case 3∣n; in the second n−1=3k; in the third n+1=3(k+1). In each case 3 divides a factor of N, so 3∣N.

Divisibility by 5. Write n=5k+r with 0≤r≤4. If r=0, 5∣n. If r=1, n−1=5k. If r=4, n+1=5(k+1). If r=2, then n2+1=25k2+20k+5=5(5k2+4k+1). If r=3, then n2+1=25k2+30k+10=5(5k2+6k+2). In each case 5 divides a factor of N, so 5∣N.

Combining. Since 2∣N and 3∣N, the Example in the section on "if and only if" gives 6∣N. Now 6∣N and 5∣N, say N=6u and N=5v for integers u and v. Since N=6N−5N,

N=6(5v)−5(6u)=30v−30u=30(v−u)

and v−u is an integer, so 30∣N.

As a check, n=2 gives 30 and n=3 gives 240=30×8. Each of the three facts is a case of Fermat's little theorem, that p∣np−n for every prime p, which needs new ideas to prove for all primes at once.

15. Prove that for all real numbers x and y,

|x+y|1+|x+y|≤|x|1+|x|+|y|1+|y|
Hint

First prove that s1+s≤t1+t whenever 0≤s≤t. Then apply it with s=|x+y| and t=|x|+|y|, split the resulting fraction in two, and compare each half with the right-hand side.

Solution

All the denominators are at least 1, so every fraction is defined.

Step 1. Let s and t be real numbers with 0≤s≤t. Then

t1+t−s1+s=t(1+s)−s(1+t)(1+t)(1+s)=t−s(1+t)(1+s)≥0

because t−s≥0 and the denominator is positive. So s1+s≤t1+t.

Step 2. Let x and y be real numbers. By the triangle inequality, 0≤|x+y|≤|x|+|y|, so Step 1 with s=|x+y| and t=|x|+|y| gives

|x+y|1+|x+y|≤|x|+|y|1+|x|+|y|=|x|1+|x|+|y|+|y|1+|x|+|y|

Step 3. Since |y|≥0, we have 1+|x|+|y|≥1+|x|>0, and a non-negative numerator over a larger positive denominator gives a smaller or equal fraction, so |x|1+|x|+|y|≤|x|1+|x|. In the same way |y|1+|x|+|y|≤|y|1+|y|. Adding these to the inequality of Step 2 proves the claim.

Applied to x−y and y−z, the result says that d(x,y)=|x−y|1+|x−y|, a measure of distance that never exceeds 1, still satisfies the triangle inequality.