This lecture introduces a new proof technique called proof by induction. It works particularly well for theorems that have the form $\forall n\in\mathbb{N}, P(n)$ for some predicate $P$. It turns out to be an incredibly robust and widely applicable method of proof within computer science, especially as we move towards algorithms. It is also structurally more complex than any of the prior proofs we've seen.
Let's start with some food for thought...
You are the CEO and founder of a company. You want to make sure that, even when you retire, the company's vision never drifts too far from yours. You implement the following rule: "Any CEO of the company must select a successor with the same name as them." 1000000 years later, and many many CEOs later, what is the name of the CEO?
Obviously, the CEO in the future has the same name that you do. In fact, every CEO has the same name! This should hopefully be obvious, but the logical underpinnings are not necessarily as obvious. Consider the predicate $P(n)$ for $n \in \mathbb{N}$ to mean "The $n$th CEO is named [your name]." Then, what we've done is said "If $P(1)$ is true, and $P(i) \to P(i+1)$ for all $i$, then $\forall n P(n)$ must be true.
Now, consider a direct proof approach. How might I have proven that $P(n)$ is true for all $n$ if I couldn't rely on this structure? It's not clear that, if I just looked at what I know about CEO number $100000$, I would know enough to tell you their name.
This story reveals to us a new proof method. If I want to prove that $P(n)$ is true for all $n$, but I don't actually know enough about any individual $n$, I may instead be able to utilize the fact that some structure is retained between numbers - that $P(i) \to P(i+1)$ for all $i$.
Here is the abstract idea behind proof by induction.
Let $P(n)$ be a predicate with domain $n \in \mathbb N$. To prove that $P(n)$ is true for all $n$, we complete two steps:
This is called the principle of mathematical induction. In terms of predicate logic, we can state it as
$$(P(0) \wedge (\forall k, P(k)\rightarrow P(k+1)))\rightarrow (\forall n, P(n)),$$where both quantifiers are over $\mathbb{N}$. The predicate $P$ is often called the inductive hypothesis.
How and when do we make use of this? Mathematical induction is a property of the natural numbers. What this means is that if there is some property that we want to prove about all natural numbers, all we need to do is prove that the property holds for the number 0 and that for any other natural number $k$, if it's true for $k$, then we can show that it's true for the next natural number, $k+1$.
So why does this even work? Basically, what we're really proving is a very large, infinite chain of implications,
\begin{align*} P(0)&, \\ P(0) &\rightarrow P(1), \\ P(1) &\rightarrow P(2), \\ P(2) &\rightarrow P(3), \\ & \vdots \end{align*}The usual analogy for this is a chain of dominoes: we set up our argument so that any one domino is guaranteed to knock over the next domino ($P(k) \rightarrow P(k+1)$ for any $k$). Once we've set this up, all we need to do is knock over the first domino (showing $P(0)$) to set off the chain reaction.
This leads us to what a proof by induction actually looks like.
Here is a famous example where induction is useful.
If $m,n$ are integers with $n\geq m$ and $x_1,\ldots,x_n$ are integers, we use the following notation:
$$\sum_{i = m}^n x_i = x_m + x_{m+1} + \cdots + x_{n-1} + x_n.$$For every $n \in \mathbb N$,
$$\sum_{i=0}^n i = \frac{n(n+1)}2.$$
We will prove this by induction on $n$.
Base case. Let $n = 0$. Then $$\sum_{i = 0}^0 i = 0 \quad \text{and} \quad \frac{0 \cdot (0+1)}2 = 0,$$ so clearly $\sum_{i=0}^n i = \frac{n(n+1)}2$ holds for $n=0$.
Inductive Hypothesis. Let $k \in \mathbb N$ be arbitrary and assume that $\sum_{i=0}^k i = \frac{k(k+1)}2$.
Inductive step. We will show that $\sum_{i=0}^{k+1} i = \frac{k+1(k+2)}2$. We have \begin{align*} \sum_{i=0}^{k+1} i &= \sum_{i=0}^k i + (k+1) \\ &= \frac{k(k+1)}2 + (k+1) & \text{by ind. hyp.} \\ &= (k+1) \cdot \left(\frac k 2 + 1 \right) \\ &= (k+1) \cdot \left(\frac k 2 + \frac 2 2 \right) \\ &= \frac{(k+1)(k+2)}2 \end{align*} Thus, we have shown that $\sum_{i=0}^n i = \frac{n(n+1)}2$ holds for $n=k+1$. Therefore, $\sum_{i=0}^n i = \frac{n(n+1)}2$ holds for all $n \in \mathbb N$.
This method works remarkably well for proving formulas like this. Once you've done a few of them, new problems will mostly reduce to finding the right algebraic manipulation. Here's another.
For every $n \in \mathbb N$,
$$\sum_{i=0}^n 2^i = 2^{n+1} - 1$$We will prove this by induction on $n$.
Base case. Let $n = 0$. Then $$\sum_{i = 0}^0 2^i = 2^0 = 1 \quad \text{and} \quad 2^{0+1} - 1 = 2 - 1 = 1,$$ so clearly $\sum_{i=0}^n 2^i = 2^{n+1} - 1$ holds for $n=0$.
Inductive Hypothesis. Let $k \in \mathbb N$ be arbitrary and assume that $\sum_{i=0}^k 2^i = 2^{k+1} - 1$.
Inductive step. We will show that $\sum_{i=0}^{k+1} 2^i = 2^{k+2} - 1$. We have \begin{align*} \sum_{i=0}^{k+1} 2^i &= \sum_{i=0}^k 2^i + 2^{k+1} \\ &= 2^{k+1} - 1 + 2^{k+1} & \text{by ind. hyp.} \\ &= 2 \cdot 2^{k+1} - 1 \\ &= 2^{k+2} - 1 \\ \end{align*} Thus, we have shown that $\sum_{i=0}^n 2^i = 2^{n+1} - 1$ holds for $n=k+1$. Therefore, $\sum_{i=0}^n 2^i = 2^{n+1} - 1$ holds for all $n \in \mathbb N$.
For all $n \in \mathbb N$ and $x \geq 0$, $(1+x)^n \geq 1+nx$.
We will show this by induction on $n$.
Base case. Let $n = 0$. Then $(1+x)^0 = 1 \geq 1 = 1 + 0 \cdot x$.
Inductive hypothesis. Let $k \in \mathbb N$ be arbitrary and assume that $(1+x)^k \geq 1+kx$.
Inductive step. Consider $n = k+1$.
\begin{align*} (1+x)^{k+1} &= (1+x)^k (1+x) \\ &\geq (1+kx) (1+x) & \text{ind. hyp.} \\ &= 1 + kx + x + kx^2 \\ &= 1 + (k+1)x + kx^2 \\ &\geq 1+(k+1)x & kx^2 \geq 0 \end{align*}which completes the induction.
Note this result had two variables, $x$ and $n$. This is a great example of why what you're applying induction to needs to be carefully considered and clearly stated.
There is room for creativity in using induction. Here is another famous application.
There are $n$ people, and each of them know a different piece of gossip. When two people meet one-on-one, they can't help but share all the gossip they know.
Define the Gossip Number $G(n)$ to be the minimum number of meetings needed for everyone to hear every piece of gossip.
Say there are four people, labeled $A, B, C, D$. First, $A$ meets $B$ and $C$ meets $D$, so the situation is as follows:
Then, person $A$ meets person $C$ to trade stories.
Finally, person $B$ meets person $D$ to spill tea as well.
For all $n \geq 4$, $G(n) \leq 2n - 4$.
We will show this by induction on $n$.
Base case. Note that because we only need to show this for $n \geq 4$, our base case here is actually $4$. By the example earlier, $G(4) = 4$, and $2n-4 = 2(4)-4 = 4$, so $G(4)$ satisfies the inequality.
Inductive Hypothesis. Assume that, for some fixed $n$, $G(n) \leq 2n-4$.
Inductive Step. We aim to show that $G(n+1) \leq 2(n+1)-4$. We know something about the gossip number for any $n$ people. So, let's split our $n+1$ people into a "core" group of $n$ people and one extra person. Denote by $p_1, p_2, ..., p_n, p_{n+1}$ the $n+1$ people in the group. Then say that the core group is $p_1, ..., p_n$. By the Inductive Hypothesis, we know that it takes less than $2n-4$ meetings for everyone in the core group to spread each others' gossip, so consider the following process:
Through this process, we can see that everyone learns all the gossip. Furthermore, it takes $2$ meetings between $p_1$ and $p_{n+1}$, as well as at most $2n-4$ meetings between the core group (due to our IH), which adds up to a total of $2 + (2n-4) = 2(n+1) - 4$, so $G(n+1) \leq 2(n+1)-4$.
As a result, we have shown that if $G(n) \leq 2n-4$ then $G(n+1) \leq 2(n+1)-4$.
There is room for some variation in how you carry out the induction, and your proofs should be careful about the details! For example, the base case should start at the smallest $n$ we are claiming $P(n)$ to be true for, which is not always 0. For example, Theorem 3.6 is stated for all $n \geq 4$, so our base case started at 4.
Now let's see what can go wrong with induction. Consider the following statement.
All horses are the same color.
This is obviously false, so the following proof must be wrong. Try to spot the error.
We will that for all sets $H$ of horses, the horses in $H$ are all the same color. We do this by induction on $n = |H|$, the number of horses under consideration.
Base case. If $|H|=1$, then there is only one horse. A single horse is the same color as itself, so we are done.
Inductive step. Assume that any set of $n$ horses is the same color. Let $H$ be a set of $n+1$ horses, and consider two distinct horses in $H$. By the inductive assumption, if we remove either horse, then the remaining $n$ horses will be the same color. Thus, the first horse is the same color as the other horses, and similarly so is the second horse. Therefore all horses are the same color, completing the inductive proof.
The base case is fine, so the error is in the inductive step. Does this argument work for all $n \geq 2$? (Hint: It doesn't work in exactly one case).
Rosen Chapter 5.1 and Velleman Chapter 6 both have a plethora of great examples.