0ord0ring
A set S is well ordered iI every subset has a least element.
1 is not well ordered since (1 has no least element.
Examples:
is well ordered (under the A relation).
Any coutably inIinite set can be well ordered.
The least element in a subset is determined by a biiection (list)
which exists Irom to the countably inIinite set.
can be well ordered but it is not well ordered under the
A relation.
has no smallest element.
The set oI Iinite strings over an alphabet using
lexicographic ordering is well ordered.
,th02,tic, Induction
et P(x) be a predicate over a well ordered set S.
In the case that S ÷ the natural numbers the
principle has the Iollowing Iorm.
P()
P(n) F P(n ¹1)
(x P(x)
The hypotheses are
1
: P() (Basis Step)
: P(n) F P(n ¹1) Ior n arbitrary. (Induction Step)
ow It orks
irst prove that the predicate is true Ior the smallest
element oI the set S ( iI S ÷ N).
Then show iI it is true Ior an element (n iI S÷N) 2508
it is true Ior the 'next¨ element in the set (n ¹ 1 iI S÷N).
Meaning
nowing it is true Ior the Iirst element means it must be
true Ior the element Iollowing the Iirst or the second
element
nowing it is true Ior the second element implies it is
true Ior the third and so Iorth.
ThereIore induction is equivalent to 2odus ponens
applied an countable number oI times!!
utin0 oí Induction Prooí
State what P(n) is.
asis:
Prove that P() is true.
Induction hypothesis:
Assume that P(n) is true Ior an arbitrary n.
Induction step:
Prove that P(n¹1) is true using P(n). (Usually direct
prooI)
,250
Prove:%
n
i ÷ n(n ¹1)/
i÷
In logical notation we wish to show
n %
n
i ÷ n(n ¹1)/ 
i÷
ence P(n) is %
n
i ÷ n(n ¹1)/
i÷
,88
Prove 1: P(0). ÷( ¹1)/
Induct4n Hyp4the8e8
Assume P(n) is true Ior n arbitrary.
Now use this and anything else you know to establish that P(n¹1)
must be true.
,250
Induct4n 8tep rite down the assertion P (n¹1)
P(n ¹ 1) is the assertion %
n¹1
i ÷ (n¹1)((n ¹1)¹1)/
i÷
%
n¹1
i ÷ %
n
i ¹n¹1
i÷ i÷
÷ n(n ¹1)/ ¹ n¹1 (Irom induction hypothesis)
÷ (n(n ¹1) ¹ (n¹1) )/
÷ (n¹1)(n¹)/
÷ (n¹1)((n ¹1)¹1)/
Q.E.D.
or0 G0n0r, Ru0
Suppose we wish to prove Ior some speciIic
integer x xK FP(x)
Now we merely change the basis step to P() and
continue.
,250
Prove 3n ¹ 5 is in O(n
).
Definition. f(n) is in O(g(n)) iI there are constants c~
and such that f(n)Accg(n) Ior n K .
Proof.
e must Iind C and such that 3n ¹ 5 A Cn
Ior n K (or
n ~ 1).
II we try C ÷ 1 then the assertion is not true until k ÷ 5.
ence we prove by induction that 3n ¹ 5 A n
Ior all n K 5.
The assertion becomes nn K 5F 3n ¹ 5 A n

and the predicate P(n) is 3n ¹ 5 A n
.
,250
,88 8tep
P(5): 3L5 ¹ 5 ÷ A(5)
.
Induct4n hyp4the88
Assume P(n): 3n 5 An
is true Ior arbitrary n.
Induct4n 8tep Prove P(n¹1): 3(n 1)5 A(n 1)
rom 3n 5 An
we have (3n 5) 3 An
¹3.
Now we must show that n
¹ 3 A(n ¹ 1)
÷ n
¹ n ¹ 1
which is true iII 3 An ¹ 1
which is true iII n K1.
ut we have already restricted n K5 so n K1 must hold.
That is nn K5F3n 5 An
 i.e. 3n ¹ 5 is in O(n
).
Q.E.D.
oub0 Ou,iíi0r
In doubly quantiIied assertions oI the Iorm
2nP(2n)
we oIten assume m (or n ) is arbitrary to
eliminate a quantiIier and prove the remaining
result using induction.
$trong Induction
1: P()
: P() P(1) ... P(n) F P(n ¹1)
(xP(x)
The two rules are equivalent but sometimes the
second is easier to apply.
,250
or any integer n~1 n can be written as a product oI
primes.
Proof.
et P(n) be the predicate n can be written as a product oI
primes.
,88
P(): can be written as a product oI which is a prime.
Induct4n hyp4the88
or any integer An can be written as a product oI
primes.
,250
Induct4n 8tep
Prove n¹1 can be written as a product oI primes.
II n¹1 is a prime then it can be written as a product oI
itselI only (by deI. oI primes).
II n¹1 is not a prime then there exist integers p and q
such that pcq÷n¹1 (by deI. oI primes) and p and q are
less than n¹1.
Since p and q are less than n¹1 p and q can be written
as products oI primes (by induction hypothesis).
Thus n¹1 can be written as a product oI primes that
make p and q. Q.E.D.
R0cursi·0 or Inducti·0 0íinitions
Basis step
or sets
State the basic building blocks (s) oI the set.
or Iunctions
State the values oI the Iunction on the s.
Inductive or recursive step.
or sets
Show how to build new things Irom old with some
construction rules.
or Iunctions
Show how to compute the value oI a Iunction on the new
things that can be built knowing the value on the old things.
R0cursi·0 or Inducti·0 0íinitions
xtre2al clause.
or sets
II you cant build it with a Iinite number oI applications oI steps . and
. then it isnt in the set.
or Iunctions
A Iunction deIined on a recursively deIined set does not require an
extremal clause.
OIten omitted.
To prove something is in the set you must show how to
construct it with a Iinite number oI applications oI the
basis and inductive steps.
To prove something is not in the set is oIten more
diIIicult.
,250
A recursive deIinition oI
Basis.
is in is the ).
Induction.
iI n is in then so is n ¹ (how to build new obiects
Irom old: 'add one to an old obiect to get a new
one¨).
xtre2al clause.
II you cant construct it with a Iinite numberoI
applications oI the basis and induction it is not in
,250
iven the recursive deIinition oI N we can give
recursive deIinitions oI Iunctions on N:
f()÷1
The initial condition or the value oI the Iunction on the s.
fn¹1)÷(n¹1)cf(n)
The recurrence equation how to deIine f on the new obiects
based on its value on old obiects.
f is the factorial functionf(n) ÷ n!
Note how it Iollows the recursive deIinition oI N.
ProoI oI assertions about inductively deIined obiects
usually involves a prooI by induction.
Prooí guid0in0
Prove the assertion is true Ior the s in the
basis step.
Prove that iI the assertion is true Ior the old
obiects it must be true Ior the new obiects you
can build Irom the old obiects.
Conclude the assertion must be true Ior all
obiects.
,250
e deIine a
n
inductively where n is in N.
asis: a
0
÷ 1
Induction: a
(n¹1)
÷ a
n
ca
%he47em 2 n a
2
a
n
a
2n
(
ProoI:
Since the powers oI a have been deIined inductively we
must use a prooI by induction somewhere. et rid oI the
Iirst quantiIier on 2 by Universal Instantiation:
Assume 2 is arbitrary.
Now prove by induction the remaining quantiIied
assertion
n a
2
a
n
a
2n
(
,250
,88 8tepShow it holds Ior n÷.
The leIt side becomes a
2
a
0
a
2
(1)a
2
The right side
becomes a
2¹0
a
2
ence the two sides are equal to the same value.
Induct4n hyp4the88
Assume the assertion is true Ior na
2
a
n
a
2n
Induct4n 8tep Now show it is true Ior n¹1
(a
2
a
n¹1
a
2n¹1
)
a
2
a
n¹1
÷a
2
a
n
a (by inductive step in the deIinition oI
a
n
)
a
2
a
n¹1
÷ a
2
a
n
a (by associativity oI multiplication)
a
2
a
n¹1
÷ a
2n
a (by the induction hypothesis)
a
2
a
n¹1
÷ a
2n¹1
(by inductive step in the deIinition oI
Root0d 1r00s
The set oI rooted trees where a rooted tree consists oI a set oI
vertices containing a distinguished vertex called the root and
edges connecting these vertices can be deIined recursively as
Iollows:
asis step:
A single vertex r is a rooted tree.
Recursive step:
II T
1
T
. T
n
are rooted trees with roots r
1
r
. r
n
espectively the graph Iorm by starting with a root r which is not
in any oI T
1
T
. T
n
and adding an edge Irom r to r
1
r
. r
n
is also a rooted tree.
t0nd0d Bin,rv 1r00s
The set oI extended binarv trees can be deIined recursively as
Iollows:
asis step:
The empty set is an extended binary tree.
Recursive step:
II T
1
and T
2
are extended binary trees there is an extended binary
tree denoted by T
1
cT
2
consisting oI a root r together with edges
connecting the root to the root oI the leIt subtree T
1
and the right
subtree T
2
when these trees are not empty.
u Bin,rv 1r00s
The set oI full binarv trees can be deIined recursively as Iollows:
asis step:
A single vertex r is a Iull binary tree.
Recursive step:
II T
1
and T
2
are Iull binary trees there is an Iull binary tree
denoted by T
1
cT
2
consisting oI a root r together with edges
connecting the root to the root oI the leIt subtree T
1
and the right
subtree T
2
.
0ight oí 1r00s
The eigt oI a Iull binary tree T denoted by (T) can be deIined
as Iollows:
asis step:
The height oI a Iull binary tree T consisting oI a single vertex r is
(T)÷.
Recursive step:
II T
1
and T
2
are Iull binary trees the height oI a Iull binary tree T
÷ T
1
cT
2
is (T)÷1¹max((T
1
) (T
2
)).
u2b0r oí od0s in , u Bin,rv 1r00
Theorem: II T is a Iull binary tree the number oI nodes in T. denoted
by n(T) is not more than
(T)¹1
1.
ProoI:
asis step:
or a Iull binary tree T oI height T is consisted oI one vertex.
Then n(T)÷1 and
(T)¹1
1 ÷
0¹1
1÷1. Thus n(T)A
(T)¹1
1.
Induction hypothesis:
Assume n(T)A
(T)¹1
1 Ior any Iull binary tree T oI the height less
than .
Induction step:
II T
1
and T
2
are Iull binary trees oI the height less than the
number oI nodes in a Iull binary tree T ÷ T
1
cT
2
is 1¹n(T
1
)¹n(T
2
).
u2b0r oí od0s in , u Bin,rv 1r00
n(T) ÷ 1¹n(T
1
)¹n(T
2
) (Irom the construction oI T)
A 1 ¹ (
(T
1
)¹1
1) ¹ (
(T
2
)¹1
1) (Irom induction hypothesis)
1 ¹ (
(T
1
)¹1
1) ¹ (
(T
2
)¹1
1) ÷
(T
1
)¹1
¹
(T
2
)¹1
1
A cmax(
(T
1
)¹1
(T
2
)¹1
) 1
cmax(
(T
1
)¹1
(T
2
)¹1
) 1 ÷ c(
max((T
1
)¹1. (T
2
))¹1
) 1
÷ c
(T)
1
÷
(T)¹1
1
That is n(T) A
(T)¹1
1.
Q.E.D.
0
47/073
809$8047/070/10;078:809,8,0,89002039
(8349047/070/83.0
(,8340,89002039
,2508 8047/070/ :3/0790A 70,943 3.4:9,31390809.,30047/070/
%00,890020393,8:8098/0907230/,0.943 89 .08981742 9490.4:39,31390809
.,30047/070/:998349047/070/:3/0790 A 70,943
,83482,089002039
%0809411390897384;07,3,5,09:83 0.47,5.47/0738047/070/
902.809..88$905 3/:.943$905 .797.047/070/809$ 390.9:7.904.50.3/:..7 .89014431472 ! ! 3 F ! 3 (! %05490808.07.9$ 903.3:2078 90 573.570/.9.70 ! ! 3 F ! 3 1473 ...943 09! 0.
33 3439897:014790178900203920.943806:..990570/.3002039 3 1$ 2508 9897:014790 309 002039390809 3 1$ 0..49478 789 574.3/841479 %0701470 3/:.3892:890 97:0147900020391443901789479080.03:207419208 .4:39.90897:01479082.0399424/:8543038 .09.3.43/002039250898 97:01479097/.550/.089 0020394190809$ 1$ %03 8419897:0147.43/ 002039 3439897:01479080.
9! 897:0 3/:.9! 3 897:0 :83! 3 &8:.3.90.09.9! 3 8 .09. /70.943!7441 $9.88 !74.943549088 88:209.9 57441 .9! 3 897:0 147.73 3/:.797.:930413/:.9438905 !74.
250 !74..0% 3 3 .
3 34.943089484 3 3% 3 3 .349..
0 ! 3 8% ( 3 3 .( 03.
3 .0! .88 !74.
7 4:8098. 3/:.9! 3 2:89097:0 .3/.797.3930804:3494089.89.9435490808 88:20! 3 897:01473 .
8807943! 3 ! 3 890.8807943% 3 3 3 .250 3/:..9438905790/4390.
% 3 % 3 3 1742 3/:.943 549088 3 3 .
3 3 3 3 .
3 3 .
3 3 .
" .
3/ .88890594! . 39007 KF! ( 402070..3090.4700307.01478420850.4393:0 .1.#:0 $:554800894574.
4389.03/:.88079430.00574.3 K %0. .c 3 1473 K !7441 02:8913/ .3/ 8:..8807943834997:0:39 03.398.90! 3 83 A 3 .70.91 3 A.250 !74.3/90570/..93 A 3 1473 K 47 3 1097 90390.9.9439.9.93 A 3 147.3/ 8:.03 83 3 013943 1 3 83 3 19070.420833K F 3 A 3 ( .
250 .797.0 3 A3 402:89849./70897.73 3/:.0 ! 3 3 A 3 7423 A3 0.0..93 A 3 3 3 .897:011A3 .70..943549088 88:20! 3 3 A3 897:0147.888905 ! L A 3/:..9438905 !74.98 33KF3 A3 ( 03 83 3 " .897:0113 K :90.90/3K843K2:894/ %.
39107.3/574.4:0":.33 708:9:833/:.794 023.8807943841901472 23! 2 3 ( 041903.6:.107 3/4:6:.943 .090702.797.90.88:202 473 8.3910/.
43/80.039:98420920890 80.55 .80794..$97433/:.7006:.943 ! ! ! ! 3 F ! 3 (! %0947:08.
574/:.250 47.943549088 47.3079903.3079903..574/:.3079903.574/:.88 ! .941 57208 .903 ..8.5720 3/:.8.941 .3079903.3390073 3.941 57208 !7441 09! 3 090570/.574/:...941 57208 ..8..8.339007A3 .8.
.574/:..941 980143 /014157208 13 8349.3/6 ..3/5 .3/6 8:..250 3/:.3/6 .33 $3.700889.33 5 .9438905 !74.3079903 .9.8.3079903.574/:.70 0889.984157208 3/:.95c63 /014157208 .5720 9039.943549088 %:8 3 .574/:.3/6 .3/6 " .8574/:.8.8.3079903.941572089.05 .05 .5720 90390700893900785 .9 2.94157208 13 8..03 .3079903.
:041.08905 478098 $4494:/3093817424/98420 .00139438 .9438 $9.:78.9434390 8 3/:.943439030 9389.:/34...9090.9..9.#0.9.8 8 4190809 471:3.:0841901:3.04770.8.:043904/938 .30:934390.9090.425:9090.9438 $4494..888905 478098 $9.:78.43897:.1:3.9437:08 471:3.0473/:.
:80 478098 14:.43897:.943/0130/43..3 09702..88.9.13903:20741.94384190 .084209383493908098419032470 /11.:80 190342990/ %4574.3/3/:..9438 1:3.:78.:78.55..089058 %4574.00139438 9702.:9 .0473/:.9.13903:20741.0/0130/809/408349706:70.#0.999.94384189058.70..3/ 903983 9390809 471:3.55.3 9:/99.084209383908094:2:8984494 ...
3 9..943 13 83 9038483 494:/3040.30 430 9702.3/3/:.55..:78.99409..999.943 983493 .94384190..34/40.88 83 890 3/:.13903:20741 .0/01394341 .//43094.43897:..250 70.98 17424/ .:80 14:.88 .
943 494/01301 43903040.98 1 8901.4.9434390 8 1 3 3 c1 3 %070.08.:041901:3.3.:78.:0434/40.80/4398.0/01394341 0.947.98 .250 ..039070....0 70.3..43/9434790.88079438.98 :8:.:78.0/0139438411:3.006:.943 .0/0130/40.9431 3 3 4904914489070.1:3.9.:7703.0/01394341 !744141.4:93/:.574413/:.943843 1 %039.:78..
3:/1742904/40.888905 !74.:/090.9892:89097:0147903040.090.98 43.8807943897:0147904/ 40. 40.88079432:89097:0147.98 .8807943897:0147908390 .09.9190..984: .!7441:/030 !74.
0 3/:.943 88:2028.3.8807943 3.2.250 0/0130.0 0 2:89:80.9.2 3( !7441 $3.574413/:.389.9.2 3( . 3/:..943 90702.7 4574.3910/ .943 .. 3 .078.88 ..0003/0130/3/:.39.0905407841.00703 83 .9438420070097/4190 17896:.2.33/:.336:.3.3c.797.39107432&3. %0470223.
2.3 .4208.8807943897:01473..2 3 .3 .9412:95.7006:.888905$494/81473 %00198/00.3.9.3 .08905390/01394341 .94389054849897:01473 .3 .9.20.2.3.943549088 .:0 3/:.2 .9.2.250 .884.3 .2. 3/:.2 3 3/:.3 .2 03.08905390/01394341 .2 .2 3 3/:.2.  903/:.4208.3 .2.94908..0 90948/08.2.2 ..2 3.2.943549088 88:2090.943 . . .2%0798/0 0..
439.08 .74497 .5147289.#4490/%7008 %080941 74490/97008 070.888905 830.30/017427 947 7 73 8.8349 3.079.0790..8 1448 .3/..079.30/0130/70.74490/9700 .08.7939.07907 8.0/907449 .:78.:78.9.84.939080.//3.341% % %3 .74490/9700 #0./893:80/.08905 1% % %3 .80941 .0 907.74490/9700.0.4330.43889841.7074490/970089744987 7 73 0850.33.3/ 0/08.
939074499490744941900198:9700% .4330.:78.30903/0/3.30903/0/3.:78.797008 .3/% .703490259 .7%7008 %0809410903/0/3..43889341.3/9079 8:9700% 03908097008.8 1448 .0.30/0130/70.7 9700 /03490/%c% .797008 90708.79700 #0.888905 %002598098.74497 94090790/08 .903/0/3.08905 1% .700903/0/3.
.4330.1:3.08905 1% .888905 830.939074499490744941900198:9700% .43889341.797008 90708.797008 .81448 .:78.79700 #0.3/% .30/0130/70.07907 8.7%7008 %0809411:3.701:3.3/9079 8:9700% .:3.79700 /03490/%c% .0.:78.31:3.74497 94090790/08 .
1:3.1:3.830.797008 900941.701:3.81448 .79700% /03490/ % .30/0130/ . % % .07907 8 % #0..79700% .43889341.08905 1% .:78.1:3.3/% .888905 %00941.79700% %c% 8 % 2.0941%7008 %009 41.
3 3/:.7%700 %047021% 8.3/ % %:8 3 % A % 3/:.9438905 1% .943549088 88:203 % A % 147.79700 903:2074134/083% /03490/ 3 % 834924709.3 90 3:2074134/083.1:3.3/% .79700% 4109 % 8.0790 %03 3 % .888905 47.79700%419009088 9.7970084190090889.:3.1:3.438890/41430.3 % !7441 .79700% %c% 8 3 % 3 % .31:3.:207414/083.701:3.1:3.
98 3 % A % " . % % c2.43897:.:3. % % c 2. % c % % % %.:207414/083.943549088 % % % % A c2.94341% A % % 17423/:.7%700 3% 3 % 3 % 174290.