Matheno - Learn Well and Excel


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:

Garden fence, cost to be minimized
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.

Graph of garden fence cost versus width x
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!

Buy us a coffee We're working to add more,
and would appreciate your help
to keep going! 😊

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$


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$

Buy us a coffee If we've helped, please consider
giving a little something back.
Thank you! 😊

Return to Optimization Problems

Small owl logo
Want access to all of our Calculus problems and solutions? Please visit our Calculus Home screen. It’s all free. (Why? Just because we’re educators who believe you deserve the chance to develop a better understanding of Calculus for yourself, and so we’re aiming to provide that. We hope you’ll take advantage!)

And if you have a Calculus question you could use some help with, please pop over to our Forum and post.  Optimization problems in particular can be tricky to get started on.  If you’re stuck, please post and we’ll be happy to assist!

These days, we use our Forum for comments and discussion of this topic, and for any math questions. It’s also free for you to use, and if you’d like you can post anonymously with any username you choose. We’d love to see you there and help! Please tap to visit our Forum:
We'd appreciate your feedback! 😊
How helpful?

This site is free?!?

We don't charge for anything on this site, we don't run ads, and we will never sell your personal information.

We're passionate educators with a goal:

Provide high-quality, interactive materials to dedicated learners everywhere in the world, regardless of ability to pay,
so they (you!) can learn well and excel.

We're working to develop more.
If you'd like to give back and help support our efforts, all we ask is that you perhaps

Buy us a coffee We're working to add more,
and would appreciate your help
to keep going! 😊