Different statements call for different methods of proof. Proof by contradiction and mathematical induction are two of the most powerful.

Direct and Indirect Proof

In a direct proof of p → q, we assume p and use definitions and known facts to reach q. To prove that the sum of two even numbers is even, write them as 2a and 2b, whose sum 2(a + b) is even. A proof by contraposition proves ¬q → ¬p instead, which is equivalent. To prove "if n² is even then n is even", we show that if n is odd, n = 2k + 1, then n² = 4k² + 4k + 1 is odd.

Proof by Contradiction

In a proof by contradiction, to prove a statement p we assume ¬p, and then show that this leads to a contradiction, something that is both true and false. Since a contradiction cannot hold, the assumption ¬p is false, and so p is true. The classic example is the proof that √2 is irrational. Assume that √2 = a/b in lowest terms. Then 2b² = a², so a² is even and a is even, a = 2k. Then 2b² = 4k², so b² = 2k² and b is even. Both a and b are even, which contradicts lowest terms. So √2 is irrational.

Definition: Mathematical induction. A method of proving that a statement P(n) holds for every integer n ≥ n0 by showing that P(n0) is true and that P(k) implies P(k + 1) for every k ≥ n0.

Mathematical Induction

Mathematical induction proves that P(n) is true for all integers n from a starting value n0. It has two steps. In the basis step, we show that P(n0) is true. In the inductive step, we assume that P(k) is true for some k ≥ n0, which is the inductive hypothesis, and show that P(k + 1) is then true. Like a row of falling dominoes, the first falls, and each one knocks over the next, so all fall. Strong induction assumes P(n0), …, P(k) all true to prove P(k + 1). Induction is used to prove formulas for sums, properties of algorithms and the correctness of loops and recursion.

Table 1.5: Methods of proof

Method Idea Example
Direct Assume p, derive q Sum of evens is even
Contraposition Prove ¬q → ¬p n² even implies n even
Contradiction Assume ¬p, reach a contradiction √2 is irrational
Induction Basis and inductive step 1 + … + n = n(n + 1)/2

Example 1.5: Proof by induction

Problem: Prove that 1 + 2 + … + n = n(n + 1)/2 for every n ≥ 1.

Solution:

  1. Basis: for n = 1, the left side is 1 and the right side is 1 × 2 / 2 = 1. True.
  2. Hypothesis: assume 1 + 2 + … + k = k(k + 1)/2.
  3. Inductive step: 1 + … + k + (k + 1) = k(k + 1)/2 + (k + 1) = (k + 1)(k + 2)/2.
  4. This is the formula for n = k + 1.

Result: By induction, the formula holds for every n ≥ 1.

ok = all(sum(range(1, n + 1)) == n * (n + 1) // 2
         for n in range(1, 101))
print("checked n = 1..100:", ok)

Output

checked n = 1..100: True

Common mistakes

  • Skipping the basis step in induction.
  • Using P(k + 1) inside the proof of the inductive step.
  • In a proof by contradiction, not stating clearly which assumption is contradicted.

Key takeaways

  • A direct proof assumes p and derives q.
  • Proof by contradiction assumes the negation and reaches a contradiction.
  • Induction needs a basis step and an inductive step.
  • Checking many cases by computer is evidence, not a proof.

Practice questions

  1. What are the two steps of mathematical induction?
  2. What is assumed in a proof by contradiction?
  3. What is the inductive hypothesis?

Answers to the practice questions

  1. The basis step and the inductive step.
  2. The negation of the statement to be proved.
  3. The assumption that P(k) is true, used to prove P(k + 1).

Sources

  • Official BCA syllabus Mathematics Foundations to Computer Science II, course code 25BCA402DS01, Unit I