Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having trouble understanding precisely how the proof by induction is used to show that it takes at most $2^n-1$ moves to get all the disks from one peg to another. Are there any helpful sources or particular insight that you have that may help me, and others, understand this problem more intuitively?

share|cite|improve this question
up vote 3 down vote accepted

Here's a proof. Basically, the idea behind the induction is this: To solve the case with $n$ disks, you first have to get the top $n-1$ of the disks onto one peg so that you can move the bottom disk. By inductive hypothesis, this takes $2^{n-1}-1$ moves. Then it takes one move to get the bottom disk where it needs to go. Then you have to solve the $n-1$ disk case again, to get them on top of the bottom disk, which takes another $2^{n-1}-1$ moves. So the total number of moves is $$[2^{n-1}-1] + 1 + [2^{n-1}-1] = 2^n - 1.$$

share|cite|improve this answer

The proof goes as follows: for one disk, it takes $1=2^1-1$ move. Assume for up to $n$ disks it takes $2^n-1$ moves. Then for $n+1$ disks, you first have to move the top $n$ to an empty peg, taking $2^n-1$ moves. Next, you move disk $n+1$ to the other empty peg, taking $1$ move. Third, you move the tower of $n$ disks from where it is onto disk $n+1$, again taking $2^n-1$ moves. The total number of moves is $(2^n-1)+1+(2^n-1)=2^{n+1}-1$

share|cite|improve this answer

I have a large pile of disks on peg A, no disks on peg B, and no disks on peg C.

My aim is to construct an algorithm to move n disks from one peg to another. If only I had an algorithm to move n-1 disks from one peg to another - after all, then I could construct an algorithm for n in three simple steps:

  1. move the top n-1 disks from A to B
  2. move the bottom disk from A to C
  3. move the n-1 disks from B to C.

That is, if I have an algorithm that works for n-1, I can very easily construct one (in the three steps I just outlined) that works for n.

But wait - I can move one disk. So let's set n = 2. I have an algorithm that works for 1, so I get one that works for 2. Oh, and now I can set n = 3...

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.