\documentclass[10pt,envcountsect]{beamer}

\mode<presentation> {
  \usetheme{Warsaw}
}

\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage[T1]{fontenc}
\usepackage{pstricks}
\usepackage{multicol}



\begin{document}

\title{Episode 18 -- The Tower of Hanoi}
\subtitle{European section -- Season 3}
\date{}

\begin{frame}
  \titlepage
\end{frame}


\begin{frame}{The legend}

The puzzle was invented by the French mathematician \emph{Édouard Lucas} in 1883. It's based on a Vietnamese or Indian
legend about temple which contained a large room with three time-worn posts in it surrounded by 64 golden disks. 

\begin{center}
\includegraphics[scale=0.5]{hanoi.eps}
\end{center}



\end{frame}

\begin{frame}{The legend}

The priests of Brahma, acting out the command of an ancient prophecy, have been moving these disks from the first post
to the third, in accordance with the following rules :\pause

\begin{itemize}
\item Only one disk may be moved at a time.\pause
\item Each move consists of taking the upper disk from one of the posts and sliding it onto another post, on top of the
other disks that may already be present on that post.\pause
\item No disk may be placed on top of a smaller disk.\pause
\end{itemize}

According to the legend, when the last move of the puzzle is completed, the world will end. 
\end{frame}

\begin{frame}{Problem 1}
\Large
\begin{center}
Find a solution for 2 disks, for 3 disks and for 4 disks. Count the number of moves needed and try to lower it as
much as possible.
\end{center}
\end{frame}

\begin{frame}{Problem 2}
\Large
\begin{center}
Where must we move the first disk ?\\
Is their a simple algorithm to solve the puzzle ?
\end{center}
\end{frame}

\begin{frame}{Problem 3}
\Large
\begin{center}
What is the lowest number of moves for a $n$ disks tower ?
\end{center}
\end{frame}

\begin{frame}{The algorithm}
\begin{itemize}
\item If the number of disks is odd, start by moving the smallest disk to the destination post.\pause
\item If the number of disks is even, start by moving the smallest disk to the intermediary post.\pause
\end{itemize}

\bigskip

Then, alternate moves between the smallest piece and a non-smallest piece.\pause
\begin{itemize}
\item When moving the smallest piece, always move it in the same direction (either to the left or to the right,
according to your first move, but be consistent).\pause
\item If there is no tower in the chosen direction, move it to the opposite end.\pause
\item When the turn is to move the non-smallest piece, there is only one legal move.
\end{itemize}

\end{frame}

\begin{frame}{The lowest number of moves}

\begin{theorem}
The lowest number of moves necessary to move a $n$ disks tower is $2^n-1$.
\end{theorem}

\end{frame}

\begin{frame}{The lowest number of moves : a proof}

\begin{block}{Proof.}
Let's prove this result by induction.\pause \\
\begin{description}
\item[Basis :]First, consider the $1$-disk situation. Then, the lowest number of moves is obviously $1=2^1-1$, so the
property is true.
\end{description}
\end{block}

\end{frame}

\begin{frame}{The lowest number of moves : a proof}

\begin{block}{Proof.}
\begin{description}
\item[Inductive step :]Then, suppose that we have proved the lowest number of moves needed to move a $k$ disks tower is
$2^k-$, for a natural number $k$.\pause\ Let's look at the $k+1$ disks tower.\pause\  To move it to the destination
post, we must first move the $k$ disks at the top of the tower to the intermediary post,\pause\  then move the largest
disk to the destination post,\pause\  then move the $k$ disks tower from the intermediary post to the destination
post.\pause\  According to our induction hypothesis, the total number of moves for this procedure is
$$(2^k-1)+1+(2^k-1)=2\times 2^k-1=2^{k+1}-1.$$\pause
So the property is true for the $k+1$ disks tower.\pause
\end{description}
\end{block}

\end{frame}

\begin{frame}{The lowest number of moves : a proof}

\begin{proof}
\begin{description}
\item[Conclusion :] Since both the basis and the inductive step have been proved, it has now been proved by mathematical
induction that the property holds for all natural $n$.
\end{description}
\end{proof}

\end{frame}


\end{document}
