# 6.1: Optimization

- Page ID
- 449

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\id}{\mathrm{id}}\)

\( \newcommand{\Span}{\mathrm{span}}\)

\( \newcommand{\kernel}{\mathrm{null}\,}\)

\( \newcommand{\range}{\mathrm{range}\,}\)

\( \newcommand{\RealPart}{\mathrm{Re}}\)

\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

\( \newcommand{\Argument}{\mathrm{Arg}}\)

\( \newcommand{\norm}[1]{\| #1 \|}\)

\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)

\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)

\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vectorC}[1]{\textbf{#1}} \)

\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

Many important applied problems involve finding the best way to accomplish some task. Often this involves finding the maximum or minimum value of some function: the minimum time to make a certain journey, the minimum cost for doing a task, the maximum power that can be generated by a device, and so on. Many of these problems can be solved by finding the appropriate function and then using techniques of calculus to find the maximum or the minimum value required.

Generally such a problem will have the following mathematical form: Find the largest (or smallest) value of \(f(x)\) when \(a\le x\le b\). Sometimes \(a\) or \(b\) are infinite, but frequently the real world imposes some constraint on the values that \(x\) may have.

Such a problem differs in two ways from the local maximum and minimum problems we encountered when graphing functions: We are interested only in the function between \(a\) and \(b\), and we want to know the largest or smallest value that \(f(x)\) takes on, not merely values that are the largest or smallest in a small interval. That is, we seek not a local maximum or minimum but a **global** maximum or minimum, sometimes also called an **absolute** maximum or minimum.

Any global maximum or minimum must of course be a local maximum or minimum. If we find all possible local extrema, then the global maximum, *if it exists*, must be the largest of the local maxima and the global minimum, *if it exists*, must be the smallest of the local minima. We already know where local extrema can occur: only at those points at which \(f'(x)\) is zero or undefined. Actually, there are two additional points at which a maximum or minimum can occur if the endpoints \(a\) and \(b\) are not infinite, namely, at \(a\) and \(b\). We have not previously considered such points because we have not been interested in limiting a function to a small interval. An example should make this clear.

Since \(f'(1)=2\) we would not normally flag \(x=1\) as a point of interest, but it is clear from the graph that *when \(f(x)\) is restricted to \([-2,1]\) there is a local maximum at \(x=1\).* Likewise we would not normally pay attention to \(x=-2\), but since we have truncated \(f\) at \(-2\) we have introduced a new local maximum there as well. In a technical sense nothing new is going on here: When we truncate \(f\) we actually create a new function, let's call it \(g\), that is defined only on the interval \([-2,1]\). If we try to compute the derivative of this new function we actually find that it does not have a derivative at \(-2\) or \(1\). Why? Because to compute the derivative at 1 we must compute the limit $$\lim_{\Delta x\to 0} {g(1+\Delta x)-g(1)\over \Delta x}.$$ This limit does not exist because when \(\Delta x>0\), \(g(1+\Delta x)\) is not defined. It is simpler, however, simply to remember that we must always check the endpoints.

So the function \(g\), that is, \(f\) restricted to \([-2,1]\), has one critical value and two finite endpoints, any of which might be the global maximum or minimum. We could first determine which of these are local maximum or minimum points (or neither); then the largest local maximum must be the global maximum and the smallest local minimum must be the global minimum. It is usually easier, however, to compute the value of \(f\) at every point at which the global maximum or minimum might occur; the largest of these is the global maximum, the smallest is the global minimum.

So we compute \(f(-2)=4\), \(f(0)=0\), \(f(1)=1\). The global maximum is 4 at \(x=-2\) and the global minimum is 0 at \(x=0\).

It is possible that there is no global maximum or minimum. It is difficult, and not particularly useful, to express a complete procedure for determining whether this is the case. Generally, the best approach is to gain enough understanding of the shape of the graph to decide. Fortunately, only a rough idea of the shape is usually needed.

There are some particularly nice cases that are easy. A continuous function on a closed interval \([a,b]\) *always* has both a global maximum and a global minimum, so examining the critical values and the endpoints is enough:

Theorem 6.1.2: Extreme Value Theorem

If \(f\) is continuous on a closed interval \([a,b]\), then it has both a minimum and a maximum point. That is, there are real numbers \(c\) and \(d\) in \([a,b]\) so that for every \(x\) in \([a,b]\), \(f(x)\le f(c)\) and \(f(x)\ge f(d)\).

Another easy case: If a function is continuous and has a single critical value, then if there is a local maximum at the critical value it is a global maximum, and if it is a local minimum it is a global minimum. There may also be a global minimum in the first case, or a global maximum in the second case, but that will generally require more effort to determine.

First note that \(f'(x)= -2 x +4=0\) when \(x=2\), and \(f(2)= 1\). Next observe that \(f'(x)\) is defined for all \(x\), so there are no other critical values. Finally, \(f(0) = -3\) and \(f(4)= -3\). The largest value of \(f(x)\) on the interval \([0,4]\) is \(f(2)=1\)

First note that \(f'(x)= -2 x +4=0\) when \(x=2\). But \(x=2\) is not in the interval, so we don't use it. Thus the only two points to be checked are the endpoints; \(f(-1) = -8\) and \(f(1)= 0\). So the largest value of \(f(x)\) on \([-1,1]\) is \(f(1)=0\).

The derivative \(f'(x)\) is never zero, but \(f'(x)\) is undefined at \(x=2\), so we compute \(f(2)= 7\). Checking the end points we get \(f(1)=8\) and \(f(4)=9\). The smallest of these numbers is \(f(2)=7\), which is, therefore, the minimum value of \(f(x)\) on the interval \(1 \le x \le 4\), and the maximum is \(f(4)=9\).

In example __5.1.2__ we found a local maximum at \((-\sqrt3/3,2\sqrt{3}/9)\) and a local minimum at \((\sqrt3/3,-2\sqrt{3}/9)\). Since the endpoints are not in the interval \((-2,2)\) they cannot be considered. Is the lone local maximum a global maximum? Here we must look more closely at the graph. We know that on the closed interval \( [-\sqrt3/3,\sqrt3/3]\) there is a global maximum at \( x=-\sqrt3/3\) and a global minimum at \( x=\sqrt3/3\). So the question becomes: what happens between \(-2\) and \( -\sqrt3/3\), and between \( \sqrt3/3\) and \(2\)? Since there is a local minimum at \( x=\sqrt3/3\), the graph must continue up to the right, since there are no more critical values. This means no value of \(f\) will be less than \( -2\sqrt{3}/9\) between \( \sqrt3/3\) and \(2\), but it says nothing about whether we might find a value larger than the local maximum \(2\sqrt{3}/9\).

How can we tell? Since the function increases to the right of \( \sqrt3/3\), we need to know what the function values do "close to'' \(2\). Here the easiest test is to pick a number and do a computation to get some idea of what's going on. Since \( f(1.9)=4.959>2\sqrt{3}/9\), there is no global maximum at \( -\sqrt3/3\), and hence no global maximum at all. (How can we tell that \(4.959>2\sqrt{3}/9\)? We can use a calculator to approximate the right hand side; if it is not even close to 4.959 we can take this as decisive. Since \( 2\sqrt{3}/9\approx 0.3849\), there's really no question. Funny things can happen in the rounding done by computers and calculators, however, so we might be a little more careful, especially if the values come out quite close. In this case we can convert the relation \(4.959>2\sqrt{3}/9\) into \((9/2) 4.959>\sqrt{3}\) and ask whether this is true. Since the left side is clearly larger than \(4\cdot 4\) which is clearly larger than \( \sqrt3\), this settles the question.)

A similar analysis shows that there is also no global minimum. The graph of \(f(x)\) on \((-2,2)\) is shown in figure __6.1.2__.

We next find \(f'(x)\) and set it equal to zero: \(0=f'(x)=2-200/x^2\). Solving \(f'(x)=0\) for \(x\) gives us \(x=\pm 10\). We are interested only in \(x>0\), so only the value \(x=10\) is of interest. Since \(f'(x)\) is defined everywhere on the interval \((0,\infty)\), there are no more critical values, and there are no endpoints. Is there a local maximum, minimum, or neither at \(x=10\)? The second derivative is \(f''(x)=400/x^3\), and \(f''(10)>0\), so there is a local minimum. Since there is only one critical value, this is also the global minimum, so the rectangle with smallest perimeter is the \(10\times10\) square.

The first step is to convert the problem into a function maximization problem. Since we want to maximize profit by setting the price per item, we should look for a function \(P(x)\) representing the profit when the price per item is \(x\). Profit is revenue minus costs, and revenue is number of items sold times the price per item, so we get \(P=nx-2000-0.50n\). The number of items sold is itself a function of \(x\), \(n=5000+1000(1.5-x)/0.10\), because \((1.5-x)/0.10\) is the number of multiples of 10 cents that the price is below $1.50. Now we substitute for \(n\) in the profit function: $$ \eqalign{ P(x)&=(5000+1000(1.5-x)/0.10)x-2000- 0.5(5000+1000(1.5-x)/0.10)\cr& =-10000x^2+25000x-12000\cr} $$ We want to know the maximum value of this function when \(x\) is between 0 and \(1.5\). The derivative is \(P'(x)=-20000x+25000\), which is zero when \(x=1.25\). Since \(P''(x)=-20000 < 0\), there must be a local maximum at \(x=1.25\), and since this is the only critical value it must be a global maximum as well. (Alternately, we could compute \(P(0)=-12000\), \(P(1.25)=3625\), and \(P(1.5)=3000\) and note that \(P(1.25)\) is the maximum of these.) Thus the maximum profit is $3625, attained when we set the price at $1.25 and sell 7500 items.

Setting \(0=A'(x)=6x^2+2a\) we get \( x=\sqrt{a/3}\) as the only critical value. Testing this and the two endpoints, we have \(A(0)=A(\sqrt{a})=0\) and \( A(\sqrt{a/3})=(4/9)\sqrt{3}a^{3/2}\). The maximum area thus occurs when the rectangle has dimensions \( 2\sqrt{a/3}\times (2/3)a\).

variables. This is frequently the case, but often the two variables are related in some way so that "really'' there is only one variable. So our next step is to find the relationship and use it to solve for one of the variables in terms of the other, so as to have a function of only one variable to maximize. In this problem, the condition is apparent in the figure: the upper corner of the triangle, whose coordinates are \((h-R,r)\), must be on the circle of radius \(R\). That is, $$ (h-R)^2+r^2=R^2. $$ We can solve for \(h\) in terms of \(r\) or for \(r\) in terms of \(h\). Either involves taking a square root, but we notice that the volume function contains \( r^2\), not \(r\) by itself, so it is easiest to solve for \( r^2\) directly: \(r^2=R^2-(h-R)^2\). Then we substitute the result into \( \pi r^2h/3\): $$ \eqalign{ V(h)&=\pi(R^2-(h-R)^2)h/3\cr& =-{\pi\over3}h^3+{2\over3}\pi h^2R\cr }$$ We want to maximize \(V(h)\) when \(h\) is between 0 and \(2R\). Now we solve \( 0=f'(h)=-\pi h^2+(4/3)\pi h R\), getting \(h=0\) or \(h=4R/3\). We compute \(V(0)=V(2R)=0\) and \(V(4R/3)=(32/81)\pi R^3\). The maximum is the latter; since the volume of the sphere is \((4/3)\pi R^3\), the fraction of the sphere occupied by the cone is $${(32/81)\pi R^3\over (4/3)\pi R^3}={8\over 27}\approx 30%.\]

Finally, since \( h=V/(\pi r^2)\), $$ {h\over r}={V\over\pi r^3}={V\over \pi(V/(2N\pi))}=2N, $$ so the minimum cost occurs when the height \(h\) is \(2N\) times the radius. If, for example, there is no difference in the cost of materials, the height is twice the radius (or the height is equal to the diameter).

So the upshot is this: If you start farther away from \(C\) than \( wb/\sqrt{v^2-w^2}\) then you always want to cut across the sand when you are a distance \(wb/\sqrt{v^2-w^2}\) from point \(C\). If you start closer than this to \(C\), you should cut directly across the sand.

## Summary: Steps to solve an optimization problem

- Decide what the variables are and what the constants are, draw a diagram if appropriate, understand clearly what it is that is to be maximized or minimized.
- Write a formula for the function for which you wish to find the maximum or minimum.
- Express that formula in terms of only one variable, that is, in the form \(f(x)\).
- Set \(f'(x)=0\) and solve. Check all critical values and endpoints to determine the extreme value.