 # A little maths puzzle in two parts

I like solving little maths puzzles, deriving known results using nothing more complicated than secondary school level trigonometry, algebra and maybe a little calculus. The one below is actually two puzzles, but both have to do with regular polygons.

## Part 1 Approximating π by the perimeter of a regular polygon

Can one approximate $\pi$ by the perimeter of regular polygon with increasing numbers of sides inscribed in a unit circle, so starting with a triangle, then a hexagon, a dodecagon,... ? You may say that is obvious: the more sides, the closer the polygon approximates a circle. But I still wanted to work out the proof. Figure 1. Relationship between length of the side of a polygon and the angle From Figure 1, clearly $$\begin{equation} b=2\,sin\frac{\alpha}{2}\label{eq:1} \end{equation}$$ For a polygon with *n* sides, we have $$\begin{equation} \alpha=\frac{2\pi}{n}\label{eq:2} \end{equation}$$ So we can express the lenght of the side of a polygon as a function of the number of sides as $$\begin{equation} b(n)=2\,sin\frac{\pi}{n}\label{eq:3} \end{equation}$$ The perimeter of a regular polygon is obviously \begin{align} n.b(n) & = & 2n\,sin\frac{\pi}{n}\label{eq:4}\\ & = & 2\pi\frac{sin\frac{\pi}{n}}{\frac{\pi}{n}}\nonumber \end{align} We know that $$\begin{equation} \underset{x\rightarrow0}{lim}\frac{sin\,x}{x}=1\label{eq:5} \end{equation}$$ This is easily proven using de l’Hôpital’s rule

Using $x=\frac{\pi}{n}$ it follows indeed that $$\begin{equation} \underset{n\rightarrow\infty}{lim}n.b(n)=2\pi\label{eq:6} \end{equation}$$ In other words the perimeter of successive polygons inscribed in a unit circle does approach $2\pi$ -- which of course comes hardly as a surprise. The following code implements this starting from a polygon with a given number of sides $n$ . The argument $h$ is half of the length of the side, and $n_{max}$ is the number of iterations. What the algorithm does is recursively creating polygons with $n, 2n, 4n, 8n, ...$ sides. The example starts from a triangle so $n=3$ and $h=\sqrt(3)/2$.