Proof of clockwise towers of Hanoi variant recursive solution

This is from one of the exercises in "Concrete Mathematics", and is something I'm doing privately, not homework.

This is a variant on the classic towers of Hanoi, where all moves must be made clockwise only. The recursive solution is to consider $Q_n$ to be the number of moves to move a tower size $n$ one step across (e.g. from start $\rightarrow$ end post), and $R_n$ to be the number of moves to move it two (e.g start $\rightarrow$ end $\rightarrow$ spare).

The recursive solution is (sorry about the formatting, just getting to grips with tex):

$Q_n = 0 \quad \text{if n = 0}$

$Q_n = 2R_{n-1} + 1\quad \text{if n > 0}$

$R_n = 0 \quad \text{if n = 0}$

$R_n = Q_n + Q_{n-1} + 1 \quad \text{if n > 0}$

How can I prove these? I presume an inductive proof is required but everything I've tried to do just gets garbled into a mess of further decreasing $n$ values.

Explaining why these work is simple enough: $Q_n$ can be explained by the fact that you need to move a stack of size $n-1$ two steps forward followed by the $n$ piece, followed by moving the $n-1$ stack two steps again onto the $n$ piece=> $Q_n = R_{n-1} + 1 + R_{n-1} = 2R_{n-1}+1$.

The wordy proof for $R_n$ is similar: It consists of moving $R_{n-1}$ then 1 followed by $Q_n$, 1 and $R_{n-1}$ which will end us up with

$R_n = 2R_{n-1}+1+Q_{n-1}+1 = Q_n+Q_{n-1}+1$

But these are all just words that don't form any real proof... I've gone over the leading chapter and looked up some resources on proof by induction, but doing it with a recursion with two components has put me for a spin (having forgotten a lot of the math studied in the past certainly isn't helping either). If someone could run me through a rigorous proof for $n > 0$ it would be much appreciated.

As an aside, any recommended learning resources on proof by induction would be appreciated as I'm still barely "getting it".


Solution 1:

The "word" description is in fact the guide to a proof. The only problem is showing that the process you describe is in fact optimal. This is done by induction.

we want to prove the formulas you give are the optimal solution.

The case $n=0$ is immediate.

Now: to prove the $k+1$ case assuming the $k$th case (so our induction hypothesis is that the formula you give is optimal for $R_k$ and for $Q_k$), you take a stack of $k+1$ disks. To move them all forward (to perform $Q_{k+1}$) you must get the top $k$ out of the way; that is done, by the induction assumption, with $R_k$ as optimal. Then you move the $k+1$ disk to the target, taking one move; then you move the disks from where they are to the target. Again, by the induction assumption, the best possible way of doing this is $R_k$. So you get that $Q_{k+1}=R_k+1+R_k=2R_k+1$, on the assumption that $Q_k$ and $R_k$ are the optimal moves.

The same argument works for $R_{k+1}$; the only thing that your "just words" is missing is to be clear about what the induction hypothesis is, and to apply it.

Added: Why is the given strategy actually the best? In order to move all the disks from the original rod to the target rod, we must move the largest disk at least once; note that the position of the largest disk does not affect the validity or lack thereof of any move, so the position of the largest disk is immaterial for any other moves (as opposed to any other disk). So the optimal solution will only require us to move the largest disk exactly once, from the original rod to the target rod. In order to do this, we must first remove all disks from above the largest disk, and have no disks on the target rod so we can perform the move; that is $R_k$, because the only configuration that allows us to move the largest disk from the original rod to the target rod is to have all other disks in the non-target rod. Then we move the largest disk, which is the $+1$. And now, we just want to move the remaining disks to their final position in the quickest possible way, which again is $R_k$. A similar argument focusing on placing the largest disk in its final position, works for the computation of $R_{k+1}$.