1.2.1 MATHEMATICAL INDUCTION 11
developed later. Section 1.3, which follows 1.2, abruptly leaves the realm of
“pure mathematics” and enters into “pure computer programming.”
‘An expansion and more leisurely presentation of much of the following
material can be found in the book Concrete Mathematics by Graham, Knuth,
and Patashnik, second edition (Reading, Mass.: Addison-Wesley, 1994). That
book will be called simply CMath when we need to refer to it later.
1.2.1. Mathematical Induction
Let P(n) be some statement about the integer n; for example, P(n) might be
“n times (n +3) is an even number,” or “if n > 10, then 2" > n3.” Suppose we
want to prove that P(n) is true for all positive integers n. An important way to
do this is:
a) Give a proof that P(1) is true.
b) Give a proof that “if all of P(1), P(2),..., P(n) are true, then P(n + 1) is
also true”; this proof should be valid for any positive integer n.
‘As an example, consider the following series of equations, which many people
have discovered independently since ancient times:
Teh
14+3=2,
14+34+5=37,
14+3454+7=0
14+3+5+7+9
52, (2)
We can formulate the general property as follows:
14+34---+(Qn-1
Let us, for the moment, call this equation P(n); we wish to prove that P(n) is
true for all positive n. Following the procedure outlined above, we have:
a) “P(1) is true, since 1 = 17.”
b) “If all of P(1),..., P(n) are true, then, in particular, P(n) is true, so Eq. (2)
holds; adding 2n + 1 to both sides we obtain
L4+34-+-4(2n—-1) + (2n41) =n? +2n4$1=(n +1),
which proves that P(n +1) is also true.”
We can regard this method as an algorithmic proof procedure. In fact, the
following algorithm produces a proof of P(n) for any positive integer n, assuming
that steps (a) and (b) above have been worked out:
Algorithm I (Construct a proof). Given a positive integer n, this algorithm
will output a proof that P(n) is true
Il. [Prove P(1).] Set & + 1, and, according to (a), output a proof of P(1).12 BASIC CONCEPTS 1.2.1
12. [k = n2] If k =n, terminate the algorithm; the required proof has been
output.
13. [Prove P(k + 1).] According to (b), output a proof that “If all of P(1),...,
P(k) are true, then P(k +1) is true.” Also output “We have already proved
P(1),..-, P(k); hence P(k + 1) is true.”
14. [Increase k.] Increase k by 1 and go to step 12.
[pee
| Il. Prove P(1) 12, k=n? NO * 13, Prove P(k + 1) |! 14, Increase k |
ye
Fig. 2. Algorithm I: Mathematical induction.
Since this algorithm clearly presents a proof of P(n), for any given n, the
proof technique consisting of steps (a) and (b) is logically valid. It is called proof
by mathematical induction.
The concept of mathematical induction should be distinguished from what
is usually called inductive reasoning in science. A scientist takes specific observa-
tions and creates, by “induction,” a general theory or hypothesis that accounts
for these facts; for example, we might observe the five relations in (1), above,
and formulate (2). In this sense, induction is no more than our best guess about.
the situation; mathematicians would call it an empirical result or a conjecture.
Another example will be helpful. Let p(n) denote the number of partitions
of n, that is, the number of different ways to write n as a sum of positive integers,
disregarding order. Since 5 can be partitioned in exactly seven ways,
1+141414+1=2414141=2+241=34141=3+2=4+1=5,
we have p(5) = 7. In fact, it is easy to establish the first few values,
pil) =1, p(2)=2, p(3)=3, p(4)=5, p(5) =7.
At this point we might tentatively formulate, by induction, the hypothesis that
the sequence p(2), p(3), ... runs through the prime numbers. To test this
hypothesis, we proceed to calculate p(6) and behold! p(6) = 11, confirming
our conjecture
(Unfortunately, p(7) turns out to be 15, spoiling everything, and we must
try again. The numbers p(n) are known to be quite complicated, although
§. Ramanujan succeeded in guessing and proving many remarkable things about
them. For further information, see G. H. Hardy, Ramanujan (London: Cam-
bridge University Press, 1940), Chapters 6 and 8.]
Mathematical induction is quite different from induction in the sense just
explained. It is not just guesswork, but a conclusive proof of a statement; indeed,
it is a proof of infinitely many statements, one for each n. It has been called
“induction” only because one must first decide somehow what is to be proved,1.2.1 MATHEMATICAL INDUCTION 13
before one can apply the technique of mathematical induction. Henceforth in
this book we shall use the word induction only when we wish to imply proof by
mathematical induction.
There is a geometrical way to prove Eq. (2).
Figure 3 shows, for n = 6, n® cells broken into u
groups of 1+3+---+(2n—1) cells. However, in
the final analysis, this picture can be regarded as a
“proof” only if we show that the construction can 7
be carried out for all n, and such a demonstration
is essentially the same as a proof by induction.
Our proof of Eq. (2) used only a special case 3
of (b); we merely showed that the truth of P(n)
implies the truth of P(n+1). This isan important — |
simple case that arises frequently, but our next Fig. 3. The sum of odd
example illustrates the power of the method a little numbers is a square.
more. We define the Fibonacci sequence Fo, Fi,
Fy, ... by the rule that Fy = 0, F, = 1, and every further term is the sum of
the preceding two. Thus the sequence begins 0, 1, 1, 2, 3, 5, 8, 13, ...; we will
investigate it in detail in Section 1.2.8. We will now prove that if ¢ is the number
(1+ ¥5)/2 we have
1
Aso (3)
for all positive integers n. Call this formula P(n).
If n= 1, then F, = 1 = 4° = 6-1, so step (a) has been done. For step (b)
we notice first that P(2) is also true, since F, = 1 < 1.6 < ¢' = ¢*-+. Now, ifall
of P(1), P(2), ..., P(n) are true and n > 1, we know in particular that P(n —1)
and P(n) are true; so F,-1 < ¢"-? and Fn < ¢"-1, Adding these inequalities,
we get
Fas = Fat Fn So"? + 9" = "(14 9). (4)
The important property of the number ¢, indeed the reason we chose this number
for this problem in the first place, is that
14+o=8. (5)
Plugging (5) into (4) gives Fa4i < @", which is P(n +1). So step (b) has
been done, and (3) has been proved by mathematical induction. Notice that we
approached step (b) in two different ways here: We proved P(n+1) directly when
n = 1, and we used an inductive method when n > 1. This was necessary, since
when n = 1 our reference to P(n — 1) = P(0) would not have been legitimate.
Mathematical induction can also be used to prove things about algorithms.
Consider the following generalization of Euclid’s algorithm.
Algorithm E (Extended Euclid’s algorithm). Given two positive integers m
and n, we compute their greatest common divisor d and two integers a and b,
such that am + bn = d.
El. [Initialize] Set a’ — b+ Lae + 0,cem, den.