Skip to main content
Mathematics LibreTexts

4.1: Optimization

  • Page ID
  • \( \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}}\)

    Many physical problems involve optimization: finding either a maximum or minimum value of some quantity. Optimization problems often have a constraint involving two variables which allows you to rewrite the objective function—the function to optimize—as a function of a single variable: use the constraint to solve for one variable in terms of another, then substitute that expression into the objective function.

    First, the intuitive notions of maximum and minimum need clarifying.

    In other words, a global maximum is the largest value everywhere (“globally”), whereas a local maximum is only the largest value “locally.” Likewise for a global vs local minimum. The picture below illustrates the differences.

    In the picture, on the interval \(\ival{a}{b}\) the function \(f\) has a global minimum at \(x=a\), a global maximum at \(x=c_1\), a local minimum at \(x=c_2\), and a local maximum at \(x=b\). Every global maximum [minimum] is a local maximum [minimum], but not vice versa. In physical applications global maxima or minima1 are the primary interest. The Extreme Value Theorem in Section 3.3 guarantees the existence of at least one global maximum and at least one global minimum for continuous functions defined on closed intervals (i.e. intervals of the form \(\ival{a}{b}\)). All the functions under consideration here will be differentiable, and hence continuous. So the only issues will be how to find the global maxima or minima, and how to handle intervals that are not closed.

    Consider again the picture from the previous page, this time looking at how the derivative \(f'\) changes over \(\ival{a}{b}\). Intuitively it is obvious that near an internal maximum (i.e. in the open interval \((a,b)\)) such as at \(x=c_1\), the function should increase before that point and then decrease after that point. That means that \(f'(x)>0\) before \(x=c_1\) and \(f'(x)<0\) after the “turning point” \(x=c_1\), as shown below.

    Assuming that \(f'\) is continuous (which will be the case for all the functions in this section), then this means that \(f'=0\) at \(x=c_1\), that is, \(f'(c_1)=0\). Similarly, near the internal minimum at \(x=c_2\), \(f'(x)<0\) before \(x=c_2\) and \(f'(x)>0\) after \(x=c_2\), so that \(f'(c_2)=0\). Points at which the derivative is zero are called critical points (or stationary points) of the function. So \(x=c_1\) and \(x=c_2\) are critical points of \(f\).

    Note in the picture that \(f'\) goes from positive to zero to negative around \(x=c_1\), so that \(f'\) is decreasing around \(x=c_1\), i.e. \(f''=(f')'<0\). Similarly, \(f'\) is increasing around \(x=c_2\), i.e. \(f''>0\). This leads to the following test for local maxima and minima:2

    To see why the test fails when \(f''(c)=0\), consider \(f(x)=x^3\): \(f'(0)=0\) and \(f''(0)=0\), yet \(x=0\) is neither a local minimum nor maximum in any open interval containing \(x=0\). Section 4.2 will present an alternative for when the Second Derivative Test fails. There is a simple visual mnemonic device for remembering the Second Derivative Test, due to a generic minimum or maximum resembling a smile or frown, respectively:

    The “eyes” in the faces represent the sign of \(f''\) at a critical point, while the “mouths” indicate the nature of that point (when \(f''=0\) nothing is known). The procedure for finding a global maximum or minimum can now be stated:

    In each case of the above procedure try to use the Second Derivative Test to verify that a critical point is a local minimum or maximum, unless it is obvious from the nature of the problem that there can be only a minimum or only a maximum.

    Example \(\PageIndex{1}\): minmax1

    Show that the rectangle with the largest area for a fixed perimeter is a square.


    Let \(L\) be the perimeter of a rectangle with sides \(x\) and \(y\). The idea is that \(L\) is a fixed constant, but \(x\) and \(y\) can vary. Figure [fig:minmax1] shows that there are many possible shapes for the rectangle, but in all cases \(L = 2x + 2y\). Let \(A\) be the area of such a rectangle. Then \(A = xy\), which is a function of two variables. But

    \[L ~=~ 2x ~+~ 2y \quad\Rightarrow\quad y ~=~ \frac{L}{2} ~-~ x ~, \nonumber \]

    and hence

    \[A ~=~ x\,\left(\frac{L}{2} ~-~ x\right) ~=~ \frac{Lx}{2} ~-~ x^2 \nonumber \]

    is now a function of \(x\) alone, on the open interval \((0,L/2)\) (since the length \(x\) is positive). Now find the critical points of \(A\):

    \[\begin{aligned} A'(x) ~=~ 0 \quad&\Rightarrow\quad \frac{L}{2} ~-~ 2x ~=~ 0\\ &\Rightarrow\quad x ~=~ \frac{L}{4} ~~\text{is the only critical point}\end{aligned} \nonumber \]

    This problem is thus the case of a function defined on an open interval having only one critical point. Use the Second Derivative Test to verify that the sole critical point \(x=L/4\) is a local maximum for \(A\):

    \[A''(x) ~=~ -2 \quad\Rightarrow\quad A''(L/4) ~=~ -2 ~<~ 0 \quad\Rightarrow\quad\text{$A$ has a local maximum at $x = L/4$} \nonumber \]

    Thus, \(A\) has a global maximum at \(x=L/4\). Also, \(y = L/2 - x = L/2 - L/4 = L/4\), which means that \(x = y\), i.e. the rectangle is a square.
    Note: The constraint in this example was \(L=2x+2y\) and the objective function was \(A=xy\).

    Example \(\PageIndex{2}\): minmax2

    Suppose a right circular cylindrical can with top and bottom lids will be assembled to have a fixed volume. Find the radius and height of the can that minimizes the total surface area of the can.


    Solution: Let \(V\) be the fixed volume of the can with radius \(r\) and height \(h\), as in Figure [fig:minmax2]. The volume \(V\) is a constant, with \(V = \pi r^2h\). Let \(S\) be the total surface area of the can, including the lids. Then

    \[S ~=~ 2\pi r^2 ~+~ 2\pi rh \nonumber \]

    where the first term in the sum on the right side of the equation is the combined area of the two circular lids and the second term is the lateral surface area of the can. So \(S\) is a function of \(r\) and \(h\), but \(h\) can be eliminated since

    \[V ~=~ \pi r^2h \quad\Rightarrow\quad h ~=~ \frac{V}{\pi r^2} \nonumber \]

    and so

    \[S ~=~ 2\pi r^2 ~+~ 2\pi r \cdot \frac{V}{\pi r^2} ~=~ 2\pi r^2 ~+~ \frac{2V}{r} \nonumber \]

    making \(S\) a function of \(r\) alone. Now find the critical points of \(S\) (i.e. solve \(S'(r)=0\)):

    \[\begin{aligned} S'(r) ~=~ 0 \quad&\Rightarrow\quad 4\pi r ~-~ \frac{2V}{r^2} ~=~ 0\\ &\Rightarrow\quad r^3 ~=~ \frac{V}{2\pi}\\ &\Rightarrow\quad r ~=~ \sqrt[3]{\frac{V}{2\pi}} ~~\text{is the only critical point}\end{aligned} \nonumber \]

    Since both \(r\) and \(h\) are lengths and have to be positive, then \(0 < r < \infty\). So this is another case of a function defined on an open interval having only one critical point. Use the Second Derivative Test to verify that this critical point \(r=\sqrt[3]{\frac{V}{2\pi}}\) is a local minimum for \(S\):

    \[S''(r) ~=~ 4\pi ~+~ \frac{4V}{r^3} \quad\Rightarrow\quad S''\left(\sqrt[3]{\frac{V}{2\pi}}\right) ~=~ 4\pi ~+~ \frac{4V}{\frac{V}{2\pi}} ~=~ 12\pi ~>~ 0 \quad\Rightarrow\quad\text{$S$ has a local minimum at $r = \sqrt[3]{\frac{V}{2\pi}}$} \nonumber \]

    Thus, \(S\) has a global minimum at \(r = \sqrt[3]{\frac{V}{2\pi}}\), and

    \[r \cdot r^2 ~=~ r^3 ~=~ \frac{V}{2\pi} \quad\Rightarrow\quad 2r ~=~ \frac{V}{\pi r^2} ~=~ h ~. \nonumber \]

    Hence, \(r = \sqrt[3]{\frac{V}{2\pi}}\) and \(h = 2\,\sqrt[3]{\frac{V}{2\pi}}\) will minimize the total surface area, i.e. the height should equal the diameter.

    Note that this result can be applied to soda cans, where the volume is \(V = 12\) fluid ounces \(~\approx~ 21.6\) cubic inches: both a diameter and height of about \(3.8\) inches will minimize the amount (and hence the cost) of the aluminum used for the can. Yet soda cans are not that wide and short—they are usually thinner and taller. So why is a non-optimal size used in practice? Other factors—e.g. packing requirements, the need for small children to hold the can in one hand—might override the desire to minimize the cost of the aluminum. The lesson is that an optimal solution for one factor (material cost) might not always be truly optimal when all factors are considered; compromise is often necessary.

    Example \(\PageIndex{1}\): minmax3

    Suppose that a projectile is launched from the ground with a fixed initial velocity \(v_0\) at an angle \(\theta\) with the ground. What value of \(\theta\) would maximize the horizontal distance traveled by the projectile, assuming the ground is flat and not sloped (i.e. horizontal)?


    Let \(x\) and \(y\) represent the horizontal position and vertical position, respectively, of the projectile at time \(t \ge 0\). From the triangle at the bottom of Figure [fig:minmax3], the horizontal and vertical components of the initial velocity are \(v_0 \cos\,\theta\) and \(v_0 \sin\,\theta\), respectively. Since distance is the product of velocity and time, then the horizontal and vertical distances traveled by the projectile by time \(t\) due to the initial velocity are \((v_0 \cos\,\theta)t\) and \((v_0 \sin\,\theta)t\), respectively. Ignoring wind and air resistance, the only other force on the projectile will be the downward force \(g\) due to gravity, so that the equations of motion for the projectile are:

    \[\begin{aligned} x ~&=~ (v_0 \cos\,\theta)t\\ y ~&=~ -\frac{1}{2}gt^2 ~+~ (v_0 \sin\,\theta)t\end{aligned} \nonumber \]

    The goal is to find \(\theta\) that maximizes the length \(L\) shown in Figure [fig:minmax3]. First write \(y\) as a function of \(x\):

    \[\begin{aligned} x ~=~ (v_0 \cos\,\theta)t \quad&\Rightarrow\quad t ~=~ \frac{x}{v_0 \cos\,\theta} \quad\Rightarrow\quad y ~=~ -\frac{1}{2}g\left(\frac{x}{v_0 \cos\,\theta}\right)^2 ~+~ (v_0 \sin\,\theta) \cdot \frac{x}{v_0 \cos\,\theta}\

    \[6pt] &\Rightarrow\quad y ~=~ -\frac{gx^2}{2v_0^2 \cos^2\,\theta} ~+~ x\tan\,\theta\end{aligned} \nonumber \]

    Then \(L\) is the value of \(x>0\) that makes \(y=0\):

    \[0 ~=~ -\frac{gL^2}{2v_0^2 \cos^2\,\theta} ~+~ L\tan\,\theta \quad\Rightarrow\quad L ~=~ \frac{2v_0^2 \sin\,\theta\;\cos\,\theta}{g} ~=~ \frac{v_0^2 \sin\,2\theta}{g} \nonumber \]

    So \(L\) is now a function of \(\theta\), with \(0 < \theta < \pi/2\) (why?). So if there is a single local maximum then it must be the global maximum. Now get the critical points of \(L\):

    \[\begin{aligned} L'(\theta) ~=~ 0 \quad&\Rightarrow\quad \frac{2v_0^2 \cos\,2\theta}{g} ~=~ 0\

    \[4pt] &\Rightarrow\quad \cos\,2\theta ~=~ 0\

    \[3pt] &\Rightarrow\quad 2\theta ~=~ \frac{\pi}{2} \quad\Rightarrow\quad \theta ~=~ \frac{\pi}{4} ~~\text{is the only critical point}\end{aligned} \nonumber \]

    Use the Second Derivative Test to verify that \(L\) has a local maximum at \(\theta = \pi/4\):

    \[\begin{aligned} L''(\theta) ~=~ -\frac{4v_0^2 \sin\,2\theta}{g} \quad&\Rightarrow\quad L''(\pi/4) ~=~ -\frac{4v_0^2}{g} ~<~ 0\

    \[4pt] &\Rightarrow\quad \text{$L$ has a local maximum at $\theta = \frac{\pi}{4}$}\end{aligned} \nonumber \]

    Thus, \(L\) has a global maximum at \(\theta = \frac{\pi}{4}\), i.e. the projectile travels the farthest horizontally when launched at a \(45\Degrees\) angle with the ground (with \(L\left(\frac{\pi}{4}\right) = \frac{v_0^2}{g}\) being the maximum horizontal distance).

    Note that once the formula for \(L\) as a function of \(\theta\) was found to be \(L = \frac{v_0^2 \sin\,2\theta}{g}\), calculus was not actually needed to solve this problem. Why? Since \(v_0^2\) and \(g\) are positive constants (recall \(g = 9.8 \text{m/s}^2\)), \(L\) would have its largest value when \(\sin\,2\theta\) has its largest value \(1\), which occurs when \(\theta = \pi/4\).

    Example \(\PageIndex{1}\): minmax4

    Fermat’s Principle states that light always travels along the path that takes the least amount of time. So suppose that a ray of light is shone from a point \(A\) onto a flat horizontal reflective surface at an angle \(\theta_1\) with the surface and then reflects off the surface at an angle \(\theta_2\) to a point \(B\). Show that Fermat’s Principle implies that \(\theta_1 = \theta_2\).


    Let \(L\) be the horizontal distance between \(A\) and \(B\), let \(d_1\) be the distance the light travels from \(A\) to the point of contact \(C\) with the surface a horizontal distance \(x\) from \(A\), let \(d_2\) be the distance from \(C\) to \(B\), and let \(y_1\) and \(y_2\) be the vertical distances from \(A\) and \(B\), respectively, to the surface, as in the picture below.

    Since time is distance divided by speed, and since the speed of light is constant, then minimizing the total time elapsed is equivalent to minimizing the total distance traveled, namely \(D = d_1 + d_2\). The basic idea here is that Fermat’s Principle implies that for the light to go from \(A\) to \(B\) in the shortest time, the unknown point \(C\)—and hence the unknown distance \(x\)—will have to be at a point that makes \(\theta_1 = \theta_2\). The distances \(L\), \(y_1\) and \(y_2\) are constants, so the goal is to write the total distance \(D\) as a function of \(x\), find the \(x\) that minimizes \(D\), then show that that value of \(x\) makes \(\theta_1 = \theta_2\).

    First, note that \(C\) has to be between \(A\) and \(B\) as in the picture, otherwise the total distance \(D\) would be larger than if \(C\) were directly below either \(A\) or \(B\). This ensures that \(\theta_1\) and \(\theta_2\) are between \(0\) and \(\pi/2\), and that \(0 \le x \le L\).

    Next, by the Pythagorean Theorem and the above picture,

    \[d_1 ~=~ \sqrt{x^2 + y_1^2} \quad\text{and}\quad d_2 ~=~ \sqrt{(L-x)^2 + y_2^2} \nonumber \]

    and so the total distance \(D = d_1 + d_2\) traveled by the light is a function of \(x\):

    \[D(x) ~=~ \sqrt{x^2 + y_1^2} ~+~ \sqrt{(L-x)^2 + y_2^2} \nonumber \]

    To find the critical points of \(D\), solve the equation \(D'(x)=0\):

    \[D'(x) ~=~ \frac{x}{\sqrt{x^2 + y_1^2}} ~-~ \frac{L-x}{\sqrt{(L-x)^2 + y_2^2}} ~=~ 0 \quad\Rightarrow\quad \frac{x}{d_1} ~=~ \frac{L-x}{d_2} \quad\Rightarrow\quad \sin\,\theta_1 ~=~ \sin\,\theta_2 \quad\Rightarrow\quad \theta_1 ~=~ \theta_2 \nonumber \]

    since the sine function is one-to-one over the interval \(\ival{0}{\frac{\pi}{2}}\).

    This seems to prove the result, except for one remaining issue to resolve: verifying that the minimum for \(D\) really does occur at the \(x\) between \(0\) and \(L\) where \(D'(x)=0\), not at the endpoints \(x=0\) or \(x=L\) of the closed interval \(\ival{0}{L}\). Note that using the Second Derivative Test in this case does not matter, since you would have to check the value of \(D\) at the endpoints anyway and compare those values to the values of \(D\) at the critical points. To find expressions for the critical points, note that

    \[\begin{aligned} D'(x) ~=~ 0 \quad&\Rightarrow\quad \frac{x}{\sqrt{x^2 + y_1^2}} ~=~ \frac{L-x}{\sqrt{(L-x)^2 + y_2^2}} \quad\Rightarrow\quad \frac{x^2}{x^2 + y_1^2} ~=~ \frac{(L-x)^2}{(L-x)^2 + y_2^2}\

    \[6pt] &\Rightarrow\quad \cancel{(L-x)^2 x^2} ~+~ x^2 y_2^2 ~=~ \cancel{(L-x)^2 x^2} ~+~ (L-x)^2 y_1^2\

    \[4pt] &\Rightarrow\quad xy_2 ~=~ (L-x)y_1 \quad\Rightarrow\quad x ~=~ \frac{Ly_1}{y_1 + y_2} \quad\text{is the only critical point,}\end{aligned} \nonumber \]

    and \(x\) is between \(0\) and \(L\). Now compare the values of \(D^2(x)\) at \(x=0\), \(x=L\), and \(x=\frac{Ly_1}{y_1 + y_2}\):

    \[\begin{aligned} D^2(0) ~&=~ L^2 ~+~ y_1^2 ~+~ y_2^2 ~+~ 2y_1\sqrt{L^2 + y_2^2}\\ D^2(L) ~&=~ L^2 ~+~ y_1^2 ~+~ y_2^2 ~+~ 2y_2\sqrt{L^2 + y_1^2}\\ D^2\left(\tfrac{Ly_1}{y_1 + y_2}\right) ~&=~ L^2 ~+~ y_1^2 ~+~ y_2^2 ~+~ 2y_1y_2\end{aligned} \nonumber \]

    Since \(y_2 < \sqrt{L^2 + y_2^2}\) and \(y_1 < \sqrt{L^2 + y_1^2}\), then \(D^2\left(\tfrac{Ly_1}{y_1 + y_2}\right)\) is the smallest of the three values above, so that \(D^2(x)\) has its minimum value at \(x=\frac{Ly_1}{y_1 + y_2}\), which means \(D(x)\) has its minimum value there.\(\quad\checkmark\)

    Example \(\PageIndex{1}\): minmax5

    A man is in a boat \(4\) miles off a straight coast. He wants to reach a point \(10\) miles down the coast in the minimum possible time. If he can row \(4\) mi/hr and run \(5\) mi/hr, where should he land the boat?


    Let \(T\) be the total time traveled. The goal is to minimize \(T\). From the picture on the right, since time is distance divided by speed, break the total time into two parts: the time rowing in the water and the time running on the coast, so that

    \[T ~=~ \text{time}_{\text{row}} ~+~ \text{time}_{\text{run}} ~=~ \dfrac{\text{dist}_{\text{row}}}{\text{speed}_{\text{row}}} ~+~ \dfrac{\text{dist}_{\text{run}}}{\text{speed}_{\text{run}}} ~=~ \dfrac{\sqrt{x^2 + 16}}{4} ~+~ \dfrac{10-x}{5} ~, \nonumber \]

    where \(0 \le x \le 10\) is the distance along the coast where the boat lands. Then

    \[T'(x) ~=~ \dfrac{x}{4\,\sqrt{x^2 + 16}} ~-~ \dfrac{1}{5} ~=~ 0 \quad\Rightarrow\quad 5x ~=~ 4\,\sqrt{x^2 + 16} \quad\Rightarrow\quad 25x^2 ~=~ 16\,(x^2 + 16) \quad\Rightarrow\quad x ~=~ \dfrac{16}{3} ~, \nonumber \]

    so \(x=\frac{16}{3}\) is the only critical point. Thus, the (global) minimum of \(T\) will occur at \(x=\frac{16}{3}\), \(x=0\), or \(x=10\). Since

    \[T(0) ~=~ 3 \quad,\qquad T(10) ~=~ \frac{\sqrt{29}}{2} ~\approx~ 2.693 \quad,\qquad T\left(\frac{16}{3}\right) ~=~ \frac{13}{5} ~=~ 2.6 \nonumber \]

    then \(T(\frac{16}{3}) < T(10) < T(0)\). Hence, the global minimum occurs when landing the boat \(x= \frac{16}{3} \approx 5.33\) miles down the coast.

    Note that this example shows the importance of checking the endpoints. It was quite close between landing about 5.33 miles down the coast (2.6 hours) or simply rowing all the way to the destination (about 2.693 hours)—the difference is only about 5.6 minutes. With just a slight change in a few of the numbers, the minimum could have occurred at an endpoint. Moral: always check the endpoints!3

    Example \(\PageIndex{1}\): minmax6

    Add text here.


    Find the point \((x,y)\) on the graph of the curve \(\;y=\sqrt{x}\;\) that is closest to the point \((1,0)\).

    Solution: Let \((x,y)\) be a point on the curve \(y=\sqrt{x}\). Then \((x,y) = (x,\sqrt{x}\;)\), so by the distance formula the distance \(D\) between \((x,y)\) and \((1,0)\) is given by

    \[D^2 ~=~ (x-1)^2 ~+~ (y - 0)^2 ~=~ (x-1)^2 ~+~ (\sqrt{x}\,)^2 ~=~ (x-1)^2 ~+~ x~, \nonumber \]

    which is a function of \(x \ge 0\) alone. Note that minimizing \(D\) is equivalent to minimizing \(D^2\). Since

    \[\dfrac{d(D^2)}{\dx} ~=~ 2\,(x-1) ~+~ 1 ~=~ 2x ~-~ 1 ~=~ 0 \quad\Rightarrow\quad x ~=~ \tfrac{1}{2} ~~\text{is the only critical point,} \nonumber \]

    and since \(\frac{d^2(D^2)}{\dx^2} \;=\; 2 \;>\; 0\) for all \(x\), then by the Second Derivative Test \(x=1/2\) is a local minimum. Hence, the global minimum for \(D^2\) must occur at the endpoint \(x=0\) or at \(x=1/2\). But \(D^2(0)=1 > D^2(1/2)=3/4\), so the global minimum occurs at \(x=1/2\). Hence, the closest point is \((x,y) ~=~ (1/2,\sqrt{1/2})\).Example \(\PageIndex{1}\): minmax7

    Add text here.


    Find the width and height of the rectangle with the largest possible perimeter inscribed in a semicircle of radius \(r\).

    Solution: Let \(w\) be the width of the rectangle and let \(h\) be the height, as in the picture. Then the perimeter is \(P= 2w + 2h\). By symmetry and the Pythagorean Theorem,

    \[h^2 ~=~ r^2 ~-~ \left(\frac{w}{2}\right)^2 \quad\Rightarrow\quad h ~=~ \frac{1}{2}\,\sqrt{4r^2 - w^2} \nonumber \]

    and so \(P = 2w + \sqrt{4r^2 - w^2}\) for \(0 < w < 2r\). Find the critical points of \(P\):

    \[\begin{aligned} P'(w) ~=~ 2 ~-~ \frac{w}{\sqrt{4r^2 - w^2}} ~=~ 0 \quad&\Rightarrow\quad w ~=~ 2\sqrt{4r^2 - w^2}\

    \[2pt] &\Rightarrow\quad w^2 ~=~ 16r^2 ~-~ 4w^2\

    \[2pt] &\Rightarrow\quad w ~=~ \frac{4r}{\sqrt{5}} ~~\text{is the only critical point,}\end{aligned} \nonumber \]

    and since

    \[P''(w) ~=~ -\,\frac{4r^2}{(4r^2 - w^2)^{3/2}} \quad\Rightarrow\quad P''\left(\tfrac{4r}{\sqrt{5}}\right) ~=~ -\,\frac{5^{3/2}}{2r} ~<~ 0 \nonumber \]

    then \(P\) has a local maximum at \(w=\frac{4r}{\sqrt{5}}\), by the Second Derivative Test. Since \(P(w)\) is defined for \(w\) in the open interval \((0,2r)\), the local maximum is a global maximum. For the width \(w=\frac{4r}{\sqrt{5}}\) the height is \(h=\frac{r}{\sqrt{5}}\), which gives the dimensions for the maximum perimeter.

    Note: If \(w\) were extended to include the cases of “degenerate” rectangles of zero width or height, i.e. \(w=0\) or \(w=2r\), then the maximum perimeter would still occur at \(w=\tfrac{4r}{\sqrt{5}}\), since \(P\left(\tfrac{4r}{\sqrt{5}}\right) = \tfrac{10r}{\sqrt{5}} \approx 4.472r\) is larger than \(P(0) = 2r\) and \(P(2r) = 4r\).


    1. Find the point on the curve \(y=x^2\) that is closest to the point \((4,\;-1/2)\).
    2. Prove that for \(0\le p\le 1\), \(p\,(1-p) \le \frac{1}{4}\).
    3. A farmer wishes to fence a field bordering a straight stream with \(1000\) yd of fencing material. It is not necessary to fence the side bordering the stream. What is the maximum area of a rectangular field that can be fenced in this way?
    4. The power output \(P\) of a battery is given by \(P = VI - RI^2\), where \(I\), \(V\), and \(R\) are the current, voltage, and resistance, respectively, of the battery. If \(V\) and \(R\) are constant, find the current \(I\) that maximizes \(P\).
    5. An impulse turbine consists of a high speed jet of water striking circularly mounted blades. The power \(P\) generated by the turbine is \(P=VU(V-U)\), where \(V\) is the speed of the jet and \(U\) is the speed of the turbine. If the jet speed \(V\) is constant, find the turbine speed \(U\) that maximizes \(P\).
    6. A man is in a boat \(5\) miles off a straight coast. He wants to reach a point \(15\) miles down the coast in the minimum possible time. If he can row \(6\) mi/hr and run \(10\) mi/hr, where should he land the boat?
    7. The current \(I\) in a voltaic cell is

      \[I ~=~ \dfrac{E}{R + r} ~, \nonumber \]

      where \(E\) is the electromotive force and \(R\) and \(r\) are the external and internal resistance, respectively. Both \(E\) and \(r\) are internal characteristics of the cell, and hence can be treated as constants. The power \(P\) developed in the cell is \(P = RI^2\). For which value of \(R\) is the power \(P\) maximized?

    8. Find the point(s) on the ellipse \(\frac{x^2}{25} + \frac{y^2}{16} = 1\) closest to \((-1,0)\).
    9. Find the maximum area of a rectangle that can be inscribed in an ellipse \(\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1\), where \(a>0\) and \(b>0\) are arbitrary constants. Your answer should be in terms of \(a\) and \(b\).
    10. Find the radius and angle of the circular sector with the maximum area and a fixed perimeter \(P\).
    11. [exer:projmaxangle] In Example
      Example \(\PageIndex{1}\): minmax3

      Add text here.


      show that the maximum height reached by the projectile when launched with an initial velocity \(v_0\) at an angle \(0<\theta<\frac{\pi}{2}\) to the ground is \(\frac{v_0^2\,\sin^2 \theta}{2g}\).
    12. The phase velocity \(v\) of a capillary wave with surface tension \(T\) and water density \(p\) is

      \[v ~=~ \sqrt{\frac{2\pi T}{\lambda p} + \frac{\lambda g}{2\pi}} \nonumber \]

      where \(\lambda\) is the wavelength. Find the value of \(\lambda\) that minimizes \(v\).

    13. [exer:inventory] For an inventory model with a constant order quantity \(Q>0\) and a constant linear inventory depletion rate \(D\), the total unit cost \(TC\) to maintain an average inventory of \(Q/2\) units is

      \[TC ~=~ C ~+~ \frac{P}{Q} ~+~ \frac{(I+W)\,Q}{2D} \nonumber \]

      where \(C\) is the capital investment cost, \(P\) is the cost per order, \(I\) is the per unit interest charge per unit time, and \(W\) is the overall inventory holding cost. Find the value of \(Q\) that minimizes \(TC\).

    14. The opening of a rain gutter—shown in the figure on the right—has a bottom and two sides each with length \(a\). The sides make an angle \(\theta\) with the bottom. Find the value of \(\theta\) that maximizes the amount of rain the gutter can hold. [[1.]]
    15. In an electric circuit with a supplied voltage (emf) \(E\), a resistor with resistance \(r_0\), and an inductor with reactance \(x_0\), suppose you want to add a second resistor. If \(r\) represents the resistance of this second resistor then the power \(P\) delivered to that resistor is given by

      \[P ~=~ \dfrac{E^2 r}{(r + r_0)^2 ~+~ {x_0}^2} \nonumber \]

      with \(E\), \(r_0\), and \(x_0\) treated as constants. For which value of \(r\) is the power \(P\) maximized?

    16. The stress \(\tau\) in the \(xy\)-plane along a varying angle \(\phi\) is given by

      \[\tau ~=~ \tau(\phi) ~=~ \frac{\sigma_x - \sigma_y}{2}\,\sin\,2\phi ~+~ \tau_{xy}\,\cos\,2\phi ~, \nonumber \]

      where \(\sigma_x\), \(\sigma_y\), and \(\tau_{xy}\) are stress components that can be treated as constants. Show that the maximum stress is

      \[\tau ~=~ \frac{\sqrt{\left(\sigma_x - \sigma_y\right)^2 ~+~ 4 \tau^2_{xy}}}{2} ~. \nonumber \]

      (Hint: Draw a right triangle with angle \(2\phi\) after finding the critical point(s).) [[1.]]

    17. A certain jogger can run 0.16 km/min, and walks at half that speed. If he runs along a circular trail with circumference 50 km and then—before completing one full circle—walks back straight across to his starting point, what is the maximum time he can spend on the run/walk?
    18. A rectangular poster is to contain 50 square inches of printed material, with 4-inch top and bottom margins and 2-inch side margins. What dimensions for the poster would use the least paper?
    19. Find the maximum volume of a right circular cylinder that can be inscribed in a sphere of radius \(3\).
    20. A figure consists of a rectangle whose top side coincides with the diameter of a semicircle atop it. If the perimeter of the figure is \(20\) m, find the radius and height of the semicircle and rectangle, respectively, that maximizes the area inside the figure.
    21. A thin steel pipe \(25\) ft long is carried down a narrow corridor \(5.4\) ft wide. At the end of the corridor is a right-angle turn into a wider corridor. How wide must this corridor be in order to get the pipe around the corner? You may assume that the width of the pipe can be ignored.
    22. A rectangle is inscribed in a right triangle, with one corner of the rectangle at the right angle of the triangle. Show that the maximum area of the rectangle occurs when a corner of the rectangle is at the midpoint of the hypotenuse of the triangle. [[1.]]
    23. Find the relation between the radius and height of a cylindrical can with an open top that maximizes the volume of the can, given that the surface area of the can is always the same fixed amount.
    24. An isosceles triangle is circumscribed about a circle of radius \(r\). Find the height of the triangle that minimizes the perimeter of the triangle.
    25. Suppose \(N\) voltaic cells are arranged in \(N/x\) rows in parallel, with each row consisting of \(x\) cells in series, creating a current \(I\) through an external resistance \(R\). Each cell has internal resistance \(r\) and EMF (voltage) \(e\). Find the \(x\) that maximizes the current \(I\), which—due to Ohm’s Law—is given by

      \[I ~=~ \dfrac{xe}{(x^2 r/N) + R} ~~. \nonumber \]

    26. A single-degree-of-freedom harmonically forced vibration system with damping factor \(\zeta\) has magnification factor \(MF = ((1 - r^2)^2 + (2\zeta r)^2)^{-1/2}\), where \(r\) is the frequency ratio. Find the value of \(r\) that maximizes \(MF\).
    27. At a distance \(x\ge0\) from the center of a uniform ring with charge \(q\) and radius \(a\), the magnitude \(E\) of the electric field for points on the axis of the ring is

      \[E ~=~ \frac{qx}{4 \pi \epsilon_0\,(a^2 + x^2)^{3/2}} \nonumber \]

      where \(\epsilon_0\) is the permittivity of free space. Find the distance \(x\) that maximizes \(E\).

    28. Find the equation of the tangent line to the ellipse \(\frac{x^2}{a^2}+\frac{y^2}{b^2}=1\) in the first quadrant that forms with the coordinate axes the right triangle with minimal area.
    29. A “cold” star that has exhausted its nuclear fuel—called a white dwarf—has total energy \(E\), given by

      \[E ~=~ \frac{\hbar^2 \,(3 \pi^2 Nq)^{5/3}}{10 \pi^2 m}\,\left(\frac{4}{3} \pi R^3\right)^{-2/3} ~-~ \frac{3 G M^2 N^2}{5R} \nonumber \]

      where \(\hbar\) is the reduced Planck constant, \(N\) is the number of nucleons—protons and neutrons—in the star, \(q\) is the charge of an electron, \(m\) is the mass of an electron, \(M\) is the mass of a nucleon, \(G\) is the gravitational constant, and \(R\) is the radius of the star. Show that the radius \(R\) that minimizes \(E\) is

      \[R ~=~ \left(\frac{9 \pi}{4}\right)^{2/3}\,\frac{\hbar^2 q^{5/3}}{GmM^2 N^{1/3}} ~. \nonumber \]


    30. An object of mass \(m\) has orbital angular momentum \(l\) around a black hole with Schwarzchild radius \(r_S\) and mass \(M\). The effective potential \(\Phi\) of the object is

      \[\Phi ~=~ -\frac{GM}{r} ~+~ \frac{l^2}{2m^2r^2} ~-~ \frac{r_S l^2}{2m^2r^3} \nonumber \]

      where \(G\) is the gravitational constant and \(r\) is the object’s distance from the black hole. Show that \(\Phi\) has a local maximum and minimum at \(r=r_1\) and \(r=r_2\), respectively, where

      \[r_1 ~=~ \frac{l^2}{2GMm^2}\,\left(1 - \sqrt{1 - \frac{6GMm^2r_S}{l^2}}\,\right) \quad\text{and}\quad r_2 ~=~ \frac{l^2}{2GMm^2}\,\left(1 + \sqrt{1 - \frac{6GMm^2r_S}{l^2}}\,\right) ~. \nonumber \]

    31. Recall Fermat’s Principle from Example
      Example \(\PageIndex{1}\): minmax4

      Add text here.


      , which states that light travels along the path that takes the least amount of time. The speed of light in a vacuum is approximately \(c = 2.998 \times 10^8\) m/s, but in some other medium (e.g. water) light is slower. Suppose that a ray of light goes from a point \(A\) in one medium where it moves at a speed \(v_1\) and ends up at a point \(B\) in another medium where it moves at a speed \(v_2\). Use Fermat’s Principle to prove Snell’s Law, which says that the light is refracted through the boundary between the two media such that

      \[\frac{\sin\,\theta_1}{\sin\,\theta_2} ~=~ \frac{v_1}{v_2} \nonumber \]

      where \(\theta_1\) and \(\theta_2\) are the angles that the light makes with the normal line perpendicular to the boundary of the media in the first and second medium, respectively, as in the picture above. [[1.]]

    32. A sphere of radius \(a\) is inscribed in a right circular cone, with the sphere touching the base of the cone. Find the radius and height of the cone if its volume is a minimum.
    33. Find the length of the shortest line segment from the positive \(x\)-axis to the positive \(y\)-axis going through a point \((a,b)\) in the first quadrant.
    34. Find the radius \(r\) of a circle \(c\) whose center is on a fixed circle \(C\) of radius \(R\) such that the arc length of the part of \(c\) within \(C\) is a maximum.

    1. The words “maxima” and “minima” are the traditional plural forms of maximum and minimum, respectively.↩
    2. A formal proof requires the Mean Value Theorem, which will be presented in Section 4.4.↩
    3. Another possible lesson is that optimal in the mathematical sense might, again, not mean optimal in a practical sense. After all, presumably after the man is finished with whatever he had to do at the destination 10 miles down the coast, he then has the inconvenience of going back about 4.67 miles to retrieve his boat. At his running speed of 10 mph this would take 28 minutes, wiping out the 5.6 minutes he gained with his “optimal” landing spot!↩
    4. For a proof, see pp.10-11 in Koo, D., Elements of Optimization, New York: Springer-Verlag, 1977.↩
    5. Note: To “just give up”—as suggested semi-seriously by some students I have had—is not an option.↩
    6. Sometimes called the Newton-Raphson method.↩
    7. See pp.58-62 in Saaty, T.L. and J. Bram, Nonlinear Mathematics, New York: McGraw-Hill, Inc., 1964.↩
    8. There are some programming language libraries for calculating derivatives of functions “on the fly,” i.e. dynamically. For example, the GNU libmatheval C/Fortran library can perform such symbolic operations. It is available at
    9. See pp.227-229 in Dahlquist, G. and Å. Björck, Numerical Methods, Englewood Cliffs, NJ: Prentice-Hall, Inc., 1974.↩
    10. For example, Ralston, A. and P. Rabinowitz, A First Course in Numerical Analysis, 2nd ed., New York: McGraw-Hill, Inc., 1978.↩
    11. For a proof see pp.16-17 in Ostrowski, A.M., Solution of Equations and Systems of Equations, 2nd ed., New York: Academic Press Inc., 1966.↩

    This page titled 4.1: Optimization is shared under a GNU General Public License 3.0 license and was authored, remixed, and/or curated by Michael Corral.

    • Was this article helpful?