# Season 3 • Episode 18 • The Tower of Hanoi

(1)

0

## The Tower of Hanoi

### Prerequisites :

Introdutiontoproofbyindution.

### •

Understandtheusefulnessofindutioninalgorithms.

### •

CardboardtowersofHanoi.

Beamer.

### •

WoodentowerofHanoi.

## 1 – Find the shortest number of moves for n ∈ { 2 , 3 , 4 }. 25 mins

Studest work in pairsorgroupsof three tond awayto movethetowertoits destination.Numberof

movesareompared.

## 2 – Study the movements 30 mins

### •

Wheretomovetherstdisk?

### •

Is itpossibletodesribeasimplealgorithmsolvingthepuzzle?

### •

Whatisthelowestpossiblenumberofmovesfora

diskstower?

## 3 – The formula for n disks 35 mins

Prove the general formula for the number of moves for the

### n

disks tower. Then, use it to answer the questionfromthelegend:whenwill theend oftheworldtakeplae?

## 4 – Graph representation 20 mins

Thegraphofallpossiblemovesisshownfor

,

and

### n = 4

.RelationwiththeSierpinskitriangle

(2)

## The Tower of Hanoi

### Episode 18 Document Lesson

ThepuzzlewasinventedbytheFrenhmathematiianÉdouardLuasin1883.It'sbasedonaVietnamese

by64 golden disks.The priestsof Brahma,atingouttheommand ofananientprophey,havebeen

movingthesedisksfromtherstpost tothethird,in aordanewiththefollowingrules:

### •

Onlyonediskmaybemovedat atime.

### •

Eahmoveonsistsoftakingtheupperdiskfromoneofthepostsandslidingitontoanotherpost,on

### •

Nodiskmaybeplaedontopofasmallerdisk.

Aordingtothelegend,whenthelastmoveofthepuzzleisompleted,theworldwillend.Itisnotlear

whether Luasinventedthislegendorwasinspiredbyit.

## Simple solution to the puzzle

The followingproedure yields thelowestpossiblenumberofmovesto moveanynumberof disksfrom

therstposttothethird.

Ifthenumberofdisksisodd,startbymovingthesmallestdisktothedestinationpost.Ifthe

numberofdisksiseven,startbymovingthesmallestdisk totheintermediarypost.

Then, alternate movesbetweenthe smallestpiee and a non-smallest piee. When moving

the smallestpiee, always move it in the samediretion (either to the left orto the right,

aordingtoyourrstmove,butbeonsistent).Ifthereisnotowerin thehosendiretion,

moveitto theopposite end. Whenthe turnis tomovethe non-smallestpiee,there isonly

onelegalmove.

## The lowest number of moves

### The lowest number of moves necessary to move a n disks tower is 2 n − 1 .

Proof.Let'sprovethisresultbyindution.

Basis : First,onsider the

### 1

-disk situation.Then,thelowest numberof movesisobviously

### 1 = 2 1 − 1

,

sothepropertyistrue.

Indutive step: Then, suppose that we have proved the lowest number of moves needed to move a

disks toweris

### 2 k −

, for anaturalnumber

### k

. Let'slook at the

### k + 1

disks tower.Tomoveit to

thedestination post, we must rstmove the

### k

disks at the topof the tower to theintermediary post, then move the largestdisk to the destination post, then move the

### k

disks tower from the intermediaryposttothedestinationpost.Aordingtoourindutionhypothesis,thetotalnumber

ofmovesforthisproedure is

### (2 k − 1) + 1 + (2 k − 1) = 2 × 2 k − 1 = 2 k+1 − 1 .

Sothepropertyistrueforthe

### k + 1

diskstower.

Conlusion : Sineboththebasisandtheindutivestephavebeenproved,ithasnowbeenprovedby

mathematialindution thatthepropertyholdsforallnatural

.

## The end of the world

Ifthelegendweretrue,andifthepriestswereabletomovedisksat arateofoneperseond,usingthe

smallestnumberofmoves,it would takethem

### 2 64 − 1

seondsorroughly600billionyearsto movethe

(3)

2

## Document 1

CardboardtowersofHanoi

Updating...

## References

Related subjects :