4.3 Proof by cases

Depending on the mathematical objects involved in a statement, it may be possible to consider mutually-exclusive cases and prove each case separately.

To illustrate this idea, we revisit the result from Exercise 4.12, where we proved that if nn is an integer then n2+nn^{2}+n is even.

Example 4.16.

We shall prove that if nn is any integer then n2+nn^{2}+n is even using a proof by cases.

Since nn is an integer, we know that it must even or odd, but not both. We can consider these two cases separately.

Case 1: Suppose nn is even, so we know that n=2kn=2k for some integer kk. Then n+1=2k+1n+1=2k+1 and we see that

n2+n\displaystyle n^{2}+n =n(n+1)\displaystyle=n(n+1)
=(2k)(2k+1)\displaystyle=(2k)(2k+1)
=2×k(2k+1)\displaystyle=2\times k(2k+1)

and so n2+nn^{2}+n is even (since it is 22 times an integer [why?]).

Case 2: Now suppose nn is odd, so can write n=2k+1n=2k+1 for some integer kk. (Note that we are reusing kk since we are done with the previous case.) Then n+1=2k+2n+1=2k+2 and we see that

n2+n\displaystyle n^{2}+n =n(n+1)\displaystyle=n(n+1)
=(2k+1)(2k+2)\displaystyle=(2k+1)(2k+2)
=2×k(2k+1).\displaystyle=2\times k(2k+1).

Hence n2+nn^{2}+n is even.

The proof is complete.

When using proof by cases we split a difficult general proof into many sub-proofs. Each sub-proof has an extra specific hypothesis. In the above example that was ‘nn is odd’ or ‘nn is even’. The extra hypothesis gives more information, and helps make the sub-proof easier.

Mathematicians are sometimes dissatisfied with proofs by cases. While they do establish that a statement is true, they often do not really explain why it is true. Recall from Section 1.4 that mathematicians sometimes prefer proofs which explain over proofs which just establish truth.

4.3.1 Proof by exhaustion

A statement may assert something about a finite number of objects. If so then it may be possible to verify the statement for each object separately.

Example 4.17.

We prove that for x=2,3,4x=2,3,4, the expression x23x^{2}-3 is greater than 0 and less than 1414.

Because this is a statement about a finite number of values, we can check each separately:

  • if x=2x=2 then x23=43=1x^{2}-3=4-3=1;

  • if x=3x=3 then x23=93=6x^{2}-3=9-3=6; and

  • if x=4x=4 then x23=163=13x^{2}-3=16-3=13.

Hence x23x^{2}-3 is between 0 and 14 for x=2,3,4x=2,3,4. The proof is complete.

Exercise 4.18.

Prove that there are exactly two prime numbers greater than 20 and less than 30.

  • Solution.

    • 21=3×721=3\times 7 is not prime.

    • 22=2×1122=2\times 11 is not prime.

    • 2323 is prime.

    • 24=2×1224=2\times 12 is not prime.

    • 25=5×525=5\times 5 is not prime.

    • 26=2×1326=2\times 13 is not prime.

    • 27=3×927=3\times 9 is not prime.

    • 28=2×1428=2\times 14 is not prime.

    • 2929 is prime.

    So there are exactly two prime numbers greater than 2020 and less than 3030. The proof is complete.

    This is a pretty mindless way of proving this result. You could reduce the number of cases you have to consider by first noting that any even number greater than 22 cannot be prime, and so you only really have to check the odd numbers between 2020 and 3030.

Example 4.19.

The four colour theorem is a famous example of a result involving a proof by exhaustion. In 1976, a computer algorithm was used to check 1834 cases in order to verify the claim of the theorem.