You have 24 metres of fencing and want to enclose a rectangular plot with the largest possible area. Which dimensions should you choose? A long thin rectangle wastes fencing; a square seems better. But how do you prove it? Fermat invented a method for questions like this around 1636, more than thirty years before Newton and almost fifty before Leibniz published calculus. Fermat’s problem Fermat’s first example was exactly this: divide a segment of length $b$ into two parts, $x$ and $b-x$, so that the product $x(b-x)$ is as large as possible. That is our plot: with 24 m of fencing, two adjacent sides add up to $12$, and the area is