Docsity

Mathematical Induction: Proofs for Algorithms and Abstract Data Types, Papers of Computer Science

Toggle sidebar
bg1
CMPS 101
Algorithms and Abstract Data Types
Summer 2005
Induction Proofs
Let
)(nP
be a propositional function of an integer n, i.e. P is a function whose domain is (some subset
of) the set of integers and whose codomain is the set {true, false}. Informally this means
)(nP
is an
assertion whose truth or falsity depends on the integer n. Mathematical Induction is a proof technique
which can be used to prove statements of the form
)(:
0
nPnn
(“for all n greater than or equal to
0
n
,
)(nP
is true”). Here
0
n
is some fixed integer, and often
1
0
n
. Such a proof consists of two steps:
I. Base Step: Prove directly that the proposition
)(
0
nP
is true.
IIa. Induction Step: Prove
))1()((:
0
nPnPnn
.
To do this pick an arbitrary
0
nn
, and assume for this n that
)(nP
is true. Then show as a
consequence that
)1( nP
is true. The statement
)(nP
is often called the induction hypothesis,
since it is what is assumed in the induction step.
When I and II are complete we conclude that
)(nP
is true for all
0
nn
. Induction is sometimes
explained in terms of a domino analogy. Consider an infinite set of dominos which are lined up and ready
to fall. Each domino is labeled by a positive integer, starting with 1 (i.e.
1
0
n
). Let
)(nP
be the
assertion: “the nth domino falls”. First prove
, i.e. “the first domino falls”, then prove
))1()((: 1 nPnPn
which says “if any particular domino falls, then the next domino must also
fall”. When this is done we may conclude
)(:1 nPn
, “all dominos fall”. There are a number of
variations on the induction step. The first is just a reparametrization of IIa.
IIb. Induction Step: Prove
))()1((:
0
nPnPnn
Let
, assume
)1( nP
is true, then prove
)(nP
is true.
Forms IIa and IIb are said to be based on the first principle of mathematical induction. The validity of
this principle is proved in the appendix of this handout. Another important variation is called the second
principle of mathematical induction, or strong induction.
IIc. Induction Step: Prove
))1())( :((:
0
nPkPnknn
Let
0
nn
, assume that for all k in the range
nkn
0
,
)(kP
is true. Then prove as a
consequence that
)1( nP
is true. In this case the term induction hypothesis refers to the stronger
assumption:
)( : kPnk
.
The strong induction form is often reparameterized as in IIb:
IId. Induction Step: Prove
))())(:((:
0nPkPnknn
Let
, assume for all k in the range
nkn
0
, that
)(kP
is true, then prove as a
consequence that
)(nP
is true. In this case the induction hypothesis is
)( : kPnk
.
In terms of the Domino analogy, the strong induction form IId says we must show: (I) the first domino
falls, and (II) for any n, if all dominos up to but not including the
th
n
domino fall, then the
th
n
domino
falls. From (I) and (II) we may conclude that all dominos fall. Strong Induction is most often
pf3
pf4
pf5

Partial preview of the text

Download Mathematical Induction: Proofs for Algorithms and Abstract Data Types and more Papers Computer Science in PDF only on Docsity!

CMPS 101

Algorithms and Abstract Data Types

Summer 2005

Induction Proofs

Let P (^ n ) be a propositional function of an integer n , i.e. P is a function whose domain is (some subset

of) the set of integers and whose codomain is the set {true, false}. Informally this means P^ ( n ) is an

assertion whose truth or falsity depends on the integer n. Mathematical Induction is a proof technique

which can be used to prove statements of the form  n^^  n 0 : P ( n ) (“for all n greater than or equal to n 0^ ,

P ( n )is true”). Here n 0 is some fixed integer, and often n 0  1. Such a proof consists of two steps:

I. Base Step: Prove directly that the proposition P (^^ n 0 ) is true.

IIa. Induction Step: Prove ^ n^  n 0 :( P ( n ) P ( n ^1 )).

To do this pick an arbitrary n^  n^0 , and assume for this n that P (^ n ) is true. Then show as a

consequence that P^ (^ n ^1 ) is true. The statement P (^ n )is often called the induction hypothesis ,

since it is what is assumed in the induction step.

When I and II are complete we conclude that P^ ( n ) is true for all n^  n^0. Induction is sometimes

explained in terms of a domino analogy. Consider an infinite set of dominos which are lined up and ready

to fall. Each domino is labeled by a positive integer, starting with 1 (i.e. n 0^ ^1 ). Let P^ ( n ) be the

assertion: “the n th domino falls”. First prove P^ (^1 ), i.e. “the first domino falls”, then prove

 n  1 :( P ( n ) P ( n  1 )) which says “if any particular domino falls, then the next domino must also

fall”. When this is done we may conclude  n^^ ^1 : P ( n ), “all dominos fall”. There are a number of

variations on the induction step. The first is just a reparametrization of IIa.

IIb. Induction Step: Prove  n^  n 0 :( P ( n ^1 ) P ( n ))

Let n^ ^ n 0 , assume P (^^ n ^1 )is true, then prove P^ ( n )is true.

Forms IIa and IIb are said to be based on the first principle of mathematical induction. The validity of

this principle is proved in the appendix of this handout. Another important variation is called the second

principle of mathematical induction , or strong induction.

IIc. Induction Step: Prove ^ n  n 0 :(( k  n : P ( k )) P ( n ^1 ))

Let n^  n^0 , assume that for all k in the range n^ 0  k  n , P (^ k )is true. Then prove as a

consequence that P^ (^ n ^1 ) is true. In this case the term induction hypothesis refers to the stronger

assumption:  k^^  n :^ P ( k ).

The strong induction form is often reparameterized as in IIb :

IId. Induction Step: Prove  n^  n 0 :(( k  n : P ( k )) P ( n ))

Let n^ ^ n 0 , assume for all k in the range n^ 0  k  n , that P^ ( k ) is true, then prove as a

consequence that P^ ( n )is true. In this case the induction hypothesis is  k^^  n :^ P ( k ).

In terms of the Domino analogy, the strong induction form IId says we must show: (I) the first domino

falls, and (II) for any n , if all dominos up to but not including the n th domino fall, then the n th domino

falls. From (I) and (II) we may conclude that all dominos fall. Strong Induction is most often

parameterized as in IId, and form IIc is uncommon. We present here a number of examples of IIa, IIb,

and IId.

Example 1 Prove that for all n  1 :

2 (^1 )(^21 )

1

^ 

nn n

i

n i

Proof:

Let P^ ( n )be the boxed equation above. We begin the induction at n 0^ ^1.

I. Base step

Clearly

1 1

i

i , showing that P ( 1 ) is true.

IIa. Induction Step

Let n^ ^1 and assume P (^ n ) is true. That is, for this particular value of n , the boxed equation

holds. Then

2 2 1 2 1 1

 ^  (^ ^1 )

  

i i n

n i n i ( 1 )^2 6

n n n n

(by the induction hypothesis)

(  1 )( 2  1 ) 6 (  1 )^2

nn n n

n n n

(by some algebra)

showing that P (^^ n ^1 ) is true.

We conclude that P^ ( n )is true for all n  1. ///

One should always state explicitly what is being assumed in the induction step (i.e. what is the induction

hypothesis.) One should also make note of the point in the proof at which the induction hypothesis is

used.

Example 2 Let x  R and x  1. Show that for all n  0 :

1

 

x

x

x

n i n i

Proof:

Here we will use form IIb. Again let P (^ n )be the boxed equation. We begin the induction at n 0^ ^0.

I. Base step

0

  ^ 

 x

x

xi x

i

, showing that P^ (^1 ) is true.

IIb. Induction Step

Let n  0 and assume that P (^^ n ^1 )is true, i.e. assume for this particular n that:

^ 

 x

x

x

n i n i

Then

Base Step: Prove P (^^ n 0 ) and P (^^ n 0 ^1 ).

Induction Step: Prove  n^^ (^ n 0 ^2 ):( P ( n ^2 ) P ( n ^1 ) P ( n )).

When this is accomplished we may conclude  n^^  n 0 : P ( n ). In terms of our domino analogy we prove

that: (I) the first two dominos fall, and (II) if any two consecutive dominos fall, then the very next

domino falls. From this we deduce that all dominos fall. The next example uses the Fibonacci numbers

F n which are defined by the recurrence

  if^2 1 if 1 0 if 0 F 1 F 2 n n n F n n n

i.e. each term is the sum of the previous two. Using this recurrence, the first few terms of the sequence

are readily computed as F 0^ ^0 ,^ F 1 ^1 , F 2 ^1 , F 3 ^2 , F 4 ^3 ,… etc.

Example 4 Let

2 1  5

a  , and

2 1  5

b . Prove that for all n^ ^0 , ^ 

n n F nab 5

Proof:

Let P^ ( n )denote the boxed equation above.

I. Base Step

Observe that P^ (^0 ) and P (^^1 ) are true since ^ ^0

a  b   F and ^1 1 ^11

a  b   F.

II. Induction Step ( Double Induction)

Let n  2 and assume that both P^ (^ n ^2 ) and P^ (^ n ^1 )are true, i.e. we assume for this n

2 ^22 

 ^ 

n n

F n a b and  

1 1 1 5

 ^ 

n n

F n a b.

The induction hypothesis yields

  F FFa a b b n n

n n n.

One checks that a and b are roots of the quadratic equation x^2  x  1  0 , whence a^2  a  1 , and

b^2  b  1. Therefore

F n   an   a  bn   b    an  bn 

showing that P (^ n )is true.

Together (I) and (II) imply that ^ 

n n F nab 5

for all n  0. ///

Often the proposition to be proved is an inequality, as the next example illustrates.

Example 5 Define T^ ( n )for n  Z by the recurrence

 ^ ^ 

/ 2 1 if 2 0 if 1 ( ) T n n n T n

Prove that for all n  1 , T^ (^ n )lg(^ n ) (which implies T^ (^ n ) O^ (lg n ).)

Proof:

Let P^ ( n )be the boxed inequality above.

I. Base Step

The inequality T^ (^1 )lg(^1 ) reduces to simply 0  0 , which is obviously true, so P^ (^1 ) holds.

IId. Induction Step (Strong Induction)

Let n  1 and assume for all k in the range 1  k  n that P (^ k ) is true, i.e. T^ (^ k )lg(^ k ). In

particular T^ ^  n /^2 ^ lg^  n /^2  when k^ ^ n /^2 . Therefore T ( n ) T  (^)  n / (^2)   (^1) (by the recurrence for T ( n ))

lg  n / 2   1 (by the induction hypothesis)

lg( n / 2 ) 1 (since  x   x for any x )

lg( n )lg( 2 ) 1

lg( n ),

showing that P (^ n )is true.

Therefore T^ (^ n )lg(^ n )for all n  1 as claimed. ///

Exercise Define S^ ( n )for n  Z by the recurrence

 ^ ^        / 2 1 if 2 0 if 1 ( ) S n n n S n

Prove that for all n  1 : S^ (^ n )lg(^ n ) (whence S^ (^ n )^ (lg n ).)

Induction Fallacies

The next few examples illustrate some pitfalls in constructing induction proofs. The result in Example A

below was proved correctly in Example 3. We give an invalid proof of the same fact which illustrates an

argument some authors have called the “induction trap”.

Example A For all n  1 , if T is a tree on n vertices then T has n  1 edges.

Proof: (Invalid)

Base Step: If n^ ^1 then T has no edges, being acyclic.

Induction Step: Let n  1 and let T be a tree on n vertices. Assume that T has n  1 edges. Add a new

vertex and join it to T with a new edge. The resulting graph has n  1 vertices and n edges (and is clearly

a tree since connectedness is maintained and no cycles were created.) By the principle of mathematical

induction, all trees on n vertices have n^ ^1 edges.

Let us first observe that this argument does not follow the induction paradigm. In this example P (^ n ) is

of the form A (^^ n )^ B ( n ) where A (^ n )is the statement “ T is a tree on n vertices”, and B (^ n )is “ T has

n  1 edges”. The induction step should therefore be to prove, for all n  1 , P (^^ n )^ P ( n ^1 ). That is

( A ( n ) B ( n ))( A ( n  1 ) B ( n  1 )).

To prove this we should assume A (^^ n )^ B ( n ), then assume A (^^ n ^1 ), then show as a consequence that

B ( n  1 )is true. In other words we should:

and

S  { h 1 , h 3 ,, hn  1 } S { h 2 }

each contain exactly n horses, and so by the induction hypothesis all horses in S ^ are of one color, and likewise for S ^. Observe that h^ 3  S  S and that h 3^ can have only one color. Therefore the color of the horses in S  is identical to that of the horses in S . (Note n  1  n  2  n  1  3 , so there is in fact a third horse, and he can have only one color.) Since SS  S it follows that all horses in S are

of the same color. Thus P (^^ n ^1 ) is true, showing that P (^^ n )^ P ( n ^1 ) for all n^ ^1. The result now

follows by induction.

Obviously the proposition being proved is false, so there is something wrong with the proof, but what?

The base step is certainly correct, and the induction step, as stated, is also correct. The problem is that the

induction step was not quantified properly. We should have proved ^ n^ ^1 : P ( n ) P ( n ^1 ) Instead we

proved (correctly) that ^ n^ ^1 : P ( n ) P ( n ^1 ). Indeed it is true that P^ (^2 )^ P (^3 ), P (^^3 )^ P (^4 ), and

P ( 4 ) P ( 5 ), etc.., but we never proved (and it is false that) P ( 1 ) P ( 2 ). In terms of the domino

analogy, it is as if the first domino falls; and if any domino indexed 2 or above were to fall, then the next

domino would fall; but the first domino is not sufficient to topple the second domino, and hence no

domino other than the first actually falls.

Appendix: Proof of the first principle of mathematical induction (form IIb).

We prove for any propositional function P (^ n )defined on the positive integers Z , that

P ( 1 )   n  1 : P ( n  1 ) P ( n )  n  1 : P ( n )

is a tautology. The proof is based on the well ordering property of the positive integers which says: Any

non-empty set of positive integers contains a least element. We assume this property without proof.

Proof:

Assume that the statements P^ (^1 ) and  n^^ ^1 : P ( n ^1 ) P ( n ) are true. Let S^ {^ n^  Z : P ( n )isfalse}.

It will be sufficient to show that S , for then P^ ( n ) is true for all n  1. Assume, to get a

contradiction, that S . Then S contains a smallest element m by the well ordering property. Since

P ( 1 ) is true, 1  S and so m  1. Therefore m  1 , and m  1  1. Since m is the smallest element in

S , we have m^ ^1  S , whence P^ (^ m ^1 ) is true. By setting n^  m^ in the statement

 n  1 : P ( n  1 ) P ( n ) we have P ( m  1 ) P ( m ), and since P ( m  1 ) is true, we conclude that

P ( m ) is also true. Thus m  S , contradicting the very definition of m as the smallest element in S.

This contradiction shows that our assumption was false, and therefore S^  as required.