# Solving Optimization Problems

One type of problem that calculus gives us the ability to solve is optimization problems. You may recognize that the word “optimization” is similar to the word “optimal.” This is because optimization problems are typically about finding the measurements or circumstances that ensure the best, or most efficient, outcome in a given situation.

Suppose a rancher wants to enclose a field on his property for livestock, and he has materials to build 400 meters of fencing. What should the enclosed field’s length and width be in order to maximize the area of the field?

This is an example of an optimization problem. The keyword here is “maximize,” since optimization problems usually ask for either a maximum or minimum value. For this problem, we need to know the ideal dimensions of the field; that is, the length and width that yield the greatest area for the 400 meters of fencing allotted for the perimeter.

Let’s take a look at some dimension samples and their areas to get a feel for how the length and width relate to change in area. One way the rancher could build the fence is with the width of 50 meters and a length of 150 meters. This would use up all 400 meters of fencing.

With this setup, the rancher’s field would have an area of $$50\times 150=7,500$$ square meters.

However, if the rancher chooses to increase the width to 60 meters and therefore decrease the length to 140 meters, the area of the field would then be 8,400 square meters, which is a sizeable improvement!

If we keep increasing the width and decreasing the length, we will continue to see the increases in area… up to a point. Eventually, a maximum area will be reached and then the area will begin to decrease. For example, if we increase the length all the way up to 199 meters, and decrease the width accordingly to just 1 meter, the area of the field will only be $$1\times 199=199$$ square meters.

As we can see, the area of the field very much depends on its dimensions, and there should be a “sweet spot,” a set of dimensions which maximizes the area of the field. How can we determine exactly what those optimal dimensions are though?

The good news is, you won’t need to use trial and error for these problems.

Before we solve this field problem, we need to talk about critical points. Consider this shape.

You may recognize this shape as a parabola, but I specifically want you to notice that this shape has a maximum point, right here. We can see pretty clearly that this is the highest point on the shape, but it also has a special characteristic which makes it what we call a critical point.

What is the slope of the tangent line at this exact point? Since the line is changing directions from upward to downward, the slope at this exact point is zero, and the tangent line is flat.

This would also be true of a minimum point on a curve. At an arc’s lowest point, the line will switch directions from downward to upward and the tangent line will have slope equal to zero. Points where a function’s derivative are equal to 0 are called critical points.

Critical points also exist where a function’s derivative does not exist, such as points where there are breaks in continuity or when a function has “sharp” turns.

Because of this, we can find minimum and maximum values of a function within particular domains by searching for points where the derivative of the function equals zero or does not exist. For example, the function $$f(x)=-x^{2}+4x$$ is a downward-opening parabola. We can find the maximum of the function by taking the derivative of $$f$$ and solving for the point $$x$$ which makes it go to zero or not exist. Let’s start by taking the derivative of $$f$$.

$$f'(x)=-2x+4$$,

Since there is no point that would make this undefined, we set $$f’$$ to zero and solve for $$x$$.

$$0=-2x+4$$

$$-4=-2x$$

$$2=x$$

So the maximum for $$f(x)$$ occurs at $$x=2$$, and we can plug in $$f(2)$$ to see what the height there is equal to:

$$f(2)=-(2)^{2}+4(2)=-4+8=4$$

So this function has a critical point at $$(2,4)$$.

Let’s return to the example of the rancher now. We know that he needs to use all 400 meters of fencing materials, so the perimeter of the enclosed field must be $$2l+2w=400$$, where l and w represent length and width respectively. Area of a rectangle is of course equal to length times width, but in order to find a critical point, we need to write a function for area in terms of only one variable. Let’s use $$l$$ as that variable, and we’ll solve for $$w$$ in terms of $$l$$ to make the area function.

$$2l+2w=400$$

$$2w=400-2l$$

$$w=200-l$$

So area in terms of $$l$$ equals length times width, or equivalently for the rancher:

$$A(l)=l\cdot (200-l)$$.

Simplifying, this equals $$200l-l^{2}$$.

Remember, in order to find the dimensions that maximize the field’s area, we need to locate a critical point of this function. Let’s take the derivative of $$A$$ now.

$$A'(l)=200-2l$$

We can see that there is no way for $$A$$‘ to be undefined since there’s no possibility of dividing by zero or having a negative radicand or log argument. Let’s then solve for where $$A$$‘ equals zero.

$$0=200-2l$$

$$-200=-2l$$

$$100=l$$

There is a critical point when length of the field is equal to 100 meters, which indicates that the area of the field is maximized when the length equals 100 meters, and consequently when the width equals 100 meters as well. The area of the field with these dimensions is 10,000 square meters.

Let’s work through another example. Find any critical points for the function $$h(x)=\frac{x^{3}}{3}-2x^{2}-12x+40$$ and then determine where the maximum of the function is within the domain $$0\leq x\leq 10$$.

To locate critical points, we first need to take the derivative of $$h$$.

$$h'(x)=x^{2}-4x-12$$

This function won’t have any points which cause it not to exist, so let’s set it equal to zero and then solve for $$x$$.

$$0=x^{2}-4x-12$$

$$0=x-6x+2$$

 $$x-6=0$$ $$x+2=0$$ $$x=6$$ $$x=-2$$

Since $$–2$$ is outside the domain we are concerned with, we can disregard it. So we are left with a critical point at $$x=6$$. The second part of this problem is finding the maximum point of $$h(x)$$ within the domain $$0\leq x\leq 10$$. Since we have our critical point at $$x=6$$, it is very tempting to say that the maximum is there. However, if we check the graph of $$h$$, we can see that this isn’t exactly the case.

In fact, $$x=6$$ gives us the minimum point of this function! In order to find the maximum, we need to check the endpoints of the domain and compare their heights to that of the critical point. Let’s check $$h(0)$$ and $$h(10)$$ now.

$$h(x)=\frac{x^{3}}{3}-2x^{2}-12x+40$$

$$h(0)=\frac{0^{3}}{3}-2(0^{2})-12(0)+40=40$$

$$h(6)=\frac{6^{3}}{3}-2(6^{2})-12(6)+40=-32$$

$$h(10)=\frac{10^{3}}{3}-2(10^{2})-12(10)+40=53.333$$

Now, we can see that the maximum point of the function $$h(x)$$ on the domain $$0\leq x\leq 10$$ is at the point 10, 53.333, and not at the critical point $$x=6$$. For this reason, any time you have an upper and lower limit for $$x$$ in an optimization problem, make sure to check those values against the critical point to find the true maximum or minimum.

Let’s do one more example. Lisa is working on a geometry project and is making shapes from pliable metal wire. She has 8 feet of wire that she wants to cut into two separate pieces. With one piece she will make a circle, and with the other she will make a square. In order to maximize the total area of the circle and square, how long should the piece of wire for the square be? Or will Lisa have the greatest area by dedicating her wire to only one of the two shapes?

Since we are trying to maximize area, we need to come up with a formula for area. This formula needs to be written in terms of only one variable so that we can take its derivative and find a critical point. Let’s choose the variable to be the letter $$x$$, representing the length of the wire used for the square. We know that the area must include the circle’s area as well as the square’s, so $$A(x)$$ will look something like this:

$$A(x)=\text{circle’s area}+\text{square’s area}$$

The area of a square is equal to its side length squared, and the side length of Lisa’s square will equal one-fourth of $$x$$. So the square’s area will equal $$(\frac{1}{4}x)^{2}$$, or $$\frac{1}{16}x^{2}$$.

$$A(x)=circle’s area+\frac{1}{16}x^{2}$$

To get the area of the circle, we need to realize that the length of leftover wire from the square will equal $$8-x$$ feet. This will make up the circumference of Lisa’s circle. The circumference of a circle equals $$2\pi r$$, and the area of a circle equals $$\pi r^{2}$$. Let’s get the value of the radius $$r$$ by dividing $$8-x$$ by $$2\pi$$.

$$r=\frac{8-x}{2\pi }$$

Then, we can square this and multiply by $$π$$ to get the circle’s area.

$$circle’s area=\frac{(8-x)^{2}}{4\pi }$$

Now, we have the formulas for the circle’s area and the square’s area individually. Let’s write them together to get $$A(x)$$.

$$A(x)=π(\frac{8-x}{2π})^{2}+\frac{1}{16}x^{2}$$

We can simplify this a little bit.

$$A(x)=\frac{(8-x)^{2}}{4\pi }+\frac{1}{16}x^{2}$$

Before taking the derivative, let’s FOIL out the numerator of the first term.

$$A(x)=\frac{64-16x+x^{2}}{4\pi }+\frac{x^{2}}{16}$$

To find the derivative of the first term, we could use the quotient rule. However, since the bottom is simply a constant, we can just factor it out and take the derivative of the top:

$$A'(x)=\frac{1}{4\pi }(-16+2x)+$$…

Then the derivative of the second term is simply $$\frac{1}{8}x$$.

$$A'(x)=\frac{1}{4\pi } (-16+2x)+\frac{x}{8}$$

This derivative doesn’t have the potential of dividing by 0, having negative radicands, or negative log arguments, so we won’t find anywhere that it does not exist. Let’s instead solve for where it equals 0.

$$0=\frac{1}{4\pi }(-16+2x)+\frac{x}{8}$$

$$0=-\frac{4}{\pi }+\frac{x}{2\pi }+\frac{x}{8}$$

$$\frac{4}{\pi}=\frac{x}{2\pi }+\frac{x}{8}$$

$$\frac{4}{\pi}=\frac{4x}{8π}+\frac{πx}{8π}$$

$$\frac{4}{π}=\frac{4x+πx}{8π}$$

$$32=4x+πx$$

$$32=x(4+π)$$

$$\frac{32}{4+π}=x$$

$$x\approx 4.5$$

So $$x=\frac{32}{4+\pi }\approx 4.5$$ is a critical point on the area function. This indicates that Lisa would cut roughly 4.5 feet for the square shape, leaving around 3.5 feet for the circle shape. Remember, even though we have found this critical point, we also must consider the endpoints of the domain. In this case, we should check what the area would be if Lisa used 0 feet of wire for the square (using all 8 feet instead for the circle), and what the area would be if she used all 8 feet for the square and 0 for the circle.

The total area if Lisa uses all the wire for the circle will equal:

$$A(0)=\frac{(8-0)^{2}}{4\pi }+\frac{1}{16}(0)^{2}=\frac{16}{\pi }\approx 5.093\text{ }square feet$$

The total area if Lisa uses all the wire for the square will equal:

$$A(8)=\frac{(8-8)^{2}}{4\pi }+\frac{1}{16}(8)^{2}=4\text{ }square feet$$

If Lisa cuts the wire at the critical point and dedicates around 4.5 feet to the square, she will have a total area of:

$$A(\frac{32}{4+\pi })=\frac{(8-\frac{32}{4+\pi })^{2}}{4\pi }+\frac{1}{16}(\frac{32}{4+\pi })^{2}\approx 2.24\text{ }square feet$$

It seems that Lisa will have the greatest area if she dedicates all 8 feet of wire to the circle!

Whenever you see the words “maximize” or “minimize” in a calculus problem, these are signals that indicate an optimization problem is at hand. The first step in solving these is writing a formula for what is being optimized (which is usually area, volume, cost, or profits) in terms of only one variable. Then, take the derivative, look for critical points, and test these against the endpoints of the domain to find the true maximum or minimum.

This may seem like a daunting process at first, but with some practice you’ll have the hang of it.

Thanks for watching, and happy studying!