How to make and solve the Tower of Hanoi

How to make and solve the Tower of Hanoi

Have you ever heard of the Tower of Hanoi? It’s a great mathematical puzzle that quickly becomes deviously hard! It was invented in the 19th century and since then it’s been used as a way to practice math concepts and algorithmic thinking. Today, we will show you how to make your own version of this popular puzzle and also how to solve it. Difficulty can be modified by the number of pieces, so it’s appropriate for any age.

Article Contents

1. Tower of Hanoi – Origin of the Name
2. How does the Tower of Hanoi Puzzle work
3. Hanoi Tower Math
4. Materials needed for Hanoi Tower
5. How to make your own easy Hanoi Tower
6. How to solve Tower Of Hanoi (Algorithm for solving Tower of Hanoi)
6.1. If we have even number of pieces
6.2. If we have an odd number of pieces
7. What will you develop and learn by solving Hanoi Tower

The legend goes that there is a temple in Asia where the monks have been solving the Tower of Hanoi puzzle with 64 disks since the beginning of the time. According to this legend, when the monks finish moving all the pieces, the world will end.

Tower of Hanoi – Origin of the Name

This popular puzzle is known by a few different names. Sometimes it’s called Lucas’ Tower in honor of its inventor French mathematician Édouard Lucas, who invented it in 1883.

It’s also referred to as the Tower of Brahma because some believed that the temple from our legend is located in India and that monks are actually Brahmin priests.

The third and most popular name is the Tower of Hanoi. The name refers to a place from the legend, it’s said that the tower is in the capital city of Vietnam, Hanoi.



How does the Tower of Hanoi Puzzle work

You start with the three spots (most often wooden sticks) and a certain number of disks (pieces) stacked on the first spot.

All disks are in different sizes and stacked in a way that a smaller disk is on top of the larger. The goal is to move all the disks from the first spot to the third spot so they are stacked in the same way as in the beginning. However, there are a few rules we must obey.

Tower of Hanoi (Tower of Brahma or Lucas Tower)
The goal of Hanoi Tower is to get all discs from Start to Goal following specific rules.

First is that the disks can be moved only one at the time. Second is that only the disk at the top can be moved on another spot. And the third is that the disk can’t be moved on top of the smaller disk, just on top of the larger disk or on the empty spot.

You can play with any number of pieces and it’s getting progressively harder with each new piece. An additional challenge is to solve the puzzle in the minimum number of moves.

Hanoi Tower Math

Did you already try to solve the Tower of Hanoi and it looks simple? Try to solve the puzzle with 3 pieces in 7 moves. Or with 4 pieces in 15 moves. With 5 pieces, the minimum number of moves is 31! And so on…

For every new piece we add, the minimum number of moves doubles (+ 1 on top of that)! The formula used to calculate this is 2n-1, where n is a number of pieces used.

For example:

1 Disk: 2^1 – 1 = 2 – 1 = 1 move
2 Disks: 2^2 – 1 = 4 – 1 = 3 moves
3 Disks: 2^3 – 1 = 8 – 1 = 7 moves
4 Disks: 2^4 – 1 = 16 – 1 = 15 moves
5 Disks: 2^5 – 1 = 32 – 1 = 31 moves

Do you remember our monks who are trying to solve the puzzle with 64 pieces? They would need 264-1 moves at a minimum. That’s 18446744073709551615 moves! Can you even read that number? If they do one move per second and do every move in the correct order, they would still need 585 billion years to solve the puzzle! So we don’t really need to worry about that end of the world thing anytime soon.



Now you’ll learn how to make your own simple Hanoi Tower and the algorithm for how to solve it. First, try to solve it yourself, the beauty of the puzzles is in struggling before coming to that aha moment.

Materials needed for Hanoi Tower

Materials Needed to make Tower of Hanoi
To make our Tower of Hanoi, we will need Styrofoam or Cardboard, divider and a ruler.
  • Styrofoam or Cardboard. We will use Styrofoam (Cardboard can be a good replacement too) to make our pieces for Hanoi Tower. You can make how many pieces you want, just make sure they are in different sizes.
  • Divider. We will use a divider to draw circles on our styrofoam or cardboard so we can precisely make shapes that are different in size.
  • Ruler. We will use a ruler to measure the different radius of our pieces. Take the ruler and divider, and measure a 1 cm radius. Draw the circle on styrofoam or cardboard. Then measure 2 cm radius and repeat the process. This way we can create as many shapes as we want by increasing the radius by 1 cm.
  • Scalpel or Scissors. We will use a scalpel or scissors to cut out our shapes. Scalpel will be better if we are using styrofoam and scissors if e are using cardboard.
  • Markers. This is a bonus and we will use it to decorate our shapes to make them more interesting and to distinguish them better.
  • A4 or bigger paper. Instead of wooden sticks, we can use plain paper and draw 3 fields. The goal is the same: move all pieces from the first field to the third field.


How to make your own easy Hanoi Tower

For a step by step video guide on how to make the Tower of Hanoi, check out the video at the beginning of the article or continue reading…

We will show you how to make the Hanoi Tower with 5 pieces. But you can easily follow the same steps to create more or fewer pieces for your Hanoi tower.

  • Take the divider and measure the radius of 5 cm with the help of a ruler. Draw a circle on the styrofoam or cardboard.
  • Cut the circle from styrofoam or cardboard using the scalpel or scissors.
  • Now repeat the process but this time measure the radius of 4 cm. Do the same procedure making more circles with 3 cm, 2 cm, and 1 cm radius. This will give you 5 pieces for our Hanoi Tower. If you want more, repeat with circles with a radius of 6+ cm.
  • Use markers to color your pieces so they are more recognizable.
  • Put a piece of A4 paper horizontally and divide it into 3 equal columns so we have enough room for our pieces.
  • Label first column start and the third goal
  • Play the Tower of Hanoi! Can you move your pieces from start to goal in the minimum number of moves? Have fun!


How to solve Tower Of Hanoi (Algorithm for solving Tower of Hanoi)

The algorithm of a tower of Hanoi is actually quite simple and consists only of 3 steps which are repeated until the puzzle is solved.

We will label our positions as A (start), B (middle), and C (goal).

The algorithm depends on the starting number of pieces. If there is an even number of pieces we use different sequences than when there is an odd number.

Example of Hanoi Tower with 3 disks
To solve the Hanoi Tower with 3 disks, we will need a minimum of 7 moves.

If we have even number of pieces

  1. make the legal move between positions A and B
  2. make the legal move between positions A and C
  3. make the legal move between positions B and C
  4. Go to step 1 and repeat steps 1, 2, and 3 until you complete the puzzle.

If we have an odd number of pieces

  1. make the legal move between positions A and C
  2. make the legal move between positions A and B
  3. make the legal move between positions B and C
  4. Go to step 1 and repeat steps 1, 2, and 3 until you complete the puzzle.

Legal move – piece can go only on a bigger piece or on the empty spot.

Although it seems very abstract and it’s hard to visualize, when you start moving the pieces you will appreciate this algorithm. We say it’s an algorithm because it’s a recipe to solve this problem for any number of inputs (pieces) in the minimum number of moves. Try with 6 or 7 pieces and see that it still works!



What will you develop and learn by solving Hanoi Tower

  • Math skills, Algorithmic thinking, and approach to solving the problem in the most efficient way.
  • Technology skills. All computer programs are based on algorithms.
  • Logic skills.

We hope you enjoyed making and then solving the Tower of Hanoi! If you want more fun ways to learn math, improve logical skills or activities with numbers, check out these articles:


If you’re searching for some great STEM Activities for Kids and Child development tips, you’re in the right place! Check the Categories below to find the right activity for you.

STEM Science

STEM Science

Videos, guides and explanations about STEM Science in a step-by-step way with materials you probably already have at your home. Find new Science ideas.

Read more
STEM Technology

STEM Technology

Videos, guides and explanations about STEM Technology in a step-by-step way with materials you probably already have at your home. Find new Technology ideas.

Read more
STEM Engineering

STEM Engineering

Videos, guides and explanations about STEM Engineering in a step-by-step way with materials you probably already have at your home. New Engineering ideas!

Read more
STEM Math

STEM Math

Videos, guides and explanations about STEM Math in a step-by-step way with materials you probably already have at your home. Find new Mathematics ideas.

Read more
Psychology

Psychology

Find out all about development psychology topics that you always wanted to know. Here are articles from child psychology and development psychology overall.

Read more
First year of Child's Life

First year of Child’s Life

Following a Child’s development every month from its birth. Personal experiences and tips on how to cope with challenges that you will face in parenting.

Read more

About Vedran Leder

He always thought classical learning to be boring and bland. He likes to experiment and to learn by doing. With his childish nature, he always blended with children seamlessly.