In a great many practical problems, we want to find the least amount of time, the least cost, the greatest benefit, optimum size, etc. In such problems, which are called optimization problems, we look for the maximum or minimum value of a function and the particular value of the variable that gives such a value. In this section, we outline a strategy to systematically attack optimization problems by using differential calculus.

Example 1
Find two nonnegative numbers whose sum is 50 such that their product is as large as possible.
Solution 1
If one of those numbers is $$x$$, the other one is $$50-x$$. Therefore, their product is $x(50-x)$ and because $$x$$ and $$50-x$$ are nonnegative number, we have $$0\leq x\leq50$$ (otherwise $$x$$ or $$50-x$$ will be negative). That is, we want to maximize $f(x)=x(50-x)=50x-x^{2}\tag{*}$ on the interval $$[0,50]$$. Because $$f$$ is a continuous function and the interval is closed, $$f$$ attains its absolute maximum (and its absolute minimum) on this interval, and its extreme values occur either at a critical point or an endpoint. Because $$f$$ is a polynomial and hence is differentiable everywhere, its critical points are only the points at which the derivative vanishes $$f^\prime(x)=0$$. From (*) we obtain $f^\prime(x)=50-2x=0\Leftrightarrow x=25.$ Therefore, the absolute maximum of $$f$$ is one of the following numbers $f(0)=0,\quad f(25)=25(50-25)=625,\quad f(50)=0.$ Thus, the maximum value of $$f$$ is 625 that occurs at $$x=25$$, and hence the two nonnegative numbers are $$x=25$$ and $$50-x=25$$.

The graph of $$f$$ is shown in Figure 1. Figure 1. Graph of $f(x)=x(50-x)$. The maximum of $f$ occurs at $x=25$.
Example 2
Find the dimensions of the rectangle of greatest area such that inscribed in a circle of radius 2.
Solution 2
Inscribe any rectangle, as $$BCDE$$ (Figure 2). Let $x=CD$ then $$DE=\sqrt{4^{2}-x^{2}}$$, and the area of the rectangle is $A(x)=CD\cdot DE=x\sqrt{16-x^{2}}.$

Because $$0\leq x\leq4$$, the problem reduces to maximization of $$A(x)$$ on the interval $$[0,4]$$. $A'(x)=\sqrt{16-x^{2}}+x\frac{-2x}{2\sqrt{16-x^{2}}}.$ Setting $$A'(x)=0$$, we obtain $\sqrt{16-x^{2}}-\frac{x^{2}}{\sqrt{16-x^{2}}}=0$ multiplying both sides by $$\sqrt{16-x^{2}}$$ $16-x^{2}-x^{2}=0$ $\Rightarrow x=\pm\sqrt{8}=\pm2\sqrt{2}.$ Only $$x=2\sqrt{2}$$ is in the interval $$[0,4]$$. Therefore, the absolute maximum of $$A$$ is one of the following numbers $A(0)=0,\quad A(4)=0$ and $A(2\sqrt{2})=\sqrt{8}\sqrt{16-8}=8.$ The above calculations show us that the rectangle of maximum area inscribed in the circle is a square of length $$\sqrt{8}=2\sqrt{2}$$ and of area 8.

The graph of $$A$$ is shown in Figure 3. Figure 3. Graph of $$A(x)=x\sqrt{16-x^{2}}.$$
Example 3
Suppose we have a piece cardboard of dimensions 48 in $$\times$$ 18 in. To carry our stuff, we are planning to make an open box from the cardboard by cutting out small squares of equal size from each corner and folding up the sides (Figure 5). If we want the box to have the largest volume, how long we should make the cut? Solution 3
Let
$$x=$$ length of each side of the square
$$V=$$ volume of the open box
We need to find a relationship between $$V$$ and $$x$$. Because the dimensions of the box are $$48-2x$$, $$18-2x$$, and $$x$$ (Figure 6), the volume of the box is $V=(48-2x)(18-2x)x=4x^{3}-132x^{2}+864x.$

Because the dimensions of the box must be nonnegative, we have $\begin{cases} 0\leq x\\ 0\leq18-2x & \Rightarrow\\ 0\leq48-2x \end{cases}0\leq x\leq9.$ Because $$V$$ is continuous on the interval $$[0,9]$$, its absolute maximum occurs either at an endpoint $$x=0$$, $$x=9$$, or at a critical point. To obtain critical points $\frac{dV}{dx}=12x^{2}-264x+864=0$ $\Rightarrow x^{2}-22x+72=(x-4)(x-18)=0$ $\Rightarrow x=4,\text{ or }x=18.$ However, $$x=18\not\in[0,9]$$. Therefore, the only critical point in the interval $$[0,9]$$ is $$x=4$$, and the absolute maximum of $$V$$ is one of the following numbers.

$$x$$ $$0$$ $$4$$ $$9$$
$$V(x)$$ $$0$$ $$1600$$ $$0$$

Therefore, the maximum volume is obtained when $$x=4$$.

The graph of $$V(x)$$ is shown in Figure 6.

Example 4
What is shortest distance from the point $$(0,2)$$ to the parabola $$8-x^{2}=2y$$?

Solution 4
The distance between the point $$(0,2)$$ and a point $$(x,y)$$ is $d=\sqrt{(x-0)^{2}+(y-2)^{2}.}$ Because $$(x,y)$$ is on the graph of $$x^{2}+8=-4y$$, then $(x,y)=\left(x,-\frac{1}{4}(x^{2}+8)\right)$ and the distance $$d$$ is \begin{aligned} d & =\sqrt{x^{2}+\left(\frac{1}{2}(8-x^{2})-2\right)^{2}}\\ & =\sqrt{x^{2}+\left(2-\frac{1}{2}x^{2}\right)^{2}}.\end{aligned} We notice that the $$x$$ value that minimizes $$d$$, also minimizes the expression inside the radical. So instead of minimizing $$d$$, we minimize $$d^{2}$$ (that is, the expression inside the radical) to avoid differentiation of a square root. Therefore, the function $$f$$ to be minimized is \begin{aligned} f(x) & =x^{2}+(2-\frac{1}{2}x^{2})^{2}\\ & =x^{2}+4-2x^{2}+\frac{1}{4}x^{4}\\ & =\frac{1}{4}x^{4}-x^{2}+4.\end{aligned} Because $$f(x)$$ is defined for all real $$x$$, there is no endpoints of the domain to consider. The derivative of $$f$$ $f^\prime(x)=x^{3}-2x=x(x^{2}-2)$ is zero when $x=0,\pm\sqrt{2}.$ Applying the First Derivative Test

$$x$$ $$-\infty$$ $$-\sqrt{2}$$ $$0$$ $$\sqrt{2}$$ $$+\infty$$
sign of $$x+\sqrt{2}$$ $$—$$ $$0$$ $$+++$$ $$+$$ $$+++$$ $$+$$ $$+++$$
sign of $$x$$ $$—$$ $$-$$ $$—$$ $$0$$ $$+++$$ $$+$$ $$+++$$
sign of $$x-\sqrt{2}$$ $$—$$ $$—$$ $$—$$ $$+$$ $$+++$$
$$\therefore$$sign of $$f^\prime(x)$$ $$—$$ $$0$$ $$+++$$ $$0$$ $$—$$ $$0$$ $$+++$$
Increasing/Decreasing $$f(x)$$ $$\searrow$$ $$\nearrow$$ $$\searrow$$ $$\nearrow$$

reveals that $$x=0$$ yields a local maximum, whereas $$x=\pm\sqrt{2}$$ yield a minimum distance. $\left.d\right|_{x=\pm\sqrt{2}}=\sqrt{2+(2-\frac{1}{2}2)^{2}}=\sqrt{3}.$

Let’s see what will happen if we use the Second Derivative Test instead of the First Derivative Test $f^{\prime\prime}(x)=x^{2}-2$ Because $$f^{\prime\prime}(0)=-2<0$$, $$f$$ has a local maximum at $$x=0$$. Because$$f^{\prime\prime}(\pm\sqrt{2})=0$$, the Second Derivative Test fails, and we cannot determine if $$f$$ has a local maximum, a local minimum or neither at $$x=\pm\sqrt{2}$$.

Therefore, $$f(\pm\sqrt{2})=\sqrt{3}$$ is the shortest distance from the point $$(0,2)$$ to the parabola $$8-x^{2}=2y$$, and the closest points on the parabola to $$(0,2)$$ are $$(\sqrt{2},3)$$ and $$(-\sqrt{2},3)$$.

The graph of $$d=\sqrt{x^{2}+(2-x^{2}/2)^{2}}$$ is shown in Figure 8.

Let’s summarize the strategy that we have applied to solve the examples of this section:

Strategy for Solving Optimization Problems

1. Identify the dependent variable that needs to be maximized or minimized and every variable that plays a role in the problem. Assign appropriate letters to the variables and constants that remind you their actual meaning.
2. Write a primary equation that relates the variable which is to be optimized to the other variables.
3. If the primary equation is a function of more than one independent variable, eliminate the extra variables and reduce the equation to one having a single independent variable. This may involve the use of secondary equations relating the independent variables of the primary equation. The discovery of the secondary equations is often facilitated by drawing a figure or two.
4. Determine the domain of the independent variable. This domain may be smaller than the natural domain of the function because of limitations inherent to the problem.
5. Test the critical points and endpoints of the domain. Use the First Derivative Test or the Second Derivative Test to classify the critical points.

For example, in the last example, the primary equation is $$d=\sqrt{x^{2}+(y-2)^{2}}$$. We need to minimize $$d$$ (or $$d^{2}$$) but $$d$$ is a function of $$x$$ and $$y$$. So we had to eliminate one of them using a secondary equation. Because $$(x,y)$$ is on the parabola, the secondary equation is the equation of parabola relating $$x$$ and $$y$$, which is $$2y=8-x^{2}$$.

Example 5
Find the height and radius of the right circular cylinder of maximum volume that can be inscribed in a right circular cone with radius 18 cm and height 30 cm.

Solution 5
Let
$$r=$$ radius of the cylinder
$$h=$$ height of the cylinder
$$V=$$ volume of the cylinder
We know $V=\pi r^{2}h,\tag{i}$ and we want to maximize $$V$$ provided that the cylinder is inscribed in the cone. Here $$V$$ depends both on $$r$$ and $$h$$ and it is necessary to express $$V$$ in only one variable (either $$r$$ or $$h$$). To do so, we look for a relationship that connects $$r$$ and $$h$$. If we look at the cone from the side, we realize that $$\triangle OAB$$ and $$\triangle O’AB’$$ are similar (Figure 10).

$\overset{\triangle}{OAB}\sim\overset{\triangle}{O’AB’}$ $\Rightarrow\frac{AO’}{AO}=\frac{O’B’}{OB}$ or $\frac{30-h}{30}=\frac{r}{18}$ $\Rightarrow30(18)-18h=30r$ $h=30-\frac{5}{3}r\tag{ii}$ Substituting (ii) into (i), we obtain $V=\pi r^{2}\left(30-\frac{5}{3}r\right)=30\pi r^{2}-\frac{5}{3}\pi r^{3}.$ Now $$V$$ is a function of $$r$$ alone. Because $$r$$ may vary only between 0 and 18 (the radius of the cone) $0\leq r\leq18,$ and $$V$$ is a continuous function, the existence of a maximum value is guaranteed. The maximum value occurs either at $$r=0$$, $$r=18,$$ or at a critical number. \begin{aligned} V'(r) & =60\pi r-5\pi r^{2}\\ & =5\pi r(12-r).\end{aligned} The solutions of $$V'(r)=0$$ are $r=0,\text{ }r=12.$ It suffices to compute $$V(r)$$ at the critical numbers and the endpoints

$$r$$ $$0$$ $$12$$ $$18$$
$$V$$ $$0$$ $$1440\pi$$ $$0$$

So the maximum value of volume occurs when $$r=12$$ and $$h=30-\frac{5}{3}(12)=10$$.

The graph of $$V(r)$$ is shown in Figure 11.

Example 6
The lower corner of a long page whose width is $$a$$, is folded over so as just to reach the inner edge of the page (see the following figure)
(a) Find the width of the part folded over when the length of the crease is a minimum,
(b) Find the width when the area folded over is a minimum.

Solution 6
Let
$$x=$$ length of $$BC$$
$$y=$$ length of $$CE$$
$$L=$$ length of $$BE$$

From $$\triangle BCE$$ $L^{2}=x^{2}+y^{2}.\tag{i }$ We want to minimize $$L$$, but $$L$$ depends on two variables $$x$$ and $$y$$. To eliminate one of the variables, we need a relationship between $$x$$ and $$y$$. From $$\triangle BAD$$, we have $AB^{2}+AD^{2}=BD^{2}$ because before folding the page, $$\triangle BED$$ was $$\triangle BEC$$, we have $$BD=BC$$ and thus $(a-x)^{2}+AD^{2}=x^{2}$ $\Rightarrow AD^{2}=x^{2}-(a-x)^{2}=2ax-a^{2}$ Because $$AD=CD’=2ax-x^{2}$$, from $$\triangle DD’E$$ $DD’^{2}+D’E^{2}=DE^{2}$ and $a^{2}+(y-AD)^{2}=y^{2}$ or $a^{2}+(y-\sqrt{2ax-a^{2}})^{2}=y^{2}$ $\Rightarrow-2y\sqrt{2ax-a^{2}}+2ax=0$ $\Rightarrow y^{2}=\frac{a^{2}x^{2}}{2ax-a^{2}}=\frac{ax^{2}}{2x-a}\tag{ii}$ Substituting (ii) in (i) we obtain $L^{2}=x^{2}+\frac{ax^{2}}{2x-a}.$ Instead of minimizing $$L$$, we can minimize $$L^{2}$$ to avoid differentiation of a radical. Let \begin{aligned} f(x) & =x^{2}+\frac{ax^{2}}{2x-a}\\ & =\frac{2x^{3}-ax^{2}+ax^{2}}{2x-a}\\ & =\frac{2x^{3}}{2x-a}.\end{aligned} The critical number (or critical point) of $$f$$ is obtained by setting $$f^\prime(x)=0$$: $f^\prime(x)=\frac{6x^{2}(2x-a)-4x^{3}}{(2x-a)^{2}}=0$ $\Rightarrow8x^{3}-6ax^{2}=2x^{2}(4x-3a)=0$

$\Rightarrow x=0,x=\frac{3a}{4}.$ Note that $$x$$ must be larger than $$a/2$$, otherwise the expression under the radical $$L=\sqrt{2x^{3}/(2x-a)}$$ becomes negative. Therefore, $$x=0$$ is not acceptable. Because $$(2x-a)^{2}>0$$, the sign of $$f^\prime(x)$$ is the same as the sign of its numerator, and the numerator $$8x^{3}-6ax^{2}=2x^{2}(4x-3a)$$ is negative if $$x<3a/4$$ and is positive if $$x>3a/4$$. Therefore, by the First Derivative Test, $$x=3a/4$$ is a local minimum point ($$f$$ varies from a decreasing function to an increasing one), and $$L$$ for $$x=3a/4$$ is $\left.\sqrt{\frac{2x^{3}}{2x-a}}\right|_{x=\frac{3a}{4}}=\frac{3\sqrt{3}}{4}a\approx1.299a.$ If $$x=a$$, then $L=\sqrt{\frac{2a^{2}}{2a-a}}=\sqrt{2}a\approx1.414a$ and $\lim_{x\to a/2^{+}}L=\lim_{x\to a/2^{+}}\sqrt{\frac{2x^{3}}{2x-a}}\stackrel{\left[\frac{2a^{3}}{0^{+}}\right]}{=}+\infty.$ These calculations show that the absolute minimum of $$L$$ is $$3\sqrt{3}a/4$$.

The graph of $$L/a$$ versus $$x/a$$ is shown in Figure 14. \begin{aligned} \frac{L}{a} & =\frac{1}{a}\sqrt{\frac{2x^{3}}{2x-a}}\\ & =\sqrt{\frac{2x^{3}}{a^{3}(2\frac{x}{a}-1)}}\\ & =\sqrt{\frac{2(x/a)^{3}}{2(x/a)-1}}\end{aligned}

(b) The folded area $$A$$ is $A=xy\tag{iii }$ Substituting (ii) in (iii), we obtain \begin{aligned} A & =x\sqrt{\frac{ax^{2}}{2x-a}}\\ & =\sqrt{\frac{ax^{4}}{2x-a}}.\end{aligned} Again to avoid differentiation of a radical, we can minimize $$A^{2}$$ instead of minimizing $$A$$. So we minimize $g(x)=\frac{ax^{4}}{2x-a}.$ The critical point is obtained by setting $g^\prime(x)=\frac{4ax^{3}(2x-a)-2ax^{4}}{2x-a}=0$

$\Rightarrow2ax^{3}\left[2(2x-a)-x\right]=0$ $\Rightarrow x=0,x=\frac{2a}{3}.$ Again $$x=0$$ is not within the domain of $$A$$ which is the interval $$(a/2,a]$$. When $$x=2a/3$$, the area is $A=\frac{2a}{3}\sqrt{\frac{a\frac{4}{9}a^{2}}{\frac{4a}{3}-a}}=\frac{4a^{2}}{3\sqrt{3}}.$ We can show that $$A\to\infty$$ as $$x\to+\infty$$ or $$x\to a/2^{+}$$. Also $\left.A\right|_{x=a}=a^{2}.$ Therefore, $$A$$ has an absolute minimum when $$x=2a/3$$.

The graph of $$A/a^{2}$$ versus $$x/a$$ is shown in Figure 15.

As shown in the following figure, two corridors, of widths $$a$$ and $$b$$, meet at right angles. What is the maximum length of a ladder which can be horizontally carried around the corner?
From Figure 17, the length of the ladder is \begin{aligned} L & =L_{1}+L_{2}\\ & =\sqrt{x^{2}+b^{2}}+\sqrt{y^{2}+a^{2}}\end{aligned} Here $$L$$ depends on both $$x$$ and $$y$$. To make $$L$$ a function of one variable only, we need a relationship between $$x$$ and $$y$$.
From $$\triangle ABC$$: $\tan\theta=\frac{b}{x}$ and from $$\triangle ADE$$: $\tan\theta=\frac{y}{a}.$ So the relationship between $$x$$ and $$y$$ is $\frac{b}{x}=\frac{y}{a}\Rightarrow y=\frac{ab}{x}.$ Therefore, the length of the ladder can be expressed as \begin{aligned} L & =\sqrt{x^{2}+b^{2}}+\sqrt{\frac{a^{2}b^{2}}{x^{2}}+a^{2}}\\ & =\sqrt{x^{2}+b^{2}}+\sqrt{\frac{a^{2}b^{2}+a^{2}x^{2}}{x^{2}}}\\ & =\sqrt{x^{2}+b^{2}}+\frac{a}{x}\sqrt{b^{2}+x^{2}}\\ & =\sqrt{x^{2}+b^{2}}\left(1+\frac{a}{x}\right).\end{aligned} The critical point of $$L$$ is obtained by setting $$dL/dx=0$$: \begin{aligned} \frac{dL}{dx} & =\frac{2x}{2\sqrt{x^{2}+b^{2}}}\left(1+\frac{a}{x}\right)-\frac{a}{x^{2}}\sqrt{x^{2}+b^{2}}\\ & =\frac{1}{\sqrt{x^{2}+b^{2}}}\left[x+a-\frac{a}{x^{2}}(x^{2}+b^{2})\right]\end{aligned} $\frac{dL}{dx}=0\Rightarrow x-\frac{ab^{2}}{x^{2}}=0\Rightarrow x=\sqrt{ab^{2}}.$ and the minimum length $$L$$ is \begin{aligned} \left.\sqrt{x^{2}+b^{2}}\left(1+\frac{a}{x}\right)\right|_{x=\sqrt{ab^{2}}} & =\sqrt{a^{2/3}b^{4/3}+b^{2}}\left(1+\frac{a^{2/3}}{b^{2/3}}\right)\\ & =\sqrt{\frac{a^{2/3}b^{4/3}+b^{2}}{b^{4/3}}}\left(b^{2/3}+a^{2/3}\right)\\ & =(a^{2/3}+b^{2/3})^{3/2}.\end{aligned} Obviously as $$x\to0$$ or $$x\to+\infty$$, $$L\to+\infty$$, and the local minimum of $$L$$ is also its absolute minimum.