## Optimization

### Calculus Optimization Problem:

What dimensions minimize the cost of a garden fence?

Sam wants to build a garden fence to protect a rectangular 400 square-foot planting area. His next-door neighbor agrees to pay for half of the fence that borders her property; Sam will pay the rest of the cost. What are the dimensions of the planting area that will minimize Sam’s cost to build the fence? (You may leave your answer as a square root; you don’t have to find a decimal result.)

### Calculus Solution

We’ll use our standard Optimization Problem Solving Strategy to develop our solution. (Link will open in a new tab.)

*Stage I: Develop the function*.

Your first job is to develop a function that represents the quantity you want to optimize. It can depend on only *one* variable. The steps:

**1. Draw a picture of the physical situation.**

See the figure. We’ve called the width of the garden *x* (the top and bottom portions of the fence), and the length of the garden *y* (the left and right sides). Note also that the total area of Sam’s garden must be $A = 400 \text{ ft}^2$.

**2. Write an equation that relates the quantity you want to optimize in terms of the relevant variables.**

We want to minimize Sam’s cost for building the fence, which is the same as minimizing the amount of fence that he’s paying for. Let’s call that cost *C*. Remember that Sam is only paying for half of the cost of the right side of the fence, since his neighbor is paying for that other half. Then

\[ \begin{align*}

C &= \text{(length of left side)} + \text{(length of top)} + \dfrac{1}{2}\text{(length of right side)} + \text{(length of bottom)} \\[8px]
&= y + x + \dfrac{1}{2}y + x \\

&= \dfrac{3}{2}y + 2x

\end{align*} \]

**3. If necessary, use other given information to rewrite your equation in terms of a single variable.**

The cost *C* currently depends on two variables, *y* and *x*. In order to proceed, we must use other information we’re given to rewrite the area in terms of just *one* of those variables. Let’s choose *x* as that single variable.

We must then eliminate *y* as a variable. To do so, recall that Sam’s garden must have area $A = 400 \text{ ft}^2$. Since the garden’s rectangular area is given by

$$A = xy = 400$$

we can solve for *y* in terms of *x*:

$$y = \dfrac{400}{x}$$

Substituting this expression for *y* into our expression above for the cost *C*:

\[ \begin{align*}

C &= \dfrac{3}{2}y + 2x \\[8px]
&= \dfrac{3}{2}\left(\dfrac{400}{x} \right) + 2x \\[8px]
&= \frac{600}{x} + 2x

\end{align*} \]
The expression for *C* is now a function of the single variable *x*, as required.

We’ve graphed the function, a step you probably wouldn’t do yourself — but we want to emphasize that everything you’ve done so far is to create a function that you’re now going to minimize. One choice would be to closely examine the graph to determine the value of *x* that minimizes *C* . . . but instead we’re going to use the max/min techniques you learned recently!

*Stage II: Maximize or minimize the function.*

You now have a standard max/min problem to solve.

**4. Take the derivative of your equation with respect to your single variable. Then find the critical points.**

\[ \begin{align*}

C &= \frac{600}{x} + 2x \\[8px]
&= 600 x^{-1} + 2x \\[8px]
\dfrac{dC}{dx} &= \dfrac{d}{dx}\left( 600 x^{-1}\right) + \dfrac{d}{dx}(2x) \\[8px]
&= -600 x^{-2} + 2 \\[8px]
&= -\dfrac{600}{x^2} + 2

\end{align*} \]

The critical points occur when $\dfrac{dC}{dx} = 0$:

\[ \begin{align*}

\dfrac{dC}{dx} = 0 &= -\dfrac{600}{x^2} + 2 \\[8px]
-2 &= -\dfrac{600}{x^2} \\[8px]
x^2 &= \dfrac{600}{2} \\[8px]
&= 300 \\[8px]
x &= \sqrt{300}

\end{align*} \]
Note that we choose the positive square root since the width *x* cannot be negative. Also note that we could have a critical point where $\dfrac{dC}{dx} = -\dfrac{600}{x^2} + 2$ is undefined, which occurs when $x=0$. That answer makes no physical sense, though, since then Sam’s garden would have zero area. We thus continue our analysis with the single critical point

$$x = \sqrt{300}$$

**5. Justify your maxima or minima either by reasoning about the physical situation, or with the first derivative test, or with the second derivative test.**

Let’s examine the second derivative. Above we found the first derivative:

$$\dfrac{dC}{dx} = -600x^{-2} + 2$$

The second derivative is thus

\[ \begin{align*}

\dfrac{d^2C}{dx^2} &= \dfrac{d}{dx}\left(-600x^{-2}\right) + \dfrac{d}{dx} (2) \\[8px]
&= (-2)(-600)x^{-3} + 0 \\[8px]
&= \dfrac{1200}{x^3}

\end{align*} \]
Since $x > 0$, this second derivative $\left( \dfrac{d^2C}{dx^2} = \dfrac{1200}{x^3}\right)$ is always positive $\left(\dfrac{d^2C}{dx^2} > 0 \right)$. Hence this single critical point gives us a minimum for the cost *C*:

The minimum cost occurs when $x = \sqrt{300}$ ft.

**6. Determine the maxima and minima as necessary. Remember to check the endpoints if there are any.**

Recall that we found above that $y = \dfrac{400}{x}$. Hence when the width $x = \sqrt{300}$, the garden’s length *y* must be:

\[ \begin{align*}

y &= \frac{400}{x} \\[8px]
&= \frac{400}{\sqrt{300}} \\[8px]
&= \frac{400}{\sqrt{100}\sqrt{3}}\\[8px]
&= \frac{400}{10\sqrt{3}} = \frac{40}{\sqrt{3}}

\end{align*} \]
Hence Sam’s cost is minimized when the garden has

width $x = \sqrt{300} \text{ ft,} \quad \cmark$

and

length $y = \dfrac{40}{\sqrt{3}} \text{ ft.} \quad \cmark$

**7. Finally, check to make sure you have answered the question as asked: $x$ or $y$ values, or coordinates, or a maximum area, or a shortest time, or . . . .**

The question asked us to specify the garden’s dimensions, which we have provided. $\checkmark$

Return to Optimization Problems

Want access to *all* of our Calculus problems and solutions? Buy full access now — it’s quick and easy!

### Do you need immediate help with a particular textbook problem?

Head over to our partners at Chegg Study and gain (1) *immediate* access to step-by-step solutions to most textbook problems, probably including yours; (2) answers from a math expert about specific questions you have; AND (3) 30 minutes of free online tutoring. Please visit Chegg Study now.

If you use Chegg Study, we’d greatly appreciate hearing your super-quick feedback about your experience to make sure you’re getting the help
you need.