CMPS 260
Proof by Mathematical Induction

The Method

Probably the method most often used in proving theorems in computer science is proof by mathematical induction. Here we describe the method and offer a few examples of its use.

The typical scenario is that we have a proposition —meaning a statement that is either true or false— that mentions a natural number n, and we wish to show that the proposition is true for all values of n, beginning at some lower bound a, usually either zero or one.

To put it more formally, we have a predicate P(n) and we wish to prove (∀n : n≥a ⟹ P(n)).

The proof is done in two steps: the basis step and the induction step.

The basis step is to prove each of P(a), P(a+1), ..., P(a+b), for some small b≥0. Typically, b=0, so that all that is proved here is P(a). (As noted above, usually a=0 or a=1.) This step is typically straightforward.

The induction step is to prove, for arbitrary k≥a+b, that P(k) ⟹ P(k+1). That is, what is to be proved here is that, if P is true with respect to one number, it is also true for the next higher number. The standard way to go about proving P(k) ⟹ P(k+1) is to employ the "Assume the Antecedant" approach. That is, P(k) —which is referred to as the induction hypothesis (or inductive assumption)— is assumed to be true and, using that assumption, P(k+1) is proved.


Justification

To justify mathematical induction as a method of proof, suppose that, for some predicate P(n), we have completed both the basis and inductive steps. For the sake of simplicity, here we will assume that a=0 and b=0, so that the basis step was to have proved P(0) and the inductive step was to have proved that, for any k≥0, P(k) ⟹ P(k+1). (Our justification will be easy to generalize to cover cases in which the values of a and b are different.)

To argue that P(n) is true for all n≥0, let us use the proof by contradiction approach. That is, assume that there exists a natural number n0 such that P(n0) is false. In that case, there must be a smallest such number, so suppose that n0 is that smallest number. In other words, assume that each of P(0), P(1), ..., P(n0−1) is true but P(n0) is false.

Is it possible that n0 = 0? No, because P(0) was proved in the basis step. It follows that n0 ≥ 1. So we have that P(n0−1) is true but P(n0) is false, which is to say that P(n0−1) ⟹ P(n0) is false. But this contradicts what was proved in the inductive step! Hence, the assumption that n0 exists was wrong.


Example 1

Let S(n) = Σ0≤i≤n i  (i.e., S(n) = 0 + 1 + 2 + ... + n). We prove that, for all n≥0, S(n) = n(n+1) / 2.

Proof:

Basis: Here we prove the statement for n=0. That is, we show S(0) = 0(0+1)/2. See left-hand side of figure below.

Inductive Step: As an induction hypothesis (IH), assume that, for an arbitrary k≥0, S(k) = k(k+1)/2. Using this assumption, we show that S(k+1) = (k+1)(k+2)/2. See right-hand side of figure below.

   S(0)

=    < definition of S >

   0

=    < arithmetic >

   0(0+1)/2

















   S(k+1)

=    < S(n+1) = S(n) + n+1 for all n≥0 >

   S(k) + (k+1)

=     < IH >

   k(k+1)/2  +  (k+1)

=     < algebra (multiply 2nd term by 2/2) >

   k(k+1) / 2  +  2(k+1) / 2

=     < algebra: a/2 + b/2 = (a+b)/2 >

   (k(k+1) + 2(k+1)) / 2

=     < algebra: ac + bc = (a+b)c
        (multiplication distributes over addition) >

   (k+2)(k+1) / 2

=     < algebra: a·b = b·a
        (multiplication is commutative)   >

   (k+1)(k+2) / 2
Basis Step Inductive Step

The key in the inductive step was to transform S(k+1) into an expression involving S(k) so that the induction hypothesis could be applied. Having done that, algebraic manipulation sufficed to conclude what was needed about S(k+1).


Example 2

Definition: A graph is said to be connected if, for every pair of nodes, there is a path connecting them.

Definition: A cycle in a graph is a path of length three or more, in which no edges are repeated, that begins and ends at the same node.

Definition: A graph is said to be acyclic if it has no cycles.

Definition: The degree of a node in a graph is the number of edges that are "incident" to that node.

Definition: A free tree is a connected acyclic graph. (This is to be contrasted with a rooted tree, in which one node is identified as the root.)

Lemma: In a free tree having two or more nodes, there is at least one endpoint (i.e., a node of degree one).
Proof: You can find it elsewhere.

Having completed several definitions and a lemma, now we state the claim of interest:

Claim: Every free tree has exactly one more nodes than edges.

Proof: (by mathematical induction on the number of nodes)

The basis step covers those trees having exactly one node. Obviously, the number of edges in any such tree is necessarily zero, which is consistent with the claim.

Now for the induction step. As an induction hypothesis, assume, for an arbitrary k≥1, that every free tree having k nodes has k−1 edges. Let T be a free tree having k+1 nodes. We need to show that T has k edges.

According to the lemma stated above, T has at least one endpoint. Let T' be the tree obtained by removing one of the endpoints in T (and, of course its lone incident edge). We are justified in claiming that T' is a tree because the removal of an endpoint from a tree neither disconnects it nor introduces a cycle.

Now, T' has k nodes —one fewer nodes than the k+1 nodes in T—, and so by the IH, T' must have k−1 edges. But T' also has one fewer edges than T, which means that T has k edges, as required. ∎

As in the first example, the key to completing the induction step is to find a way to apply the induction hypothesis. Here, that was to obtain a tree with k nodes (T') by removing a node from the tree (T) about which we were trying to prove something. Having used the induction hypothesis to glean information about T' (namely, that it had k−1 edges), we could then use the relationship between it and T (namely that T has one more edge than T') to show what was needed regarding T.