Saturday, April 9, 2016

Mathematical Analysis of Tower of Hanoi Problem

Tower of Hanoi is a mathematical puzzle invented by French Mathematician Ă‰douard Lucas in 1883.  There is a story about it being associated with Indian temple named Kashi Viswanath temple about which you can read here.

Now, let's jump into the problem.

Picture source: Wikipedia

There are three rods as shown in the figure above.  One of the rods has the discs arranged in the order of their size.  The discs are arranged upwards in the decreasing-size manner.  Our job is to shift whole set of discs to any other rod following the following rules.

  • Only one disc can be moved at a time.
  • Never can a larger disc sit above smaller disc.
  • Only uppermost disc can be moved from the set of discs.
Complying to these rules, we should shift the whole set of discs from first rod to any other rod.  There can be any number of discs.  Our task is to come for general solution for any 'n' number of discs.