In my last post on the Farmer and the Fencing optimization problem, I mentioned that separating the pen into two triangular pieces with a diagonal cross-section makes the problem a lot more complex and requires the use of Lagrangian methods to solve. After conceiving the problem in 1999-2000 and setting up the Lagrangian system that would solve the problem in 2001-2002 I finally solved it this week by using Wolfram Alpha. If anyone out there sees a good algebraic solution for the Lagrangian system of three equations with three unknowns, please let me know.
Given 100 feet of fencing, a rectangular pen with length , width and a diagonal cross-section , the perimeter constraint equation would be:
The area equation we want to optimize is:
So, the Lagrangian process says that to maximize a function , with a given constraint , we need to set up a system based on the equality:
In this problem, and .
So the gradient of , or is:
And the gradient of , or is:
So, going back to the functions we’re working with based on the perimeter and area, the Lagrangian set up would be:
This generates the system of equations:
I must admit once again to resorting to a technological solution for this system. Using Wolfram Alpha, we get the solution
This makes the cross-piece:
Which of course means that the optimal area is once again generated by a square! If we assumed this at the outset of the problem, it becomes much simpler (but less “fun”). The permimeter in that case is:
I’ve been carrying this around with me for nearly 15 years and dug out the work I had originally done a few weeks ago to look at it “with fresh eyes.” I found a few minor errors and was happy to use Wolfram Alpha to solve the system and finally generate a solution for this problem.