1

I have my discrete structures exam tomorrow, and right now i am practicing mathematical induction, specially proofs. while proving, i just get confused because i don't understand what should i add or subtract to prove the inductive step. i was wondering if there is any tip or trick to know what should we add or subtract or multiply or and other operation?

EDIT: I was trying the Tower of Hanoi, and in that prove the induction statement was (2^n)-1. And later on in that proof, in the inductive step, a guy did this: ((2^n)-1) + 1 + ((2^n)-1), to make it ((2^n+1) - 1). I just don't understand why he added 1 + ((2^n) - 1), not any other term? Thanks in advance. Regards Ahmed Dhanani

Ahmed Dhanani
  • 11
  • 1
  • 3

2 Answers2

2

Consider the Tower of Hanoi game and try to "see" the general procedure in it ...

We want to prove that :

The minimum number of moves required to solve it is $2^n - 1$, where $n$ is the number of disks.


The $0$-th step is a conjecture about the formula we want to prove; in this case, someone (the exercise-book) gives us the formula to be checked : $2^n - 1$.

Call it $P(n)$; it is the "property" we want to use in the proof that : "for all $n$, $P(n)$" holds.


In order to prove it by induction, we need two steps :

(i) the so-called basis (or base step) of the proof; i.e. we have to prove that $P(n)$ holds for the "initial condition" : usually $0$ or $1$.

In this case, the "initial condition" must be $1$, i.e. we have to prove that a ToH with $1$ disks can be "moved" with $2^n - 1$ moves.

But $2^n - 1 = 2^1 - 1 = 2 - 1 = 1$ and it is obviously true that if the ToH has only one disk, then it is enough to move it to the "final position".

Thus, one move suffices, and we have proved that $P(1)$ holds.


Now we need the second step of the induction :

(ii) the so-called induction step; we assume that $P(n)$ holds [we call it : the induction hypothesis] and we have to prove that $P(n+1)$ holds.

Thus, we have to assume that we are able to move a ToH with $n$ disks in $2^n - 1$ moves and we have to calcultate how many moves we need in order to move a ToH with $n+1$ disks (i.e. one more).

Here we need the real insight; in order to complete the $n+1$ disks task, we have :

1) to move the first $n$ disks from A to B (we need $2^n - 1$ moves) leaving alone the "bottom" disk;

2) then we have to move it on C (one move is needed); and finally :

3) we have to move again the $n$ disks "parked" in B to A. Again, it is a task of moving $n$ disks; thus it needs, according to our induction hypothesis, $2^n - 1$ moves.

Now we need a simple calculation : 1) needs $2^n - 1$ moves, 2) needs $1$ move, and 3) needs again $2^n - 1$ moves.

Thus, the total number of moves for the $n+1$ disks ToH is :

$$(2^n - 1) + 1 + (2^n - 1).$$

Applying some simple algebraic transformations we have that the total number is :

$$(2^n + 2^n) - 1 + 1 - 1 = 2(2^n)-1 = 2^{n+1}-1.$$

But this is $P(n+1)$ ...

Thus, we have proved that ::

if $P(n)$ holds, than also $P(n+1)$ holds.


Conclusion : having proved that $P(1)$ holds, and that : if $P(n)$ holds, than also $P(n+1)$ holds, we are licensed to use the principle of Mathematical induction to conclude with :

for all $n$, $P(n)$ holds.

In the ToH case, this amounts to :

for a ToH with $n$ disks, for $n$ whatever, the minimum number of moves required to solve it is $2^n - 1$.

0

An induction step will answer the following question: knowing how to solve for $n$ items, how can I solve for $n+1$ items ?

In the case the Hanoi towers, this is obvious: if I am able to move a tower of $n$ disks, I can move a Tower of $n+1$ disks in three steps:

  • move the top $n$ disks (say from A to B),
  • move the bottom disk (from A to, say, C),
  • move the $n$ disks (from B to C).

This immediately translates to the number of disk moves:

$$M(n+1)=M(n)+1+M(n).$$

Thus you established the recurrence $$M(n+1)=2M(n)+1\text{, with }M(1)=1.$$ As you can check, $M(n)=2^n-1$ is a solution, as $$2^{n+1}-1=2(2^n-1)+1\text{, with }2^1-1=1.$$

OTHER EXAMPLE

Assume I am able to find a given key among a sorted list of $n$ elements.

Then I can find the key among $n+1$ elements by comparing to the first element, then searching among the $n$ next in case of a failure.

The number of comparisons will be $$C(n+1)=1\text{ or }C(n)+1,$$ and in the worst case (all tests being negative), $$C(n+1)=C(n)+1\text{, with }C(1)=1.$$ The solution is $$C(n)=n.$$

But I can work another way: if I take a sorted array of $2n$ elements, by comparing the key to the middle element, I can say in what halve the key must be, and I will only search that half.

The number of comparisons will be $$C(2n)=1+C(n)\text{, with }C(2)=2.$$ The solution is $$C(n)=\log_2n.$$

The terms that you add up depend on how partial solutions are combined to each other.