In this chapter, we’re going to learn about two intertwined concepts: the mathematical proof technique of induction, and the programming technique of recursion. Even though these techniques may seem unrelated, we’ll see over the course of this chapter that they are truly two sides of the same coin. Both are rooted in a fundamental way of representing data and problems, which can be summarized in this general strategy: identify how an entity or problem can be broken down into smaller instances of that entity or problem with the same structure.
Let’s start with an example of a common use of induction in mathematics: proving the correctness of various summation/product formulas. For example, the formulas found in Appendix C.1 can all be proved using induction.
Let
It is possible to verify that this formula is true for any concrete
number like
The first explicit formulation of the principle of induction was
given by the mathematician Blaise Pascal in 1665. However, its uses have
been traced as far back as Plato (370 BC), and a variation of Euclid’s
proof of the existence of infinitely many primes (from around the same
time period). We cannot stress enough the importance of the induction
principle—it is the powerhorse behind nearly all proofs. The
principle of induction applies to universal statements over the
natural numbers—that is, statements of the form
In this course, we will only study rigorously the most basic form of
induction, commonly called simple
induction.In CSC236/CSC240, you’ll learn about different forms of
induction. There are two steps to proving a statement
Once the base case and inductive step are proven, by the principle of
induction, one can conclude
Typical structure of a proof by induction.
Given statement to prove:
We prove this by induction on
Base case: Let
[Proof that
Inductive step: Let
[Proof that
Let’s see induction in action with our above example, proving that
We prove this statement by induction on
Base case: Let
In this case,
Inductive step: Let
Mini-discussion. As with any proof by induction, the key part of completing the induction step is to determine how to use the induction hypothesis. Remember what we said at the beginning of this section: induction is all about breaking down an entity into smaller instances of the same entity. In our case, we know that
, which can be broken down by “taking out” the last term: .
Back to our proof. We’ll start with the left-hand side of the equation:
Proofs by induction often feel like cheating when you first see them.
Rather than directly proving a predicate (e.g.,
In a proof by induction, our base case tells us that