# Optimization

This section covers:

# Introduction to Optimization

We we’ve seen, there are many useful applications of differential calculus. One that is very useful is to use the derivative of a function (and set it to 0) to find a minimum or maximum to find either the smallest something can be, or the largest it can be. We call this optimization, since we are typically finding the optimal or “best value” for something.

Some examples of optimization include finding the greatest profit, least cost, greatest volume, optimum size, greatest strength, and so on.

## Absolute Extrema

Let’s first revisit absolute extrema, which are the absolute minimum and maximum of a function on an interval. We first learned about Relative and Absolute Minimums and Maximums here in the Advanced Functions section.
In the Curve Sketching section here, we learned that a critical number is where the function’s derivative is 0, or not defined. By the First Derivative Test, critical numbers exist at relative minimums or maximums (also called local minimums or maximums). And of the course the absolute minimums and maximums are the one number that is the smallest or largest, respectively.

Note that we can also take the second derivative of the function to verify that the function is a minimum (“cup up”, or positive 2nd derivative) or maximum (“cup down” or negative 2nd derivative).

With optimization, if we have more than one critical point, we need to check the candidates to see which one is the absolute extrema in the possible domain (values that the “$$x$$” can be). Typically, to get the domain of a problem, we find the $$x$$ values that would “make sense”; for example, we can’t have a dimension of 0 or less.

With optimization, we also need to check the endpoints of an interval, if these make sense in the context of the problem, since these points could also be the minimum or maximum to get the absolute extrema.

When we solve optimization problems, we typically put everything in terms of one variable (the “constraint”), determine what we want the maximize (the “objective”), and then take the derivative, and set to 0 to get the minimum or maximum. And in the case of a closed interval (for example, when we could have a 0 value for an amount), we need to check the endpoints of the interval to make sure they aren’t lower (in the case of a minimum) or higher (in the case of a maximum).

# Optimization Problems

Let’s do some problems; the first have to do with area and volume. Remember to always draw a picture first!

## Area and Volume Optimization Problems

 Calculus Optimization Problem Solution Find the length and width of a rectangle with a perimeter of 160 meters and a maximum area. Make sure our answer ($$x$$) is in in the domain. To get the domain, we’ll assume we want a rectangle with no negative sides. Thus, domain is $$\left( {0,80} \right)$$ $$\displaystyle (80-x>0;\,\,x<80)$$. Let $$x=$$ the length of the rectangle, and $$y$$ be the width. Since we know the perimeter is 160, we have $$2x+2y=160$$. We also know that the area $$A=xy$$.   Since we have to get the maximum area, we have to take the derivative of the area and set to 0. But we’ll need to have only one variable in the area equation to do this. Use the perimeter equation to solve for a variable; let’s get $$y$$ in terms of $$x$$: $$2x+2y=160;\,\,\,2y=160-2x;\,\,\,y=80-x$$   Now substitute, take the derivative of the area (length times width), and set to 0: $$\displaystyle A=xy;\,\,\,A=x\left( {80-x} \right)=80x-{{x}^{2}};\,\,\,\frac{{dA}}{{dx}}=80-2x$$ $$\displaystyle 80-2x=0;\,\,\,\,\,80=2x;\,\,\,\,x=40;\,\,\,\,\,\,y=80-x=40$$ (The second derivative is negative, so we know we have a maximum.)   To get the maximum area, the length should be 40 meters and the width should be 40 meters. It turns out that the largest area of a rectangle is as close to a square as possible. A rectangular page with 25 square inches of print has margins of 1 inch on each side. Find the dimensions of the page so that the least amount of paper is used. Make sure our answer ($$x$$) is in in the domain; we want rectangles, so the domain is $$\left( {0,\infty } \right)$$ (no subtracting). Let’s make $$x=$$ the width of the print and $$y=$$ the height of the print. Since there’s a 1-inch margin on each side, it follows that $$x+2$$ is the width of the piece of paper, and $$y+2$$ is the height of the paper (see picture). We can relate the two variables, $$x$$ and $$y$$, by using the area of the print: $$\displaystyle xy=25;\,\,\,\,y=\frac{{25}}{x}$$ Since we want minimum area (length times width), we have to take the derivative of the area of the whole piece of paper and set to 0: $$\displaystyle A=\left( {x+2} \right)\left( {y+2} \right);\,\,\,A=\left( {x+2} \right)\left( {\frac{{25}}{x}+2} \right)=50{{x}^{{-1}}}+2x+29$$ $$\displaystyle \frac{{dA}}{{dx}}=-50{{x}^{{-2}}}+2;\,\,-50{{x}^{{-2}}}+2=0;\,\,{{x}^{{-2}}}=\frac{1}{{25}};\,\,\,x=\pm 5\,\,\,(\text{use positive)}$$ $$\displaystyle \,\,y=\frac{{25}}{5}=5$$ (The second derivative is positive, so we know we have a minimum.)   To get the minimum area, the width of the print should be 5 inches, and the height should be 5 inches. This means the width and height of the paper should each be 7 inches. A rectangular package with square ends must have a maximum combined length and girth (the perimeter around the rectangle) of 144 inches. Find the dimensions of the box that yields the maximum volume. Make sure our answer ($$x$$) is in the domain; we want a box, so the domain is $$\left( {0,36} \right)$$ $$(144-4x>0;\,\,x<36)$$. Let’s make $$x=$$ the sides of the square end of the box and $$y=$$ the length of the box. Since we know the combined length ($$y$$) and girth ($$4x$$) can be 144 inches, and we are wanting a maximum volume, use 144 for this sum.   Get $$y$$ in terms of $$x$$: $$4x+y=144;\,\,\,\,y=144-4x$$.   Since we the want maximum volume (length times width times height), take the derivative of the volume of the box and set to 0: $$\displaystyle \begin{array}{c}V=x\cdot x\cdot y={{x}^{2}}\left( {144-4x} \right)=144{{x}^{2}}-4{{x}^{3}}\\\frac{{dV}}{{dx}}=288x-12{{x}^{2}};\,\,\,12{{x}^{2}}=288x;\,\,\,x=\pm 24\,\,(\text{use positive)}\\y=144-4\left( {24} \right)\approx 48\end{array}$$ (The second derivative is negative, so we know we have a maximum.)   To get the maximum area, the box should be 24 inches by 24 inches by 48 inches. The owner of a dog park has 120 feet of fencing, and wants to create a rectangular area that is divided into three rectangular pens, as in the picture below.   Find the dimensions of the rectangle that would yield the largest possible total area of the three pens. What is this area? Make sure our answer ($$x$$) is in in the domain; we want rectangles, so the domain is $$\left( {0,30} \right)$$ $$\displaystyle (\frac{{120-4x}}{6}>0;\,\,x<30)$$. As shown in the picture, let $$x=$$ the width of the pen, and $$y=$$ the side of each of the smaller rectangular pens. Thus, the length of the total pen is $$3y$$.   The total amount of fencing needed is $$6y+4x$$, since we’ll have 10 different sides of the fence. Thus, we have $$6y+4x=120$$; let’s get $$y$$ in terms of $$x$$: $$\displaystyle y=\frac{{120-4x}}{6}$$.   The total area is width times the total length, which is $$\displaystyle A\left( x \right)=x\left( {3y} \right)=x\cdot 3\left( {\frac{{120-4x}}{6}} \right)=60x-2{{x}^{2}}$$. Take the derivative to get $${A}’\left( x \right)=60-4x$$, and set to 0 to get $$x=15$$. Then $$\displaystyle y=\frac{{120-4\left( {15} \right)}}{6}=10$$. (The second derivative is negative, so we know we have a maximum.)    The dimensions of the rectangle to get the largest area are a length of $$3y$$ (30 feet) and a width of $$x$$ (15 feet), with an area of 450 feet. Good problem!

## Endpoint Candidates Problem

Here is a difficult optimization problem where we need to use the Pythagorean Theorem. Note that since the domain can actually contain endpoints, we have to check the endpoint candidates to make sure we have the minimum distance we need:

Calculus Optimization Problem Solution
Lucy is in a canoe 6 miles from the nearest coast. She needs to go to a snack bar at point A, which is 8 miles down the coast and 4 miles inland (where she has to walk).

If she can row at 2 mph and walk at 4 mph, toward what point on the coast should she row in order to reach point A in the least amount of time?

(Drawing the picture is almost the most difficult part of the problem!) Let $$x$$ (in miles) be the horizontal distance on the coastline from Lucy’s boat (straight up) to where she should stop rowing and start walking. Do you see how the rest of the distance on the coastline (to where point A is) would then be $$8-x$$? (The total horizontal distance between where the boat is and point A is 8 miles).

We want the least amount of time for Lucy to travel. We have the distances and the rates she’ll travel, so we have to use the $$\text{”Distance}=\text{Rate }\times \,\text{Time”}$$ equation to get time. And to get the slanted distance, we’ll have to use the Pythagorean Theorem.

Since we have to get the minimum time, add distances, take the derivative of the two hypotenuse’s and set to 0:

\displaystyle \begin{align}T&=\frac{{\text{Distanc}{{\text{e}}_{1}}}}{{\text{Rat}{{\text{e}}_{1}}}}+\frac{{\text{Distanc}{{\text{e}}_{2}}}}{{\text{Rat}{{\text{e}}_{2}}}}=\frac{{\sqrt{{36+{{x}^{2}}}}}}{2}+\frac{{\sqrt{{{{{\left( {8-x} \right)}}^{2}}+}}{{4}^{2}}}}{4}\\&=\frac{{\sqrt{{36+{{x}^{2}}}}}}{2}\,+\frac{{\sqrt{{{{x}^{2}}-16x+80}}}}{4}=\frac{1}{2}{{\left( {36+{{x}^{2}}} \right)}^{{\frac{1}{2}}}}+\frac{1}{4}{{\left( {{{x}^{2}}-16x+80} \right)}^{{\frac{1}{2}}}}\\{T}’&=\frac{1}{4}{{\left( {36+{{x}^{2}}} \right)}^{{-\frac{1}{2}}}}\cdot 2x+\frac{1}{8}{{\left( {{{x}^{2}}-16x+80} \right)}^{{-\frac{1}{2}}}}\left( {2x-16} \right)\\0&=\frac{x}{2}{{\left( {36+{{x}^{2}}} \right)}^{{-\frac{1}{2}}}}+\frac{{x-8}}{4}{{\left( {{{x}^{2}}-16x+80} \right)}^{{-\frac{1}{2}}}}\end{align}

This is tough to solve algebraically, so I used the graphing calculator with Y1 = the expression with the $$x$$ and Y2 = 0(see first calculator screen). Use the intersection function (2nd trace 5, enter, enter, enter) to get $$x\approx 2.6$$ miles.

Note you can also put the original function in Y1, and use the nDeriv( function (math 8) to take the derivative of Y1 (using alpha trace enter to get Y1) to put in the Y2 value, with 0 in Y3. Turn off the graph of Y1 (put cursor up to equal sign and hit enter) before getting the intersection (see second calculator screen).

We also see that the derivative (blue) less than the 0 value is negative and greater than is positive, so we know we have a minimum (we could have also created a sign chart, or taken the second derivative).

Since the domain in this problem is $$[0,8]$$ (since it’s possible that the minimum time would be going straight north to the coastline or over 8 miles in the water, and then up), we have to test the endpoints to make sure we have the minimum time. Note that we can use the graphing calculator again to get $$f(x)$$ by using the original $$T$$ function (use 2nd trace 1 to enter values).

 Candidates ($$\boldsymbol {x}$$) $$f(x)$$  ($$\boldsymbol {T}$$) 0 miles 5.2 hours 2.6 miles 4.95 hours 8 miles 6 hours

Thus, the point on the coast where Lucy should row is 2.6 miles from the point straight up from the boat (nearest point on the coastline).

Learn these rules, and practice, practice, practice!

On to Differentials, Linear Approximation and Error Propagation – you are ready!

<
<