## Optimization Example: Area of Rectangle

We have a string of length $\ell$. It does not stretch. But we want to form a rectangle using this string as its boundary. Moreover we want this rectangle’s area is maximized. What to do? (Spoiler alert: solution below!)

Well, if we form a rectangle, then it has sides $h$ and $w$ satisfying $2w+2h=\ell$ (the perimiter is equal to the length of string).

The area would be
(1)$\displaystyle A(w,h)=w\cdot h$
This seems simple enough. We impose our constraint to write
(2)$\displaystyle h = \frac{\ell}{2}-w$
Thus our area function becomes
(3)$\displaystyle A(w)=w\left(\frac{\ell}{2}-w\right)$.
How do we find the optimal area?

Take its derivative! We find
(4)$\displaystyle A'(w)=\frac{\ell}{2}-2w$.
Setting this to zero gives us
(4′)$\displaystyle A'(w)=\frac{\ell}{2}-2w=0$.
Its solution is
(5)$\displaystyle \frac{\ell}{4}=w$.
Plugging this back into (2) to find the value of $h$ produces
(6)$\displaystyle h = \frac{\ell}{4}$.
Thus the sides to the rectangle are equal!

So the optimal rectangle (which maximizes its area with its perimiter fixed) is a square!