posted by Shelby .
A farmer has 120 meters of wire fencing to make enclosures for his pigs and cows. The rectangular enclosure he is considering will have one side up against a barn (in the center of one side that is 150 meters long, so the enclosure won't require fencing along that edge) and a section of fencing perpendicular to the barn, down the middle of the entire enclosure, to keep the pigs and cows separate.
How should the farmer allocate the fencing to the edges of the enclosure to maximize the area inside? That is, for the maximum area enclosure what should be the length of the side of the rectangle perpendicular to the barn and what should be the length of the side of the rectangle parallel to the barn?
If the length along the bar is x, and the width is y,
x+3y = 150
The area a = xy = (150-3y)y = 3(50y-y^2)
da/dy = 3(50-2y) da/dy=0 when y=25
thus, x = 75
So, the whole area is 75x25
As expected, the area is maximum when the fencing is evenly divided between lengths and widths. For a single fully enclosed area, that would be a square.