Discrete MathProof Techniques

Proof by Cases

Split into cases that cover every possibility (n even or odd; n = 3k, 3k + 1 or 3k + 2) and prove each one.

Not started Jump to practice

Some claims are easy once you know a little more about the number: whether it is even or odd, or what remainder it leaves. A proof by cases splits the problem so that each piece is a short direct proof.

Key idea

To prove $Q$ by cases, list cases $C_{1}, C_{2}, \ldots$ that together cover every possibility, then prove that each case leads to $Q$. Standard splits: $n$ even or odd ($n = 2k$ or $2k + 1$); remainders when dividing by $3$ ($n = 3k$, $3k + 1$ or $3k + 2$); signs ($x > 0$, $x = 0$, $x < 0$).

Why it works

Logically, $(C_{1} \vee C_{2})$, $C_{1} \to Q$ and $C_{2} \to Q$ together give $Q$: whichever case actually happens, $Q$ follows. The argument is only as good as the first fact, that the cases cover everything. Every integer leaves a remainder of $0$, $1$ or $2$ when divided by $3$, so the three forms $3k$, $3k + 1$, $3k + 2$ really do cover all integers.

Worked examples

Worked example: $n^{2} + n$ is always even

Prove: for every integer $n$, $n^{2} + n$ is even.
  1. Case 1, $n$ even: $n = 2k$, so $n^{2} + n = 4k^{2} + 2k = 2(2k^{2} + k)$, even.
  2. Case 2, $n$ odd: $n = 2k + 1$, so $$n^{2} + n = (4k^{2} + 4k + 1) + (2k + 1) = 2(2k^{2} + 3k + 1),$$ which is even.
  3. Every integer is even or odd, so the cases cover everything.

Answer: Even in both cases.

Worked example: Squares and the number $3$

Prove: for every integer $n$, $n^{2}$ leaves remainder $0$ or $1$ when divided by $3$.
  1. Case $n = 3k$: $n^{2} = 9k^{2} = 3(3k^{2})$, remainder $0$.
  2. Case $n = 3k + 1$: $n^{2} = 9k^{2} + 6k + 1 = 3(3k^{2} + 2k) + 1$, remainder $1$.
  3. Case $n = 3k + 2$: $n^{2} = 9k^{2} + 12k + 4 = 3(3k^{2} + 4k + 1) + 1$, remainder $1$.
  4. So a perfect square never leaves remainder $2$. (That is why, for example, $3m + 2$ is never a perfect square.)

Answer: Remainder $0$ or $1$ in every case.

Worked example: Absolute values

Prove: for all real numbers $x$ and $y$, $|xy| = |x|\,|y|$.
  1. Case $x \ge 0, y \ge 0$: $xy \ge 0$, so $|xy| = xy = |x|\,|y|$.
  2. Case $x \ge 0, y < 0$: $xy \le 0$, so $|xy| = -xy = x(-y) = |x|\,|y|$. The case $x < 0, y \ge 0$ is the same with the roles swapped.
  3. Case $x < 0, y < 0$: $xy > 0$, so $|xy| = xy = (-x)(-y) = |x|\,|y|$.

Answer: True in all four sign cases.

Common mistake

Leaving out a case. A proof that checks "$x > 0$" and "$x < 0$" has skipped $x = 0$; a proof about integers that only handles positive $n$ has skipped zero and the negatives. Check: before writing any case, ask whether every possible value lands in at least one case. For remainder cases, list one remainder for each value from $0$ to the divisor minus $1$.

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

This is one of the top rungs of Discrete Math.

Sources and further reading

  • Oscar Levin, Discrete Mathematics: An Open Introduction (3rd ed.), section "Proofs" (proof by cases)
  • MIT OpenCourseWare 6.042J Mathematics for Computer Science (Lehman, Leighton and Meyer), chapter "Proofs" (proof by cases)
  • Richard Hammack, Book of Proof (3rd ed.), chapter "Direct Proof" (proof by cases)
@teddyrookbook GitHub