# flowerchild1993's question at Yahoo! Answers regarding minimizing cost of fence

#### MarkFL

Staff member
Here is the question:

Calculus help! Word problem?

A rectangular field is to be enclosed on four sides with a fence. Fencing costs $3 per foot for two opposite sides, and$8 per foot for the other two sides. Find the dimensions of the field of area 770 ft squared that would be the cheapest to enclose.
Here is a link to the question:

Calculus help! Word problem? - Yahoo! Answers

I have posted a link there to this topic so the OP can find my response.

#### MarkFL

Staff member
Hello flowerchild1993,

Let's let $x$ be the length of one pair of sides, for which fencing costs $C_x$ in dollars per foot and $0$ be the length of the other pair of sides, for which fencing costs $C_y$ in dollars per foot. All measures and constants are positive.

The cost function is therefore:

$$\displaystyle C(x,y)=2C_xx+2C_yy$$

Let the area of the field be $A$, and so we have:

$$\displaystyle A=xy\,\therefore\,y=\frac{A}{x}$$

and so we may write the cost function in terms of one variable $x$:

$$\displaystyle C(x)=2C_xx+2AC_yx^{-1}$$

Now, to find the extrema, we differentiate with respect to $x$ and equate to zero:

$$\displaystyle C'(x)=2C_x-2AC_yx^{-2}=0$$

Multiplying through by $$\displaystyle \frac{x^2}{2}$$ we may arrange this as:

$$\displaystyle x^2=\frac{AC_y}{C_x}$$

Taking the positive root, we find:

$$\displaystyle x=\sqrt{\frac{AC_y}{C_x}}$$

And so:

$$\displaystyle y=\frac{A}{\sqrt{\frac{AC_y}{C_x}}}=\sqrt{\frac{AC_x}{C_y}}$$

This is why I used variables to denote the constants of the problem...we can now see how the dimensions of the field will change with respect to changes made to any of the constants. We see that if $C_x$ increases then $x$ will decrease and $y$ will increase, etc. We also see that:

$$\displaystyle \frac{x}{y}=\frac{C_y}{C_x}$$

This ratio also tells us how the dimensions will vary based on the costs.

Using the second derivative test for relative extrema, we find that:

$$\displaystyle C''(x)=4AC_yx^{-3}>0$$ for $$\displaystyle x>0$$ which we have assumed, and so we know this critical value is at a minimum.

Now it's just a matter of using the given data to find the required dimensions. Let's let $x$ be the pair of sides with the cheaper fencing, so we have:

$$\displaystyle C_x=3,\,C_y=8,\,A=770$$

$$\displaystyle x=\sqrt{\frac{770\cdot8}{3}}=\frac{4\sqrt{1155}}{3}$$

$$\displaystyle y=\sqrt{\frac{770\cdot3}{8}}=\frac{\sqrt{1155}}{2}$$

To flowerchild1993 and any other guests viewing this topic, I invite and encourage you to post other optimization problems here in our Calculus forum.

Best Regards,

Mark.