Move the smaller tower first

Solve the three-disk Tower of Hanoi puzzle in seven moves, then see how the same strategy applies to a larger tower.

The biggest disk needs an empty peg

Three disks on the left peg.

The biggest disk can only move to an empty peg. Everything above it has to be somewhere else first, and the only somewhere else is the spare peg, the one that is neither start nor goal.

More

So moving a tower of any size is three jobs. Move the smaller tower above the biggest disk to the spare peg. Move the biggest disk to the goal peg. Move the smaller tower back on top of it.

The middle job is one move. The other two are the same problem again, one disk shorter, which is why the number of moves doubles and adds one each time a disk is added.

Lesson help

To move a tower, move the smaller tower above the biggest disk out of the way first.

About this lesson

Try the method in a practice when you are ready.

Report

The biggest disk needs an empty peg

The biggest disk can only move to an empty peg. Everything above it has to be somewhere else first, and the only somewhere else is the spare peg, the one that is neither start nor goal.

So moving a tower of any size is three jobs. Move the smaller tower above the biggest disk to the spare peg. Move the biggest disk to the goal peg. Move the smaller tower back on top of it.

The middle job is one move. The other two are the same problem again, one disk shorter, which is why the number of moves doubles and adds one each time a disk is added.

Three disks on the left peg.

Three disks in seven moves

Here are the seven moves, with the pegs numbered 1, 2 and 3 from the left.

Disk 1 to peg 3. Disk 2 to peg 2. Disk 1 to peg 2. Disk 3 to peg 3. Disk 1 to peg 1. Disk 2 to peg 3. Disk 1 to peg 3.

Watch the smallest disk. It moves on every other turn, and it always goes the same way round the three pegs. The moves in between are forced: there is only ever one other legal move.

After three moves: the small tower is parked on peg 2.
Move four: the biggest disk goes to peg 3.
After seven moves.

Which way does the first move go?

In a shortest solution, the smallest disk always travels the same way round. With an odd number of disks it starts towards the goal peg. With an even number it starts towards the spare peg.

Five disks are stacked on the left peg, and every disk has to end on the right peg.

Five disks on the left peg.

Try it

To move five disks from left to right in the fewest moves, where must the smallest disk move first?

  1. On the right peg
  2. On the middle peg
Show the answer

On the right peg

Correct. Five is odd, so the smallest disk starts towards the goal peg and keeps going that way round.

Enable JavaScript to answer interactively and save your place.

Practice Tower of Hanoi

Sign in free

Practice without limits and keep your progress.