In this discussion we had four induction proofs, practicing techniques from CMPSCI 250.
Questions are in black, answers in blue.
Base Case:
The statement P(1) says that a K1 has 1(1-1)/2=0 edges.
This is true because the definition says it has no edges.
Inductive Hypothesis: A Kn has n(n-1)/2 edges.
Inductive Goal: A Kn+1 has (n+1)(n+1-1)/2 = n(n+1)/2
edges.
Proof of Inductive Goal: By the definition the Kn+1
has exactly n more edges than does the Kn. So it has n + n(n-1)/2,
which equals n(n+1)/2 by arithmetic.
Let n be an arbitrary positive integer. We prove the desired statement by
induction on e.
Base Case: If e=0 then each of the n nodes forms its own connected
component, so there are n connected components, which equals the claimed n-e.
Inductive Hypothesis: A forest with n nodes and e edges has n-e
connected components.
Inductive Goal: A forest with n nodes and e+1 edges has n-(e+1) =
n-e-1 connected components, assuming e+1 &le n-1.
Proof of Inductive Goal: Consider such a forest and remove one of
its edges. Since it now has e edges, by the inductive hypothesis it has n-e
connected components. Now put the edge back. Since the new edge does not
create a cycle, it must connect two points that were in different components,
reducing the number of components by one. (Here is where we use the assumption
about e+1, to be sure that there are at least two connected
components.) So now there are (n-e)-1 connected components, as desired.
This completes the induction proof, so the statement is true for this n
and for all e in the indicated range. Then, since n was arbitrary, we may
conclude that the statement is true for all n.
Base Case: When d=0, the definition tells us that there is
20+1-1=1 node and that there are 20+1-2 = 0 edges.
Inductive Hypothesis: An FRBT of depth d has 2d+1-1
nodes and 2d+1-2 edges.
Inductive Goal: An FRBT of depth d+1 has 2d+2-1
nodes and 2d+2-2 edges.
Proof of Inductive Goal: The FRBT of depth d+1 consists of two
FRBT's of depth d, plus one more node and two more edges. So it has
2(2d+1-1)+1 = 2d+2-1 nodes and
2(2d+1-2)+2 = 2d+2-2 edges, as desired.
int gcd (int a, int b)
{ //assumes a > b >= 0
if (b == 0) return a;
else return gcd (b, a%b);}
The statement "P(n)" is "For any a and b with a+b=n, gcd(a,b)
terminates with the correct answer".
Base Case: Since a > b ≥ 0 is given, the smallest possible
value of a+b is 1. In this case, the call gcd(1,0) terminates without
recursing and returns 1, which is the correct answer.
Strong Inductive Hypothesis: For any m with m≤n, and for any
a and b with a>b≥0 and a+b=m, gcd(a,b) terminates with the correct
answer.
Inductive Goal: For any a and b with a>b≥0 and a+b=n+1,
gcd(a,b) terminates with the correct answer.
Proof of Inductive Goal: Consider the operation of gcd(a,b) with
these assumptions. If b=0, then gcd(n+1,0) terminates without recursing and
returns n+1, which is the correct answer. If b>0, then gcd(a,b) makes
a recursive call to gcd(b,c), where c is a%b
. Since b+c
is less than a+b (we know that a%b
is less than a as long as
a>b), the inductive hypothesis tells us that gcd(b,c) terminates with the
correct answer. Thus gcd(a,b) terminates with the correct answer for
gcd(b,c), and the homework problem tells us that this is the correct answer
for gcd(a,b) as well.
Last modified 6 February 2007