Intro to Maximization Problems

Imagine you are Farmer Berry and you have 400 m of Fence. As any American, you want to make the most profit, and as a farmer, you get the most profit from making most of your cows. So how can we MAXIMIZE Farmer Berry's profit?
<- Farmer Berry
Let's just try it out. Try to resize the Area below. Do not use more than 400m Fence
Fence Used: 200 m
Area Spanned: 10000 sqm
Height:
Width:
You think you got it all figured out? Let's test it. Resize the field and stop to create a datapoint.
Fence Used: 200 m
Area Spanned: 10000 sqm
Click to see the plot Click to reset the plot
Height:
Width:
By trial and error and enough attempts, we can maximize the area for Farmer Berry. However, it would be a tidious task to try it by hand. There surely must be a simpler way. So let's start thinking. What can we do?
Since this is a Math experience, the first thing coming to mind would be to use the formula of calculating the Area Spanned.
Area Spanned = Width * Height
However, how do you now maximize this now? How are you making sure that you don't use more Fence than you have, but also not too less and waste it? Let's take a look at the live-graph we can produce.
Resize the Area. You will see Datapoints auto-generated. Note the changes you do. You can also reset the Graph
250 m
Width
150 m
Height
37000 sqm
Area
250m
150m
37000 sqm
Record:
Did you notice something? It doesn't make sense to have Fence Length Used less than 400 meters, because then you would "waste" Fence that could be used to increase the Area Spanned. On the other hand, it doesn't make sense to have Fence Length Used more than 400 meters, since we simply don't have more Fence Length.
This is exactly what makes maximizing the expression Area Spanned = Width * Height so difficult. You have one expression, but two variables that are somewhat dependent on each other, so we used some sort of intermediate variable called Fence Length.
However, we cannot just increase Fence Length and assume we have the maximal Area Spanned. Can you resolve this problem? In other words: How can you modify the problem to find the optimal solution by computation? How can you use the information above?
The solution to our problem is simple. Width and Height can be expressed as:
Width + Height = 400 m
To put it in words: You always want to use all the Fence Length you have. This has the side effect that you can now express one variable in term of the other in the optimal solution:
Width = 400 m - Height
Height = 400 m - Width
What you have just done is simplifying a expression that had two variables to an expression that now only has one variable.
Area Spanned = Width * Height -> Area Spanned = Width * ( 400 m - Width )
This is what we call a target function. The expression we wish to minimize is now dependent on only one instead of two variables. This is much easier to maximize right? For that, let's take a look again at the live-graph.
Resize the Area. You will see Datapoints auto-generated. Note the changes you do. You can also reset the Graph
With enough experimenting, you should see a familiar shape, the parabol up side down. This is not surprising. Recall that we concluded that the Area Spanned is defined by Width * ( 400 - Width ). Simplified this means the Area Spanned is function of the Width that is expressed by a negative quadratic function:
Area Spanned = Width * ( 400 m - Width ) = - Width * Width + 400 m * Width
Since this is an introductory problem, we can easily infer that the optimal solution is where the Width is equal the Height. However, assume we have another arbitrary target function that is not that easily solvable. How do find the maximal value for any target function?
Let's get theoretical!
To maximize a target function (for minimizing, everything just works the other way round), you have to first examine the function's behavior towards positive and negative infinity. If the function grows infinitely, you can always find another value that is bigger than the one you thought was the maximal one. This happens a lot if the problem does not have many restrictions. Consider a business selling products among a population of infinite size (a core assumption made in economics for competitive markets). Obviously, you want to maximize profit again. Assuming the business makes a profit of each product, it is obvious that the target function would grow indefinitely since the more products you sell, the more profit you make.
So we use Limits:
lim (target function) for x -> +- infinity != +infinity
So in our case:
lim ( - Width * Width + 400 * Width ) for Width -> +-infinity != infinity
We can easily verify that it is -infinity, so != infinity, as evident in the graph.
Due to time constraints and missing resources, I could not finish this. You would have seen audio implementation, note taking, content wise, you would have been able to change the area and see how the slope and derivate changes, hence you would know how to get local extreme points from the derivative and verifying those.
The genius in you may have known that the perfect solution is not the square but a circle, but that's not the point :)