his week’s Riddler Classic involves designing maximum-area polygons with a fixed budget on the length of the perimeter and the number of vertices. The original problem involved designing enclosures for hamsters, but I have paraphrased the problem to make it more concise.
You want to build a polygonal enclosure consisting of posts connected by walls. Each post weighs $k$ kg. The walls weigh $1$ kg per meter. You are allowed a maximum budget of $1$ kg for the posts and walls.
What’s the greatest value of $k$ for which you should use four posts rather than three?
Extra credit: For which values of $k$ should you use five posts, six posts, seven posts, and so on?
Here is my solution:
[Show Solution]
For a fixed perimeter, the maximum-area polygon with $n$ sides is a regular polygon. Since we are interested in maximizing area, we should therefore always use regular polygons as our shape, and we should always use our entire mass budget of $1$ kg.
Let’s assume the weight of the posts $k$ is given and fixed. If the perimeter is $p$ and the number of sides is $n$, the formula for the area of a regular $n$-gon is as follows (explanation here).
\[
A = \frac{p^2}{4n \tan\frac{\pi}{n}}
\]Our total budget constraint is that $p + kn \leq 1$. Since our goal is to maximize area we should always use our entire budget. So $p = 1-kn$. This means that $n \leq \frac{1}{k}$ in order to ensure we respect the weight budget. So for a fixed $k$, the maximum area of an $n$-gon enclosure is given by the formula
$\displaystyle
A = \frac{(1-kn)^2}{4n\tan\frac{\pi}{n}}\qquad\text{for: }2\leq n \leq \frac{1}{k}
$
Let’s talk about limiting cases for a moment.
- If $n=2$, we have $\tan(\pi/n) = \infty$ so $A=0$. This makes sense; an enclosure with only two sides will be flat and have zero area.
- If $k\to 0$ we can take $n\to\infty$. A polygon with infinitely many sides but a fixed perimeter is simply a circle, so let’s see if this checks out. Using the fact that $\lim_{n\to\infty} n \tan\tfrac{\pi}{n} = \pi$, we obtain a total area of $A = \tfrac{1}{4\pi}$. This is precisely the area of a circle with perimeter $1$! Indeed, if $2\pi r = 1$, then we obtain $r = \frac{1}{2\pi}$ and therefore $A = \pi r^2 = \frac{1}{4\pi}$.
So for each $k$, we should choose the $n \in \{2,3,4,\dots,\lfloor \tfrac{1}{k}\rfloor\}$ that maximizes $A$. Here is a plot showing plots of $A$ for each $n$ and $k$. When $k$ is large (posts weigh a lot), we try to use as few of them as possible. So at first, the triangle ($n=3$) is best. As we decrease $k$, it eventually becomes more efficient to use a square ($n=4$), and so on. As $k$ goes to zero, we obtain the solution with $n\to\infty$, which is the circular enclosure discussed above.

To find out where the transition occurs between $n$ and $n+1$, we should look for the value of $k$ at which the areas match (indicated by the black dots on the plot). So we want to find $k$ such that:
\[
\frac{(1-kn)^2}{4n\tan\frac{\pi}{n}} = \frac{(1-k(n+1))^2}{4(n+1)\tan \frac{\pi}{n+1}}
\]Solving this equation for $k$, we obtain:
$\displaystyle
k_n = \frac{ \sqrt{n \tan \frac{\pi}{n}}-\sqrt{(n+1) \tan \frac{\pi}{n+1}} }{ (n+1)\sqrt{n \tan \frac{\pi}{n}}-n\sqrt{(n+1) \tan \frac{\pi}{n+1}} }
$
We can interpret this formula as follows: $k_n$ is the smallest value of $k$ for which we should use $n$ posts in our enclosure. So if we make $k$ smaller, it becomes more efficient to use $(n+1)$ posts instead. Here are the first few numerical values of $k_n$:
$n$ |
$k_n$ |
Range of $k$ for this $n$ |
$2$ |
$0.333333$ |
$0.333333 \leq k$ |
$3$ |
$0.089642$ |
$0.089642 \leq k \leq 0.333333$ |
$4$ |
$0.039573$ |
$0.039573 \leq k \leq 0.089642$ |
$5$ |
$0.021016$ |
$0.021016 \leq k \leq 0.039573$ |
$6$ |
$0.012511$ |
$0.012511 \leq k \leq 0.021016$ |
$7$ |
$0.008056$ |
$0.008056 \leq k \leq 0.012511$ |
$8$ |
$0.005494$ |
$0.005494 \leq k \leq 0.008056$ |