Skip to main content
Home
plus.maths.org

Secondary menu

  • My list
  • About Plus
  • Sponsors
  • Subscribe
  • Contact Us
  • Log in
  • Main navigation

  • Home
  • Articles
  • Collections
  • Podcasts
  • Maths in a minute
  • Puzzles
  • Videos
  • Topics and tags
  • For

    • cat icon
      Curiosity
    • newspaper icon
      Media
    • graduation icon
      Education
    • briefcase icon
      Policy

      Popular topics and tags

      Shapes

      • Geometry
      • Vectors and matrices
      • Topology
      • Networks and graph theory
      • Fractals

      Numbers

      • Number theory
      • Arithmetic
      • Prime numbers
      • Fermat's last theorem
      • Cryptography

      Computing and information

      • Quantum computing
      • Complexity
      • Information theory
      • Artificial intelligence and machine learning
      • Algorithm

      Data and probability

      • Statistics
      • Probability and uncertainty
      • Randomness

      Abstract structures

      • Symmetry
      • Algebra and group theory
      • Vectors and matrices

      Physics

      • Fluid dynamics
      • Quantum physics
      • General relativity, gravity and black holes
      • Entropy and thermodynamics
      • String theory and quantum gravity

      Arts, humanities and sport

      • History and philosophy of mathematics
      • Art and Music
      • Language
      • Sport

      Logic, proof and strategy

      • Logic
      • Proof
      • Game theory

      Calculus and analysis

      • Differential equations
      • Calculus

      Towards applications

      • Mathematical modelling
      • Dynamical systems and Chaos

      Applications

      • Medicine and health
      • Epidemiology
      • Biology
      • Economics and finance
      • Engineering and architecture
      • Weather forecasting
      • Climate change

      Understanding of mathematics

      • Public understanding of mathematics
      • Education

      Get your maths quickly

      • Maths in a minute

      Main menu

    • Home
    • Articles
    • Collections
    • Podcasts
    • Maths in a minute
    • Puzzles
    • Videos
    • Topics and tags
    • Audiences

      • cat icon
        Curiosity
      • newspaper icon
        Media
      • graduation icon
        Education
      • briefcase icon
        Policy

      Secondary menu

    • My list
    • About Plus
    • Sponsors
    • Subscribe
    • Contact Us
    • Log in
    • Layered wooden building next to two pegs

      The Towers of Hanoi

      1 September, 2006
      September 2006


      Hanoi towers

      The Towers of Hanoi

      The Towers of Hanoi puzzle was invented by the French mathematician Edouard Lucas in 1883. It consists of three pegs and a number of discs of decreasing sizes. Initially, all discs sit on the same peg in the order of their size, with the biggest disc at the bottom. The aim is to move the whole tower of discs onto another peg, subject to the following rules:

      • when you remove a disc from a peg you must place it on one of the other two pegs before you can move any other disc,
      • you can only place a disc on a peg if either the peg is empty or if the discs already sitting there are larger than the disc you're about to place.

      If you've only got two discs in total, then the puzzle is easy: move the top disc from peg 1 to peg 2, then move the bottom disc from peg 1 to peg 3, and finally move the smaller disc on peg 2 onto the larger disc on peg 3 — done. A little thought will show you that moving a tower of three discs is possible also. But can you show that it is possible to move a tower consisting of any number of discs?

      Hint: Suppose that you have n discs in total. We've already seen that the puzzle can be solved for n equal to 2 and 3. Now assume that you can move a tower of n-1 discs: does this help you to move a tower of n discs? If yes, then why does this prove that the puzzle can be solved for any number of discs? (A proof that uses this way of thinking is an example of the principle of induction.)

      Your proof now gives you a recipe for solving the puzzle for any number of discs. Write mn for the number of moves you need to solve the puzzle with n discs according to this recipe. Can you express mn in terms of mn-1? Can you show that mn is in fact the minimum number of moves needed to solve the puzzle with n discs, in other words that there is no quicker way?



      If you are stumped by last issue's puzzle, here is the solution.

      For some challenging mathematical puzzles, see the NRICH puzzles from this month or last month.

      Solution link
      Towers of Hanoi solution
      • Log in or register to post comments
      University of Cambridge logo

      Plus Magazine is part of the family of activities in the Millennium Mathematics Project.
      Copyright © 1997 - 2025. University of Cambridge. All rights reserved.

      Terms