### Example 4.3.2. Optimization: perimeter and area.

A man has \(100\) feet of fencing, a large yard, and a small dog. He wants to create a rectangular enclosure for his dog with the fencing that provides the maximal area. What dimensions provide the maximal area?

Solution.

One can likely guess the correct answer — that is great. We will proceed to show how calculus can provide this answer in a context that proves this answer is correct.

It helps to make a sketch of the situation. Our enclosure is sketched twice in Figure 4.3.3, either with treetop grass and nice fence boards or as a simple rectangle. Either way, drawing a rectangle forces us to realize that we need to know the dimensions of this rectangle so we can create an area function — after all, we are trying to maximize the area.

We let \(x\) and \(y\) denote the lengths of the sides of the rectangle. Clearly,

\begin{equation*}
\text{ Area } =xy\text{.}
\end{equation*}

We do not yet know how to handle functions with two variables; we need to reduce this down to a single variable. We know more about the situation: the man has \(100\) feet of fencing. By knowing the perimeter of the rectangle must be \(100\text{,}\) we can create another equation:

\begin{equation*}
\text{ Perimeter } = 100 = 2x+2y\text{.}
\end{equation*}

We now have two equations and two unknowns. In the latter equation, we solve for \(y\text{:}\)

\begin{equation*}
y = 50-x\text{.}
\end{equation*}

Now substitute this expression for \(y\) in the area equation:

\begin{equation*}
\text{ Area } = A(x) = x(50-x)\text{.}
\end{equation*}

Note we now have an equation of one variable; we can truly call the Area a function of \(x\text{.}\)

This function only makes sense when \(0\leq x \leq 50\text{,}\) otherwise we get negative values of area. So we find the extreme values of \(A(x)\) on the interval \([0,50]\) using Key Idea 3.1.18.

To find the critical points, we take the derivative of \(A(x)\) and set it equal to \(0\text{,}\) then solve for \(x\text{.}\)

\begin{align*}
A(x) \amp = x(50-x)\\
\amp = 50x-x^2\\
A'(x) \amp = 50-2x
\end{align*}

We solve \(50-2x=0\) to find \(x=25\text{;}\) this is the only critical point. We evaluate \(A(x)\) at the endpoints of our interval and at this critical point to find the extreme values; in this case, all we care about is the maximum.

Clearly \(A(0)=0\) and \(A(50)=0\text{,}\) whereas \(A(25) = 625\)ft

^{2}. This is the maximum. Since we earlier found \(y = 50-x\text{,}\) we find that \(y\) is also \(25\text{.}\) Thus the dimensions of the rectangular enclosure with perimeter of 100 ft. with maximum area is a square, with sides of length 25 ft.