Feeds:
Posts

## The Farmer and the Fencing

Four years ago I wrote a post about math education that mentioned the problem of “The Farmer and the Fencing.”  The link for the post is here and a sample assignment from an Elementary Algebra (Algebra I) course is here.  I mentioned in that post that I’ve used this problem at a variety of levels of mathematics starting with the 7th grade.

For the 7th grade class, we looked at some possible values for the length and width of the pen that was to be constructed from the fencing and made a table of values showing the length, width and area of the pen for each set of values.

The project from the Elementary Algebra class that is linked above addresses the question from a somewhat more sophisticated level, asking the students to introduce variables for the length and width and then substitute in for one of the variables to arrive at an expression for the area as a function of only one of the dimensions.  The students can then find the maximum area using a graphing calculator.

In a Pre-Calculus class I taught during the 1999-2000 school year, we covered a unit that considered the parabola as a conic section and included applications on projectile motion and maximum and minimum values.  In the Pre-Calculus class, we found the max or min by finding the vertex of the parabola defined at the point $x=\frac{-b}{2a}$ and $y=f(\frac{-b}{2a})$.  We didn’t need Calculus to determine this, the $\frac{-b}{2a}$ can be defined from the vertex form of the equation of a parabola $y=n(x-h)^2+k$.  With a little classical algebra, you can show that $h=\frac{-b}{2a}$.

If you expand $y=n(x-h)^2+k$

$y=n(x^2-2hx+h^2)+k$

$y=nx^2-2nhx+nh^2+k$

Then

$\frac{-b}{2a}=\frac{2nh}{2n}=h$

I taught Differential Calculus as a grad student at the University of Maine in 2003 and we covered The Farmer and the Fencing from the perspective of Calculus, in which we differentiate the area equation and set the derivative equal to zero to find the maximum area.  The problems can be spruced up a little by dividing the pen into smaller pens using cross-sectional pieces.

In the fundamental problem the maximum area of a simple pen with four sides and no cross-divisions is arrived at by splitting the perimeter equally among the four sides to make a square.  If the pen is cross divided in any way, the maximum area comes from a scenario in which half of the perimeter is allocated to the lengthwise pieces and the other half allocated to the any widths.

If there are $m$ lengths and $n$ widths then the perimeter is represented by $ml+nw=P$.  The area is $A=l*w$.  If we isolate the length in the perimeter equation and substitute it into the area equation, we can then differentiate the area equation for an answer for the general problem of maximum area of a pen with $m$by $n$ crosspieces:

$ml+nw=P$

$ml=P-nw$

$l=\frac{P-nw}{m}$

$l=\frac{P}{m}-\frac{nw}{m}$

Then substituting into the area equation:

$A=l*w$

$A=(\frac{P}{m}-\frac{nw}{m})*w=\frac{P}{m}*w-\frac{n}{m}*w^2$

So, the area equation is then

$A=\frac{P}{m}*w-\frac{n}{m}*w^2$

Which makes the derivative

$A'=\frac{P}{m}-\frac{2n}{m}*w$.

Setting this equal to zero and solving for $w$:

$0=\frac{P}{m}-\frac{2n}{m}*w$

$\frac{P}{m}=\frac{2n}{m}*w$

$\frac{m}{2n}*\frac{P}{m}=w$

$\frac{P}{2n}=w$

or

$\frac{P}{2}=nw$

which means that half of the perimeter should be allocated to the $n$ widths and the other half to the $m$ lengths.

For example, if the farmer has 300 feet of fencing, the maximum area is a square that is 75 feet on each side.

If the pen is split into two smaller pens with a crosswise fence, then the maximum area will allocate 150 feet to the widths (75 feet each) and 150 feet to the three lengths (50 feet each).

When I taught this problem in 1999-2000 I asked myself what might happen if the pen were to be divided on the diagonal creating two triangular pens.  Little did I know how much this would complicate such a simple little problem.

The Briggs and Cochran Calculus textbook includes a similar problem in its section on optimization (problem 10c on pg. 214).  In a key modification that makes the problem solvable for Calculus I students, they eliminate one of the lengths of the figure by placing the pen against a barn.

This eliminates one of the lengths in the problem.  Let’s look at the solution to this problem before we tackle the more general version which requires that both lengths come from the available fencing.  In the problem in the textbook, 200 meters of fencing are to be used, so the constraint on the amount of fencing creates the following equation:

$l+2w+\sqrt{l^2+w^2}=200$

If we want to maximize the area of the pen then we need to substitute for one of the variables and find the derivative of the area equation:

$l*w=A$

In order to substitute we need to isolate one of the variables from the constraint equation.  This will involve getting the square root by itself so that we can square both sides of the equation:

$l+2w+\sqrt{l^2+w^2}=200$

$\sqrt{l^2+w^2}=200-2w-l$

$(\sqrt{l^2+w^2})^2=(200-2w-l)^2$

$l^2+w^2=(200-2w-l)(200-2w-l)$

$l^2+w^2=40,000-400w-200l-400w+4w^2+2lw-200l+2lw+l^2$

$l^2+w^2=40,000-800w-400l+4w^2+4lw+l^2$

This is where this problem differs from the general problem, in that the two $l^2$ terms cancel each other out and allow us to isolate the $l$

$w^2=40,000-800w-400l+4w^2+4lw$

We’ll move both terms that contain the $l$ to the same side, so that we can factor out $l$ and then divide through by $400-4w$

$400l-4lw=40,000-800w+3w^2$

$l(400-4w)=40,000-800w+3w^2$

$l=\frac{40,000-800w+3w^2}{(400-4w)}$

So now our area equation becomes:

$\frac{40,000-800w+3w^2}{(400-4w)}*w=A$

OR

$\frac{40,000w-800w^2+3w^3}{(400-4w)}=A$

Finding the derivative for this is pretty messy and strains the display capabilities of this blog!  We’ll do our best to show the work here:

$\frac{(400-4w)(40,000-1600w+9w^2)}{}$

$\frac{-(40,000w-800w^2+3w^3)(-4)}{16(100-w)^2}=A'$

$\frac{(16,000,000-640,000w+3600w^2-160,000w+6400w^2-36w^3)}{}$

$\frac{+160,000w-3200w^2+12w^3)}{16(100-w)^2}=A'$

So, combining like terms:

$-640,000w-160,000w+160,000w=-640,000w$

$3600w^2+6400w^2-3200w^2=+6800w^2$

$-36w^3+12w^3=-24w^3$

$\frac{(16,000,000-640,000w+6800w^2-24w^3)}{16(100-w)^2}$

And then cancel a common factor of 8 in the numerator and denominator:

$\frac{(2,000,000-80,000w+850w^2-3w^3)}{2(100-w)^2}$

The simplified expression for the derivative is:

$\frac{-3w^3+850w^2-80,000w+2,000,000}{2(100-w)^2}=A'$

So from this we need to set the numerator equal to zero.  In the textbook, there is no indication that technology will be necessary to complete the problem, but I don’t see any way around using a graphical solution to finding the root of the derivative.  I suppose there is always the cubic formula, but that is truly an anachronism.  Here’s what the graph of the derivative looks like with the root indicated:

From the graph, we can conclude that:

$w\approx 38.814$

$l\approx 55.03$

and the crosspiece $\sqrt{l^2+w^2}\approx 67.34$

We’ll look at the diagonal problem without the barn (which leads to a Lagrangian solution) in another post.