11. Proofs: Mathematical Induction

CAUTION - CHAPTER UNDER CONSTRUCTION!

This chapter was last updated on April 7, 2025.

In this chapter, you will learn how to use the mathematical induction proof technique to create a single proof of infinitely many different but related propositions. This proof technique will also be used to validate algorithms.

Key terms and concepts covered in this chapter:

  • Mathematical induction

    • Weak and strong induction (i.e., First and Second Principle of Induction)

    • examples of mathematical induction

  • Well-ordering and Induction

  • Structural induction

11.1. Why Is Mathematical Induction Needed?

We often encounter an infinite sequence of related propositions, all of which appear to be True. To prove all of the propositions, we might try to write a proof for each individual proposition and then combine all those proofs together as a single infinitely long "proof"…​ but recall from the chapter on Proofs: Basic Techniques that a proof consists of a finite sequence of propositions of finite length. As an analogy, imagine you had an "algorithm" that required infinitely many steps to complete its task…​ such an algorithm would not be useful in the real world since it might never complete the task!

The next example introduces the ideas we will use to prove an infinite sequence of related propositions.

Example 1 - Why Use Mathematical Induction?

Let’s examine a conjecture about a certain type of polygonal number, namely, square numbers.

Square as sum of gnomons

Consider the image that shows 16 colored disks arranged as a square. By starting at the lower left corner of the square and grouping disks of the same color, we can count the total number of disks in the figure as follows. \begin{equation} \begin{aligned} 1 {} & = 1^{2} \\ 1 + 3 {} & = 4 = 2^{2} \\ 1 + 3 + 5 {} & = 9 = 3^{2} \\ 1 + 3 + 5 + 7 {} & = 16 = 4^{2} \\ \end{aligned} \end{equation}

Notice that the sum of the odd integers on the left-hand side of each equation is equal to the square of the number of odd integers on the left-hand side of the equation. This means that the predicate \[P(n)\text{: "The sum of the first } n \text{ positive odd integers is equal to } n^{2} \text{."}\] is a True statement for the natural numbers \(n \in \{ 1, 2, 3, 4 \},\) that is, each of the following four propositions is True:

  • \(P(1)\): "The sum of the first \(1\) positive odd integers is equal to \(1^{2}\)." (I know this is not proper English, but please bear with me!)

  • \(P(2)\): "The sum of the first \(2\) positive odd integers is equal to \(2^{2}\)."

  • \(P(3)\): "The sum of the first \(3\) positive odd integers is equal to \(3^{2}\)."

  • \(P(4)\): "The sum of the first \(4\) positive odd integers is equal to \(4^{2}\)."

In the following code snippet, function \(P\) implements the predicate used in this example. Recall that the predicate’s output is a proposition - the output is just a string of symbols and does not indicate whether the proposition is True or False.

Square as sum of gnomons

Next, consider this second image, which shows how you could change the first image to one that can be used to prove that \(P(5)\) is True.
It’s easy to show that the proposition \(P(5)\) is True because you can just write out and verify that \(1 + 3 + 5 + 7 + 9 = 25 = 5^{2}.\) The goal here is to relate the proposition \(P(5)\) to the "preceding" proposition \(P(4),\) in a way similar to what was done for sequences of numbers in a recurrence relation.

Notice that the second image shows that, given the square arrangement of disks that has 4 disks along each side, we can construct a square arrangement that has 5 disks along each side by inserting 4 new disks above the top row, 4 new disks in a column to the right of the rightmost column, and 1 new disk in the upper right corner to completes the square arrangement.

In fact, there is nothing special about the number 4 in the previous paragraph: If \(k\) is any positive natural number and we have a \(k \times k\) square arrangement of disks, we can enlarge it to a \((k+1) \times (k+1)\) square arrangement of disks by inserting \(k\) disks above, \(k\) disks to the right, and \(1\) disk in the upper right corner of the \(k \times k\) square to complete the \((k+1) \times (k+1)\) square. Algebraically, we can account for the total number of disks in the \((k+1) \times (k+1)\) square by writing \[ k^{2} + k + k + 1 = (k+1)^{2} \] which is True for any natural number \(k\) (Just simplify the left-hand side and expand the right-hand side of the equation to see that the equation must be True.)

Based on this second image, we can make a conjecture that \(P(n)\) must be True for every positive natural number \(n.\) We now need to prove this conjecture.

Notice that if we combine the propositions

  1. \(P(1)\) and \(P(2)\) and \(P(3)\) and \(P(4)\)

  2. For all \(k \in \mathbb{N},\) \(P(k)\) implies \(P(k+1).\)

then we can build a proof for all the integers up to and including any value of \(n \in \mathbb{N}\) that we want.

For example, to prove \(P(1,\!000,\!000),\) we could start by asserting that \(P(1)\) is True, then apply the conditional \(P(k) \rightarrow P(k+1)\) along with the rule of inference modus ponens \(999,\!999\) times to prove that \(P(1,\!000,\!000)\) is True. This proof is finite - I never claimed that the proof would be short!

As an analogy, think of repeatedly applying modus ponens to the conditional as using a loop in code. We are just repeating the same argument \(( P(k) \land ( P(k) \rightarrow P(k+1) ) ) \rightarrow P(k+1)\) over and over again as the value of the variable \(k\) is incremented by 1 at the end of each loop iteration until we reach the value that we want to stop at. In the following code snippet, the user-defined function addTheOdds implements the computations used in this example’s argument. Notice how the Basis Step corresponds to validating the loop initialization and how the Induction Step corresponds to validating the output at the end of each loop iteration (assuming that the values were correct at the start of that loop iteration.) You can change the value of \(n\) in the code to confirm the truth value of \(P(n)\) for any integer you’d like, assuming you have enough time and computing resources.

Since we can now, in principle, build a proof of \(P(n)\) for any value of \(n \in \mathbb{N}\) that we could choose, we apply the rule of inference universal generalization to conclude that \((\forall \in \mathbb{N})P(n).\) That is, we have proven the proposition \[ \text{"For every positive natural number } n \text{, the sum of the first } n \text{ positive odd integers is equal to } n^{2} \text{."}\] Another way to look at this is to define \(s(n)\) to be the number of disks in a \(n \times n\) square arrangement of disks. We have shown that \(s(1) = 1\) and that \(s(k+1) = s(k) + 2k + 1\) for every positive natural number value of \(k,\) and have concluded that \(s(n) = n^{2}\) for every positive natural number \(n.\)

We will rewrite the above example more formally (with full algebraic detail) later in the chapter.

11.2. The Principle of Mathematical Induction

A proof by mathematical induction of a predicate \(P(n)\) defined for natural numbers \(n \in \mathbb{N}\) consists of three steps.

Basis Step

Prove the predicate \(P(n)\) is True for some small value of \(n;\) in most but not all cases, you prove either \(P(0)\) or \(P(1)\) (You can also prove \(P(n)\) for other values if it helps you get a feel for what needs to be proven, as was done in "the sum of the first \(n\) consecutive odd natural numbers is the perfect square \(n^{2}\)" in the previous section.)

Induction Step

Prove that the conditional statement \(P(k) \rightarrow P(k+1)\) is True for any integer \(k.\)
In this context, the predicate \(P(k)\) is called the induction hypothesis and is assumed to be True, where \(k\) represents an arbitrary natural number. Using modus ponens allows you to infer that \(P(k+1)\) must also be True based on the assumption that \(P(k)\) is True.

Conclusion Step

Conclude that \(P(n)\) is True for all natural numbers \(n\) that are greater than or equal to the small(est) value used in the Basis Step. This conclusion uses universal generalization as the rule of inference.

The three steps above are referred to as "The Principle of Mathematical Induction" which is often abbreviated as PMI.
Some textbooks and sources do not include the Conclusion Step as part of PMI, but the remixer wanted to stress that this step is needed to complete the proof.

You can compare the first two steps of PMI to the two steps used in a recursive definition as in the Sequences and Recursion chapter. Note that a recursive defintion is used to describe and define a process for constructing objects or a set of objects or a structure, but a proof by mathematical induction is used to justify and validate such a process.

Note that each of the three steps will be a proof of finite length, but will allow us to conclude that \(P(n)\) is true for every natural number \(n\) greater than or equal to some some small natural number \(n_{0} \geq 0\). That is, we can conclude that \((\forall n \geq n_{0}) P(n)\) is a True propostion.

As an analogy, imagine we are building a tower using interlocking toy blocks. How tall can the tower be? The basis step involves placing a foundation on the ground (either a flat surface for \(n = 0\), or a first block for \(n = 1\)), and the induction step justifies that if we have built a tower that has height \(k\) then we can build a tower of height \(k+1\) by placing one more block on the tower. The conclusion step states that we can build a tower that is of any finite height \(n\) (as long as we have \(n\) or more blocks and ignore issues arising from real-world physics!) Note that we never build an infinitely tall tower.
Note: Some textbooks and sources use an "infinite ladder" analogy for mathematical induction, but this is not quite correct. A better analogy is a ladder that can be extended to any finite height you need, but that is always of finite height.

As an example, here is a proof of the Handshake Theorem for graphs.

Example 2 - Proof of the Handshake Theorem

We will prove the following proposition using mathematical induction.

Theorem

If \(G\) is a graph with vertex set \(V\) and edge set \(E,\) where both \(V\) and \(E\) are finite sets, then the sum of the degrees of all vertices in \(V\) is equal to 2 times the number of edges in \(E.\)

Notice first that since this needs to proven for any graph with any finite number of vertices and edges, it is a good candidate for proof by mathematical induction.

Which number should be one we use for induction?

  • We could try using induction on the number of vertices, but notice that we can add an isolated vertex without effecting either the sum of the degrees or the number of edges. This indicates that the number of vertices is not the correct variable to use for a proof by induction.

  • We could try using induction on the sum of the degrees of the vertices, but we’d have to figure out how to add 1 to that sum…​ but notice that, as above, adding a new vertex \(v\) to the graph

    • either leaves the sum of degrees unchanged (if \(v\) is isolated)

    • or changes the sum of degrees by 2 (because either \(v\) is an endpoint of a loop or \(v\) comes along with a new edge that connects to another vertex of the graph.) Since we cannot meaningfully add 1 to the sum of the degrees, this is also not the correct variable to use for induction.

  • We could try using induction on the number of edges. This could work since adding a new edge will increase the sum of degrees of the vertices by 2 (whether the vertices are "new" or "old").

So, to prove the theorem, let \(n\) represent the number of edges in a graph and let \(P(n)\) be the predicate \[P(n)\text{: "The sum of the degrees of the vertices for a graph with } n \text{ edges is equal to } 2 \cdot n \text{."}\] We will prove that \((\forall n \in \mathbb{N})P(n).\)

Basis Step: \(P(0)\) is the proposition "The sum of the degrees of the vertices for a graph with \(0\) edges is equal to \(2 \cdot 0.\)" since a graph with 0 edges is just a collection of isolated vertices, and each of the isolated vertices has degree 0, the sum of the degrees of the vertices must also be 0, which is 2 times the number of edges. This means that \(P(0)\) is True, and the Basis has been established.

Induction Step: First, we assume that the induction hypothesis \(P(k)\) is True for some positive natural number \(k\).

Secondly, we will prove that the conditional \(P(k) \rightarrow P(k+1)\) must be True, which means we can use modus ponens (or the equivalent tautology \(( P(k) \land ( P(k) \rightarrow P(k+1) ) ) \rightarrow P(k+1)\)) to show that \(P(k+1)\) is also True.

For the natural number \(k,\) the predicate \(P(k)\) is the proposition "The sum of the degrees of the vertices for a graph with \(k\) edges is equal to \(2 \cdot k.\)

Suppose that we have a graph with \(k\) edges. We insert one new edge \(e\) into the graph. There are, essentially, two possible cases to consider.

  • \(e\) has two different endpoints, in which case the degree of each endpoint increases by 1 when \(e\) is added to the graph, so the sum of the degrees of the vertices increases by 2, or ,

  • \(e\) is a loop with only one endpoint, in which case the degree of that endpoint increases by 2, so the sum of the degrees of the vertices increases by 2.
    Notice that in either bullet, it does not to matter whether the new edge \(e\) has endpoints that are "new" to the graph or were "old" vertices that were in the graph already.

Notice that any graph with \(k+1\) edges can be built up this way from a graph that had \(k\) edges. So, using the fact that \(2 \cdot k + 2 = 2 \cdot (k+1),\) we have proven that "The sum of the degrees of the vertices for a graph with \(k+1\) edges is equal to \(2 \cdot (k + 1).\) That is, we have proven that \(P(k) \rightarrow P(k+1)\).

Conclusion Step: We have proven both the Basis Step and the Induction Step. Therefore, we can use universal generalization to conclude that \((\forall n \in \mathbb{N})P(n),\) which translates to "For all natural umber \(n,\) the sum of the degrees of the vertices for a graph with \(n\) edges is equal to \(2 \cdot n.\)"

Q.E.D.

11.3. More Example Proofs Using Mathematical Induction

Example 3 - An Algebraic Expression for Positive Odd Integers

Let \(P(n)\) be the predicate \[P(n)\text{: "The } n\text{th positive odd integer is equal to } 2n-1 \text{."}\] We will prove that \((\forall n \in \mathbb{N}_{>0})P(n),\) that is, for all positive integers \(n.\)
Notice that you can find evidence for the conjecture that \(k\text{th}\) positive odd integer is \(2k - 1\) by making a table and finding an algebraic formula that matches the table. See this appendix if you don’t remember how to do this.

Basis Step: \(P(1)\) is the proposition "The \(1\)th positive odd integer is equal to \(2(1)-1.\)" This is True since \(2(1)-1 = 1\), in spite of the poor English, which should use "\(1\)st" instead of "\(1\)th."

Induction Step: First, we assume that the induction hypothesis \(P(k)\) is True for some positive natural number \(k\). That is, we assume that "The \(k\)th positive odd integer is equal to \(2k-1\)" is True for some positive natural number \(k.\)

Secondly, we will prove that the conditional \(P(k) \rightarrow P(k+1)\) must be True, which means we can use modus ponens (or the equivalent tautology \(( P(k) \land ( P(k) \rightarrow P(k+1) ) ) \rightarrow P(k+1)\)) to show that \(P(k+1)\) is also True.

If the \(k\)th positive odd integer is equal to \(2k-1,\) then the \((k+1)\)th positive odd integer is obtained by adding \(2\) to \(2k-1,\) that is the \((k+1)\)th positive odd integer is equal to \((2k-1) + 2,\) which can be rewritten using algebra as \begin{equation} \begin{aligned} (2k-1) + 2 {} & = 2k - 1 + 2 \\ & = 2k + 2 - 1 \\ & = 2(k+1) - 1 \end{aligned} \end{equation}

We have proven that if \(k\)th positive odd integer is equal to \(2k-1\) then the \((k+1)\)th positive odd integer is equal to \(2(k+1)-1.\) That is, we have proven \(P(k) \rightarrow P(k+1)\).

Conclusion Step: We have proven both the Basis Step and the Induction Step. Therefore, we can use universal generalization to conclude that for all positive integers \(n,\) the \(n\)th positive odd integer is equal to \(2n-1.\)

Q.E.D.

The next example proof is the formal proof that corresponds to the first example of this chapter.

Example 4 - Square Numbers

Let \(P(n)\) be the predicate \[P(n)\text{: "The sum of the first } n \text{ positive odd integers is equal to } n^{2} \text{."}\] We will prove that \((\forall n \in \mathbb{N}_{>0})P(n).\)

Basis Step: \(P(1)\) is the proposition "The sum of the first \(1\) positive odd integers is equal to \(1^{2}.\)" If we allow a sum to have only one addend, then \(P(1)\) is True since \(1 = 1^{2}\), so \(P(1)\) can be used as the basis of our induction proof. If we want to be sure that there are least two addends in the sum, we can use \(P(2)\) as an additional basis. \(P(2)\) is the proposition "The sum of the first \(2\) positive odd integers is equal to \(2^{2}\)" which is True because \(1 + 3 = 2^{2}.\)

Induction Step: First, we assume that the induction hypothesis \(P(k)\) is True for some positive natural number \(k\).

Secondly, we will prove that the conditional \(P(k) \rightarrow P(k+1)\) must be True, which means we can use modus ponens (or the equivalent tautology \(( P(k) \land ( P(k) \rightarrow P(k+1) ) ) \rightarrow P(k+1)\)) to show that \(P(k+1)\) is also True.

Based on the formula for the \(k\text{th}\) positive odd integer, we can rewrite the sum of the first \(k\) positive odd integers \(1+3+...+(2k-1)\) using summation notation as \(\sum\limits_{i=1}^{k}(2i-1)\) and rewrite the predicate \(P(k)\) in algebraic form as \[ P(k): \sum\limits_{i=1}^{k}(2i-1) = k^{2}.\] Note that \(P(k)\) is still a proposition - it is stating that a certain equation holds.
A common error is to treat \(P(k),\) when written algebraically, as a function that gives numerical outputs, but this is incorrect. \(P(k)\) is still a predicate that gives propositions as outputs.

We can now prove that the conditional \(P(k) \rightarrow P(k+1)\) must be True using algebra. \begin{equation} \begin{aligned} \sum\limits_{i=1}^{k+1}(2i-1) {} & = \left(\sum\limits_{i=1}^{k}(2i-1)\right) + (2(k+1)-1) \\ & = k^{2} + (2(k+1)-1) \end{aligned} \end{equation} where we have substituted \(k^{2}\) for the sum \(\sum\limits_{i=1}^{k}(2i-1)\) based on the induction hypothesis.

Now we simplify this using algebra and show that it is the same as the right hand side. \begin{equation} \begin{aligned} \sum\limits_{i=1}^{k+1}(2i-1) {} & = k^{2} + (2(k+1)-1) \\ & = k^{2} + 2k + 2 - 1 \\ & = k^{2} + 2k + 1 \\ & = (k + 1)^{2}\\ \end{aligned} \end{equation}

We have proven that the equation \(1+3+...+(2k-1) = \sum\limits_{i=1}^{k}(2i-1) = k^{2}\) implies the equation \(1+3+...+(2k-1) + (2k+1) = \sum\limits_{i=1}^{k+1}(2i-1) = (k+1)^{2}\), that is, \(P(k) \rightarrow P(k+1)\).

Conclusion Step: We have proven both the Basis Step and the Induction Step. Therefore, we can use universal generalization to conclude that \(1+3+...+(2n-1) = \sum\limits_{i=1}^{n}(2i-1) = n^{2}\) for all positive integers \(n\).

Q.E.D.

Example 5 - The Factorial Grows Faster Than An Exponential Function

Let \(P(n)\) be the predicate \[P(n): 2^{n} < n!\] We will prove that \((\forall n \in \mathbb{N}_{\geq 4})P(n).\)

Basis Step: First notice that the propositions \(P(0),\) \(P(1),\) \(P(2),\) and \(P(3)\) are all False! This is why we must use \(P(4)\) as the basis. \(P(4)\) is the proposition \(2^{4} < 4!\) which is a True statement since \(16 < 24.\)

Induction Step: First, we assume that the induction hypothesis \(P(k)\) is True for some positive natural number \(k\). In this context we can assume \(k \geq 4.\)

Secondly, we will prove that the conditional \(P(k) \rightarrow P(k+1)\) must be True, which means we can use modus ponens (or the equivalent tautology \(( P(k) \land ( P(k) \rightarrow P(k+1) ) ) \rightarrow P(k+1)\)) to show that \(P(k+1)\) is also True.

Assume that \(P(k)\) is True with \(k \geq 4,\) that is, \(2^{k} < k!.\) If we multiply both sides of the inequality by \(2\) we get \begin{equation} \begin{aligned} 2^{k+1} {} & = 2 \cdot 2^{k} \\ & < (k+1) \cdot 2^{k} \text{ (since \(k \geq 4,\) we must have \(k+1 > 5 >2\))}\\ & < (k+1) \cdot k! \text{ by the induction hypothesis} \end{aligned} \end{equation}

Notice that the expression on the last line is equal to \((k+1)!,\) so we have shown that \((2^{k} < k!) \rightarrow (2^{k+1} < (k+1)!)\) as long as \(k \geq 4.\) That is, we’ve proven that \(P(k) \rightarrow P(k+1)\).

Conclusion Step: We have proven both the Basis Step and the Induction Step. Therefore, we can use universal generalization to conclude that for all positive integers \(n \geq 4\), \(2^{n} < n!\)

Q.E.D.

Exercise - Setting Up A Proof By Induction (The Towers Of Hanoi)

Set up the proof of the following statement.

The minimal number of moves needed to solve the Towers Of Hanoi puzzle with \(n\) discs is \(2^{n}-1.\)

What is the predicate \(P(n)\)?

What value of \(n\) is best to use in the Basis Step?

What is the Induction Hypothesis?

What property of the puzzle is used the key feature to proving the Induction Step? You can describe this in words or use an algebraic equation.

MORE PROOFS TO COME!

11.4. Strong Induction

Strong induction is used when it is easier to use the assumption that all the propositions \(P(0), P(1), \ldots , P(n-1)\) are True in order to prove that \(P(n)\) is True.

Basis Step

Prove the predicate \(P(n)\) is True for one or more consecutive small values of \(n;\) in most but not all cases, you prove both \(P(0)\) and \(P(1).\) You can also prove \(P(n)\) for other values as well if it helps you get a feel for what needs to be proven.

Induction Step

Prove that the conditional statement \(( P(0) \land P(1) \land \cdots \land P(k) ) \rightarrow P(k+1)\) is True for any natural number \(k.\)
Using modus ponens allows you to infer that \(P(k+1)\) must also be True based on the assumption that all of the propositions \(P(0), P(1), \ldots , P(k)\) are True.

Conclusion Step

Conclude that \(P(n)\) is True for all natural numbers \(n\) that are greater than or equal to the small(est) value used in the Basis Step. This conclusion uses universal generalization as the rule of inference.

In spite of the name, strong induction and "weak" induction are equivalently powerful techniques in the sense that any proposition that you can prove using strong induction can also be proven by "weak" induction, and any proposition that you can prove using "weak" induction can also be proven by strong induction. The choice of which of the two proof techniques to use is based on convenience only, not power.

Example 6 - An Upper Bound for the Fibonacci numbers

Recall that the Fibonacci numbers are defined by the following recurrence relation: \[f_{0}=0, \, f_{1}=1, \text{ and } f_{n} = f_{n-1} + f_{n-2} \text{ for } n \geq 2.\]

We will prove that the predicate \[P(n): f_{n} < \displaystyle \left( \frac{1+\sqrt{5}}{2} \right)^{n}\] is True for all natural numbers \(n.\) The proof will use strong induction because, for each \(n \geq 2,\) the value of \(f_{n}\) is defined in terms of both \(f_{n-1}\) and \(f_{n-2}.\)
The number on the right-hand side of the inequality is a famous constant called the golden ratio which is usually denoted by the lowercase Greek letter \(\phi\) ("phi"): \[ \phi = \frac{1+\sqrt{5}}{2} \] \(\phi\) is an irrational number whose first few digits are \(1.618 \ldots .\) Also, \(\phi\) is the positive solution of the equation \(x^{2} = x + 1,\) which is a fact that we will use in the proof. The other solution of \(x^{2} = x + 1\) is \(1 - \phi,\) a fact you can use when you attempt the Challenge question at the end of this example. \[ 1 - \phi = \frac{1-\sqrt{5}}{2} \] Notice that you can verify that \(\phi\) and \(1-\phi\) are the two roots of \(x^{2} - x - 1 = 0\) by using the quadratic formula.

Basis Step: In this case, we need to prove that the conjunction \(P(0) \land P(1)\) is True as our basis for strong induction.

  • \(P(0)\) is the proposition \(f_{0} < \phi^{0}\) which is True since \(0 < 1.\)

  • \(P(1)\) is the proposition \(f_{1} < \phi^{1}\) which is True since \(1 < \phi.\)

Since \(P(0)\) and \(P(1)\) are True, you can use the tautology \(q \rightarrow ( r \rightarrow (q \land r) )\) to conclude that \(P(0) \land P(1)\) is True, too.

Induction Step: First, we assume as the induction hypothesis that \[P(i) \text { is True for all positive natural numbers } i \leq k \] where we can assume that the integer \(k\) is greater than or equal to \(2\) (since the cases where \(k < 2\) were already dealt with in the Basis Step.) That is, we assume that the single proposition \(P(0) \land P(1) \land \cdots \land P(k)\) is True, where \(k\) is some integer greater than or equal to 2.

Secondly, we will prove that the conditional \(( P(0) \land P(1) \land \cdots \land P(k) ) \rightarrow P(k+1)\) must be True, which means we can use modus ponens to show that \(P(k+1)\) is also True.

If the inequality \(f_{i} < \phi^{i}\) is True for each \(i \leq k,\) then \begin{equation} \begin{aligned} f_{k+1} {} & = f_{k} + f_{k-1} \\ & < \phi^{k} + \phi^{k-1} \text{ by the induction hypothesis} \\ & \leq \phi^{k-1} \cdot (\phi + 1) \text{ by algebra} \\ & \leq \phi^{k-1} \cdot \phi^{2} \text{ since } \phi^{2} = \phi + 1 \\ & \leq \phi^{(k-1)+2} \text{ using one of the laws of exponents} \\ & \leq \phi^{k+1} \end{aligned} \end{equation}

We have proven that if \(f_{i} < \phi^{i}\) is True for each natural number \(i \leq k,\) then \(f_{k+1} < \phi^{k+1}\) must also be True. That is, we have proven \(( ( P(0) \land P(1) \land \cdots \land P(k) ) \rightarrow P(k+1)\).

Conclusion Step: We have proven both the Basis Step and the Induction Step. Therefore, we can use universal generalization to conclude that for all natural numbers \(n,\) \(f_{n} < \phi^{n}.\)

Q.E.D.

Challenge
Use strong induction to prove that the closed form of the Fibonacci numbers is \[ f_{n} = \displaystyle \frac{\phi^{n} - (1-\phi)^{n}}{\sqrt{5}} \text{ for all natural numbers }n. \]
Hint
For the Induction Step, use the fact that both \(\phi^{2} = \phi + 1\) and \((1-\phi)^{2} = (1-\phi) + 1\) are True and use steps similar to the ones in the Induction Step in the proof above but working with equations instead of inequalities. Using the two equations in the previous sentence will help you avoid working directly with expressions like \[f_{n} = \displaystyle \frac{ \left( \displaystyle \frac{1 + \sqrt{5}}{2} \right)^{n} - \left( \displaystyle \frac{1 - \sqrt{5}}{2} \right)^{n}}{\sqrt{5}}\] or \[ f_{n} = \displaystyle \frac{ \left( 1 + \sqrt{5} \right)^{n} - \left( 1 - \sqrt{5} \right)^{n} }{ 2^{n} \sqrt{5} } \] which would be unnecessarily difficult and time-consuming.

Next, we’ll prove the following theorem.

The Fundamental Theorem of Arithmetic

Every positive integer \(n\) that is greater than or equal to \(2\) is either a prime number or can be written as a product of two or more prime numbers.

Proof

Let \(P(n)\) be the predicate \[P(n) \text{: "} n \text{ is either prime or the product of two or more primes."}\] We will prove that \((\forall n \in \mathbb{N}_{\geq 2})P(n),\) that is, each positive integer \(n \geq 2\) is either a prime or a product two or more prime numbers.

Basis Step: \(P(2)\) is True since \(2\) is a prime number. In this case, we could use only \(P(2)\) as the basis, but it is easy to prove \(P(3)\) and \(P(4)\) are True since \(3\) is prime and \(4 = 2 \cdot 2\) is a product of two primes.

Induction Step: First, we assume as the induction hypothesis that \[P(i) \text { is True for all positive natural numbers } i \text{ such that } 2 \leq i \leq k \] where we can assume that the integer \(k\) is greater than or equal to \(4\) (since the cases where \(k \in \{ 2, 3, 4 \}\) were already dealt with in the Basis Step.) That is, we assume that the single proposition \(P(2) \land P(3) \land \cdots \land P(k)\) is True, where \(k\) is some integer greater than or equal to 4.

Secondly, we will prove that the conditional \(( P(2) \land P(3) \land \cdots \land P(k) ) \rightarrow P(k+1)\) must be True, which means we can use modus ponens to show that \(P(k+1)\) is also True.

There are two cases: Either \(k+1\) is prime or it is not prime (that is, it is composite.)

  1. If \(k+1\) is prime, then \(P(k+1)\) is True in the case when \(k+1\) is a prime number.

  2. If \(k+1\) is not prime, then there are two integers \(a\) and \(b\) that are both greater than \(1\) such that \(k+1 = ab.\) Notice that both \(a\) and \(b\) must be less than \(k+1\) because if either one were greater than or equal to \(k+1\) then the product \(ab\) would be greater than or equal \(2(k+1).\) Assuming the induction hypothesis, both \(P(a)\) and \(P(b)\) are True, so each of \(a\) and \(b\) is either a prime or a product of two or more primes, which means that the product \(ab\) is a product of at least two primes (if both \(a\) and \(b\) are primes, they are the only two factors of \(k+1,\) otherwise, there will be more than two prime factors of \(k+1.\)) Since \(k+1 = ab\), this proves that \(P(k+1)\) is True in the case when \(k+1\) is a composite number.

In either case, we have shown that \(P(k+1)\) must be True. We have proven that if \(P(i)\) is True for each natural number \(i\) with \(2 \leq i \leq k,\) then \(P(k+1)\) must also be True. That is, we have proven \(( ( P(2) \land P(3) \land \cdots \land P(k) ) \rightarrow P(k+1)\).

Conclusion Step: We have proven both the Basis Step and the Induction Step. Therefore, we can use universal generalization to conclude that for all natural numbers \(n > 2,\) \(n\) is either a prime number or a product of two or more prime numbers.

Q.E.D.

11.5. Validating An Algorithm Using Induction

In this section, we’ll prove that the Euclidean Algorithm as described below correctly computes the greatest common divisor of two positive integers.

  • Task: Given the positive integers \(a\) and \(b\) with \(a > b\), compute the greatest common divisor (or "g.c.d") of \(a\) and \(b.\) That is, compute the greatest integer that is a factor of both \(a\) and \(b.\)

    • Input: Two positive integers

    • Steps:

      1. Set \(a\) to the greater and \(b\) to the lesser of the two input values.

      2. Compute the remainder \(r\) when \(a\) is divided by \(b\) (using long division of integers, not "floating-point" decimals.)

      3. If \(r > 0\)

        1. Set \(a\) equal to \(b\)

        2. Set \(b\) equal to \(r\)

        3. Go to step 2

      4. Return the value stored in \(b.\)

    • Output: A positive integer that is a factor of both input values.

Example 7 - The Euclidean Algorithm in Python

The code below implements integer division for positive integers a and b.

Click on the "Next" button to step through the code.

First, we will prove a lemma (that is, a minor theorem) that we’ll use in the induction step of the main proof.

Lemma

If \(a\) and \(b\) are integers such that \(a > b > 0\) and the integers \(q\) and \(r\) satisfy \[ a = q \cdot b + r \text{ and } 0 \leq r < b \] then the set of positive integers that divide both \(a\) and \(b\) is the same as the set of positive integers that divide both \(b\) and \(r.\)

Proof

Notice that \(q\) is the quotient and \(r\) is the remainder that result when doing a long division of \(a\) by \(b.\)

Also notice that we can rewrite the equation \(a = q \cdot b + r\) in the equivalent form \(r = a - q \cdot b.\)

We can now prove the lemma.

  • If the integer \(c\) divides both \(a\) and \(b\) then there are integers \(a'\) and \(b'\) so that \(a = c \cdot a'\) and \(b = c \cdot b'.\) Substitute these two new expressions in the equation \(r = a - q \cdot b\) to get \begin{equation} \begin{aligned} r {} & = a - q \cdot b \\ & = (c \cdot a') - q \cdot (c \cdot b') \\ & = c \cdot a' - c \cdot (q \cdot b') \\ & = c \cdot (a' - q \cdot b') \end{aligned} \end{equation} which shows that \(c\) is also a divisor of \(r.\) Since we already assumed that \(c\) divides \(b,\) this means that \(c\) is a divisor of both \(b\) and \(r.\) Therefore, the set of positive integers that divide both \(a\) and \(b\) is a subset of the set of positive integers that divide both \(b\) and \(r.\)

  • If the integer \(k\) divides both \(b\) and \(r\) then there are integers \(b''\) and \(r''\) so that \(b = k \cdot b''\) and \(r = k \cdot r''.\) Substitute these two new expressions in the equation \(a = q \cdot b + r\) to get \begin{equation} \begin{aligned} a {} & = q \cdot b + r \\ & = q \cdot (k \cdot b'') + (k \cdot r'') \\ & = k \cdot (q \cdot b'') + k \cdot r'' \\ & = k \cdot (q \cdot b'' + r'') \end{aligned} \end{equation} which shows that \(k\) is also a divisor of \(a.\) Since we already assumed that \(k\) divides \(b,\) this means that \(k\) is a divisor of both \(a\) and \(b.\) Therefore, the set of positive integers that divide both \(b\) and \(r\) is a subset of the set of positive integers that divide both \(a\) and \(b.\)

So we have two subsets, each of which is a subset of the other, which means that the two sets must be equal. That is, the set of positive integers that divide both \(a\) and \(b\) is equal to the set of positive integers that divide both \(b\) and \(r;\) more plainly, the two set descriptions define the same set.

Q.E.D.

From the lemma we can conclude that the greatest common divisor of \(a\) and \(b\) is equal to the greatest common divisor of \(b\) and \(r.\)

We are now ready to prove the main result by induction.

Theorem

The Euclidean Algorithm correctly computes the greatest common divisor (g.c.d.) of the two positive integers \(a\) and \(b.\)

Proof

We use mathematical induction on the number of times \(n\) we must compute a new remainder (that is, the number \(n\) of iterations of the code block inside the loop), and prove that the algorithm computes the correct g.c.d. no matter what the value of \(n\) is.

Let \(P(n)\) be the predicate "If the loop executes \(n\) times, then the last nonzero remainder is the g.c.d. of the two initial inputs." We will prove that \((\forall n \in \mathbb{N})P(n)\) is True.

Basis Step: Notice that the number of iterations of the loop is \(n=0\) if and only if the value of \(r = a\%b\) is equal to \(0\), which is True if and only if \(b\) divides \(a.\) This means that the "last nonzero remainder" is \(b,\) and \(b\) is the greatest common divisor of \(a\) and \(b,\) which means that \(P(0)\) is True.

We can also prove that \(P(1)\) is True in case the proof of \(P(0)\) is unsatisfying. In the case when \(n=1,\) the loop executes \(1\) time, which means that \(a = q \cdot b + r\) and \(r\) is a nonzero divisor of \(b,\) so \(r\) is the g.c.d. of \(b\) and \(r,\) and we can use the lemma to conclude that \(r\) is also the g.c.d. of \(a\) and \(b.\) This proves that \(P(1)\) is True.

Induction Step: First, we assume that the induction hypothesis \(P(k)\) is True for some positive natural number \(k\).

Secondly, we will prove that the conditional \(P(k) \rightarrow P(k+1)\) must be True, which means we can use modus ponens (or the equivalent tautology \(( P(k) \land ( P(k) \rightarrow P(k+1) ) ) \rightarrow P(k+1)\)) to show that \(P(k+1)\) is also True.

Assume that \(P(k)\) is True for the positive integer \(k,\) that is, if the loop executes \(k\) times, then the last nonzero remainder is the g.c.d. of the two numbers we started with. We can assume \(k \geq 1\) since the cases when \(k \in \{ 0, 1 \}\) were proved in the Basis Step. Suppose that we have numbers \(a\) and \(b\) such that the loop executes \(k+1\) times in order to reach the last nonzero remainder: We need to prove that this last nonzero remainder is actually the g.c.d. of \(a\) and \(b.\) Now, notice that if we find the first remainder so that \(r = a - q \cdot b\) and \(0 < r < b,\) then the Euclidean Algorithm requires \(k\) loop iterations to find the last nonzero remainder for the pair of inputs \(b\) and \(r.\) That is , we know from the induction hypothesis that the last nonzero remainder for the initial values \(b\) and \(r\) is the g.c.d. of \(b\) and \(r.\) Now apply the lemma to conclude that the g.c.d. of \(a\) and \(b,\) computed after \(k+1\) loop iterations, is equal to the g.c.d. of \(b\) and \(r,\) computed after \(k\) loop iterations. Therefore, \(P(k+1)\) is True, too. This proves that \(P(k) \rightarrow P(k+1)\).

Conclusion Step: We have proven both the Basis Step and the Induction Step. Therefore, we can use universal generalization to conclude that for all natural numbers \(n,\) if the loop executes \(n\) times then the last nonzero remainder is the g.c.d. of \(a\) and \(b.\) That is, the Euclidean Algorithm correctly computes the g.c.d. of \(a\) and \(b\) no matter how many loop iterations are required to compute the last nonzero remainder.

Q.E.D.

Notice that if \(a = f_{n+2}\) and \(b = f_{n+1}\) are consecutive Fibonacci numbers then the Euclidean Algorithm requires exactly \(n\) loop iterations to compute the last nonzero remainder.
The French mathematician Gabriel Lamé proved in 1844 that if the Euclidean Algorithm requires \(n\) loop iterations to compute the last nonzero remainder for two given positive integer inputs \(a\) and \(b\) (with \(a>b\)) then it must be True that both \(f_{n+2} \leq a\) and \(f_{n+1} \leq b.\) A proof by induction of Lamé’s theorem is given at this Wikipedia page.
The "worst-case complexity" for the Euclidean Algorithm is described at that webpage as well: The Euclidean Algorithm is \(O(log_{\phi}(b)).\) (Complexity and "big \(O\)" notation are discussed in the Rates of Growth of Functions chapter.)

11.6. Exercises

  1. Prove by induction:

    1. For all \(n ≥ 1, \) \(1+2+3+\ldots+n=\displaystyle\sum_{i=1}^{n}i=\displaystyle \frac{n\left(n+1\right)}{2}\)

    2. For all \(n ≥ 1, \) \(1^2+2^2+3^2+\ldots+n^2=\displaystyle\sum_{i=1}^{n}i^2=\frac{1}{6} n (n+1) (2 n+1)\)

    3. For all \(n ≥ 1, \) \(1^3+2^3+3^3+\ldots+n^3=\displaystyle\sum_{k=1}^{n}k^3=\frac{1}{4} n^2 (n+1)^2\)

    4. For all \(n ≥ 1, \) \({23}^n-1\) is divisible by 11.

  2. Prove by induction that \(n^2+n = n(n+1)\) is even for all integers \(n ≥ 1\).

  3. Find an appropriate \(N \in \mathbb{Z}\), and prove by induction that \(n^3 +3n^2\) is even for all \(n ≥ N\).

  4. Find an appropriate \(N \in \mathbb{Z}\), and prove by induction that \(n^3 +2n\) is divisible by 3 for all \(n ≥ N\). (Hint: You may use the result \(n(n+1)\), is even for \(n\), an integer.)

  5. Prove by induction that \(7\) divides \(2^{4n+2} + 3^{2n+1}\) for all nonnegative integers \(n\).

  6. Prove that for any \(n ≥ 1\) and \(x ≥ 0\) that \(\left(1+x\right)^n\geq1+nx\).

  7. For all \(n ≥ 5\), prove that \(n^2 < 2^n\)

  8. Graph \(n!\) and \(2^n\), and then prove by induction that \( 2^n < n!\) for \(n>3\).

  9. Graph \(n^3\) and \(5n+12\), and then use your graph to find an appropriate \(N \in \mathbb{Z}\) to prove by induction that \(5n+12 < n^3\) whenever \(n>N\).

  10. Prove by induction that a set \(A\) with cardinality \(|A|=n\) has \(2^n\) subsets.

  11. Prove by induction that there are \(3^n\) numbers in base 3 (using the digits 0 ,1, 2) made up of \(n\) digits.

  12. Prove by induction that there are \(4^n\) numbers in base 4 (using the digits 0 ,1, 2, 3) made up of \(n\) digits.

  13. State the principle of mathematical induction using a conditional logical statement.

  14. Consider the sequence defined recursively as \[a_1=1,a_2=5, \text{ and } a_n=5a_{n-1}-6a_{n-2}\]

    1. Calculate the first eight terms of the recursive sequence.

    2. Prove by induction that the closed-form formula for the sequence is \(a_{n} = 3^{n} - 2^{n}.\)
      (Hint: You can use the fact that \(2\) and \(3\) are the solutions of the quadratic equation \(x^{2} = 5x - 6.\))

  15. Consider the sequence defined recursively as \[a_1=1 \text{ and } a_n=2a_{n-1}+n\]

    1. Calculate the first eight terms of the recursive sequence

    2. Prove by induction that the recursive sequence is given by the formula \(a_n={4\cdot2}^{n-1}-n-1\).

  16. Recall that the Fibonacci numbers are defined by the following recurrence relation: \[f_{0}=0, \, f_{1}=1, \text{ and } f_{n} = f_{n-1} + f_{n-2} \text{ for } n \geq 2.\]

    1. Prove by induction that \[ f_0+f_1+f_2+\ldots+f_n= f_{n+2}-1. \]

    2. Prove by induction that \[ f_0^2+f_1^2+f_2^2+ \cdots + f_n^2 =f_n \cdot\ f_{n+1}. \]