Skip to main content
Mathematics LibreTexts

6.1: Optimization

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

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    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.

    figure6.1.1.png

    Figure \(\PageIndex{1}\). The function \(f(x) = x^2\) restricted to \([-2,1]\)

    Example \(\PageIndex{1}\)

    Find the maximum and minimum values of \(f(x) = x^2\) on the interval \([-2,1]\), shown in figure \(\PageIndex{1}\). We compute \(f'(x) = 2x\), which is zero at \(x=0\) and is always defined.

    Solution

    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}.\nonumber\]

    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 \(\PageIndex{2}\): Extreme Value Theorem

    If \(f\) is continuous on a closed interval \([a,b]\), then it has both a maximum and a minimum 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.

    Example \(\PageIndex{3}\)

    Let \(f(x) = -x^2+ 4x -3\). Find the maximum value of \(f(x)\) on the interval \([0,4]\).

    Solution

    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\).

    Example \(\PageIndex{4}\)

    Let \(f(x) = -x^2+ 4x -3\). Find the maximum value of \(f(x)\) on the interval \([-1,1]\).

    Solution

    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\).

    Example \(\PageIndex{5}\)

    Find the maximum and minimum values of the function \(f(x) = 7 + |x-2|\) for \(x\) between \(1\) and \(4\) inclusive.

    Solution

    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\).

    Figure \(\PageIndex{2}\). \(f(x) = x^3 -x\).

    Figure \(\PageIndex{2}\). \(f(x) = x^3 -x\).

    Example \(\PageIndex{6}\)

    Find all local maxima and minima for \(f(x) = x^3 - x\), and determine whether there is a global maximum or minimum on the open interval \((-2,2)\).

    Solution

    In an example using this particular function in the previous chapter, 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 open interval \((-2,2)\) does not contain its endpoints, 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 \(x=-2\) and \(x= -\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 \( \sqrt{3}/3\), we need to know what the function values do "close to" \(x=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 \( -\sqrt{3}/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\times 4\) which is clearly larger than \( \sqrt{3}\), 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 \(\PageIndex{2}\).

    Example \(\PageIndex{7}\)

    Of all rectangles of area 100, which has the smallest perimeter?

    Solution

    First we must translate this into a purely mathematical problem in which we want to find the minimum value of a function. If \(x\) denotes one of the sides of the rectangle, then the adjacent side must be \(100/x\) (in order that the area be \(100\)). So the function we want to minimize is
    \[f(x)=2x+2\dfrac{100}{x}\nonumber\]
    since the perimeter is twice the length plus twice the width of the rectangle. Not all values of \(x\) make sense in this problem: lengths of sides of rectangles must be positive, so \(x\gt 0\). If \(x\gt 0\) then so is \(100/x\), so we need no second condition on \(x\).

    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\gt 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.

    Example \(\PageIndex{8}\)

    You want to sell a certain number \(n\) of items in order to maximize your profit. Market research tells you that if you set the price at $1.50, you will be able to sell 5000 items, and for every 10 cents you lower the price below $1.50 you will be able to sell another 1000 items. Suppose that your fixed costs ("start-up costs") total $2000, and the per item cost of production ("marginal cost") is $0.50. Find the price to set per item and the number of items sold in order to maximize profit, and also determine the maximum profit you can get.

    Solution

    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}\nonumber\]

    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. (Alternatively, 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.

     

    Figure \(\PageIndex{3}\). Rectangle in a parabola: drag the blue point, trying to maximize the area.

    Example \(\PageIndex{9}\)

    Find the largest rectangle (that is, the rectangle with largest area) that fits inside the graph of the parabola \(y= x^2\) below the line \(y=a\) (where \(a\) is an unspecified constant value), with the top side of the rectangle on the horizontal line \(y=a\). See figure \(\PageIndex{3}\).

    Solution

    We want to find the maximum value of some function \(A(x)\) representing area. Perhaps the hardest part of this problem is deciding what \(x\) should represent. The lower right corner of the rectangle is at \((x,x^2)\), and once this is chosen the rectangle is completely determined. So we can let the \(x\) in \(A(x)\) be the \(x\) of the parabola \(f(x) = x^2\). Then the area is \(A(x) = (2x)(a-x^2) = -2x^3 + 2ax\). We want the maximum value of \(A(x)\) when \(x\) is in \([0,\sqrt{a}]\). (You might object to allowing \(x=0\) or \( x=\sqrt{a}\), since then the "rectangle" has either no width or no height, so is not "really" a rectangle. But the problem is somewhat easier if we simply allow such rectangles, which have zero area.)

    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})=\dfrac{4\sqrt{3}}{9}a^{3/2}\). The maximum area thus occurs when the rectangle has dimensions (width\(\times\)height): \(2\sqrt{a/3}\times (2a/3)\).

    Figure 6.1.4. Cone in a sphere.

    Figure 6.1.4. Cone in a sphere.

    Example \(\PageIndex{10}\)

    If you fit the largest possible cone inside a sphere, what fraction of the volume of the sphere is occupied by the cone? Here, by "cone" we mean a right circular cone, i.e., a cone for which the base is perpendicular to the axis of symmetry, and for which the cross-section cut perpendicular to the axis of symmetry at any point is a circle.

    Solution

    Let \(R\) be the radius of the sphere, and let \(r\) and \(h\) be the base radius and height of the cone inside the sphere. What we want to maximize is the volume of the cone: \(\pi r^2 h/3\). Here \(R\) is a fixed value, but \(r\) and \(h\) can vary. Namely, we could choose \(r\) to be as large as possible --- equal to \(R\) --- by taking the height equal to \(R\); or we could make the cone's height \(h\) larger at the expense of making \(r\) a little less than \(R\). See the cross-section depicted in figure \(\PageIndex{4}\). We have situated the picture in a convenient way relative to the \(x\) and \(y\) axes, namely, with the center of the sphere at the origin and the vertex of the cone at the far left on the \(x\)-axis.

    Notice that the function we want to maximize, \(\pi r^2 h/3\), depends on two 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.\nonumber\]

    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^2 h/3\):

    \[\eqalign{ V(h)&=\pi(R^2-(h-R)^2)h/3\cr& =-{\pi\over3}h^3+{2\over3}\pi h^2R\cr}\nonumber\]

    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

    \[\dfrac{(32/81)\pi R^3}{(4/3)\pi R^3}=\dfrac{8}{27}\approx 30\%.\nonumber\]

    Example \(\PageIndex{11}\)

    You are making cylindrical containers to contain a given volume. Suppose that the top and bottom are made of a material that is \(N\) times as expensive (cost per unit area) as the material used for the lateral side of the cylinder. Find (in terms of \(N\)) the ratio of height to base radius of the cylinder that minimizes the cost of making the containers.

    Solution

    Let us first choose letters to represent various things: \(h\) for the height, \(r\) for the base radius, \(V\) for the volume of the cylinder, and \(c\) for the cost per unit area of the lateral side of the cylinder. \(V\) and \(c\) are constants, \(h\) and \(r\) are variables. Now we can write the cost of materials:

    \[c(2\pi r h) + Nc(2\pi r^2).\nonumber\]

    Again we have two variables; the relationship is provided by the fixed volume of the cylinder: \(V = \pi r^2 h\). We use this relationship to eliminate \(h\) (we could eliminate \(r\), but it's a little easier if we eliminate \(h\), which appears in only one place in the above formula for cost). The result is

    \[f(r)=2c\pi r\dfrac{V}{\pi r^2}+2Nc\pi r^2=2c\dfrac{V}{r}+2Nc\pi r^2.\nonumber\]

    We want to know the minimum value of this function when \(r\) is in \((0,\infty)\). We now set \(0=f'(r)=-2cV/ r^2 + 4Nc\pi r\), giving \(r =\sqrt[3]{V/(2N\pi)}\). Since \(f''(r) = 4cV/r^3+4Nc\pi\) is positive when \(r\) is positive, there is a local minimum at the critical value, and hence a global minimum since there is only one critical value.

    Finally, since \(h=V/(\pi r^2)\),

    \[\dfrac{h}{r}=\dfrac{V}{\pi r^3}=\dfrac{V}{\pi(V/(2N\pi))}=2N,\nonumber\]

    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).

     

    Figure \(\PageIndex{5}\). Drag the blue point to minimize travel time.

    Example \(\PageIndex{12}\)

    Suppose you want to reach a point \(A\) that is located across the sand from a nearby road (see figure \(\PageIndex{5}\)). Suppose that the road is straight, and \(b\) is the distance from \(A\) to the closest point \(C\) on the road. Let \(v\) be your speed on the road, and let \(w\), which is less than \(v\), be your speed on the sand. Right now you are at the point \(D\), which is a distance \(a\) from \(C\). At what point \(B\) should you turn off the road and head across the sand in order to minimize your travel time to \(A\)?

    Solution

    Let \(x\) be the distance short of \(C\) where you turn off, i.e., the distance from \(B\) to \(C\). We want to minimize the total travel time. Recall that when traveling at constant velocity, time is distance divided by speed.

    You travel the distance \(\overline{DB}\) at speed \(v\), and then the distance \(\overline{BA}\) at speed \(w\). Since \(\overline{DB} = a-x\) and, by the Pythagorean theorem, \(\overline{BA} = \sqrt{x^2+b^2}\), the total time for the trip is

    \[f(x)=\dfrac{a-x}{v}+\dfrac{\sqrt{x^2+b^2}}{w}.\nonumber\]

    We want to find the minimum value of \(f\) when \(x\) is between \(0\) and \(a\). As usual we set \(f'(x)=0\) and solve for \(x\):

    \[0=f'(x)=-\dfrac{1}{v}+\dfrac{x}{w\sqrt{x^2+b^2}}\nonumber\]

    \[w\sqrt{x^2+b^2}=vx\nonumber\]

    \[w^2(x^2+b^2)=v^2x^2\nonumber\]

    \[w^2b^2=(v^2-w^2)x^2\nonumber\]

    \[x=\dfrac{wb}{\sqrt{v^2-w^2}}.\nonumber\]

    Notice that \(a\) does not appear in the last expression, but \(a\) is not irrelevant, since we are interested only in critical values that are in \([0,a]\), and \(wb/\sqrt{v^2-w^2}\) is either in this interval or it is not. If it is, we can use the second derivative to test it:

    \[f''(x)=\dfrac{b^2}{(x^2+b^2)^{3/2}w}.\nonumber\]

    Since this is always positive there is a local minimum at the critical point, and so it is a global minimum as well.

    If the critical value is not in \([0,a]\) it is larger than \(a\). In this case the minimum must occur at one of the endpoints. We can compute

    \[f(0)=\dfrac{a}{v}+\dfrac{b}{w}\nonumber\]

    \[f(a)=\dfrac{\sqrt{a^2+b^2}}{w}\nonumber\]

    but it is difficult to determine which of these is smaller by direct comparison. If, as is likely in practice, we know the values of \(v\), \(w\), \(a\), and \(b\), then it is easy to determine this. With a little cleverness, however, we can determine the minimum in general. We have seen that \(f''(x)\) is always positive, so the derivative \(f'(x)\) is always increasing. We know that at \(x=wb/\sqrt{v^2-w^2}\) the derivative is zero, so for values of \(x\) less than that critical value, the derivative is negative. This means that \(f(0) \gt f(a)\), so the minimum occurs when \(x=a\).

    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 at 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.

    1. Write a formula for the function for which you wish to find the maximum or minimum.
    2. Express that formula in terms of only one variable, that is, in the form \(f(x)\).
    3. Set \(f'(x)=0\) and solve. Check all critical values and endpoints to determine the extreme value.

    Exercises \(\PageIndex{}\)

    Exercise \(\PageIndex{1}\)

    Let \(\displaystyle f(x) = \cases{1 + 4 x -x^2 & for \(x \le 3\) \cr (x+5)/2 & for \(x>3\) \cr}\).

    Find the maximum value and minimum values of \(f(x)\) for \(x\) in \([0,4]\). Graph \(f(x)\) to check your answers.

    Answer

    Maximum at \((2,5)\), minimum at \((0,1)\).

    Exercise \(\PageIndex{2}\)

    Find the dimensions of the rectangle of largest area having fixed perimeter 100.

    Answer

    A square, with side length 25.

    Exercise \(\PageIndex{3}\)

    Find the dimensions of the rectangle of largest area having fixed perimeter \(P\).

    Answer

    A square, with side length \(P/4\).

    Exercise \(\PageIndex{4}\)

    A box with square base and no top is to hold a volume 100. Find the dimensions of the box that requires the least material for the five sides. Also find the ratio of height to side of the base.

    Answer

    Base has side \(2\times \sqrt[3]{25}\), height is \(\sqrt[3]{25}\). Ratio of height to side of the base = \(1/2\).

    Exercise \(\PageIndex{5}\)

    A rectangular box with a square base is to hold a volume of 200. The bottom and top are formed by folding in flaps from the sides, so that both the bottom and top consist of two layers of cardboard. Find the dimensions of the box that requires the least material. Also find the ratio of height to side of the base.

    Answer

    Base has side \(\sqrt[3]{100}\), height is \(2\times\sqrt[3]{100}\). Ratio of height to side of the base = \(2\).

    Exercise \(\PageIndex{6}\)

    A box with square base and no top is to hold a volume \(V\). Find (in terms of \(V\)) the dimensions of the box that requires the least material for the five sides. Also find the ratio of height to side of the base. (This ratio will not involve \(V\).)

    Answer

    Base has side \(\sqrt[3]{2V}\), height is \(\sqrt[3]{2V}/2\). Ratio of height to side of the base = \(1/2\).

    Exercise \(\PageIndex{7}\)

    You have 100 feet of fence to make a rectangular play area alongside the wall of your house. The wall of the house bounds one side. What is the largest size possible (in square feet) for the play area?

    Answer

    1250 square feet.

    Exercise \(\PageIndex{8}\)

    You have \(l\) feet of fence to make a rectangular play area alongside the wall of your house. The wall of the house bounds one side. What is the largest size possible (in square feet) for the play area?

    Answer

    \(l^2/8\) square feet.

    Exercise \(\PageIndex{9}\)

    Marketing tells you that if you set the price of an item at $10 then you will be unable to sell it, but that you can sell 500 items for each dollar below $10 that you set the price. Suppose your fixed costs total $3000, and your marginal cost is $2 per item. What is the most profit you can make?

    Answer

    $5000 profit, for 2000 items at a price of $6 per item.

    Exercise \(\PageIndex{10}\)

    Find the area of the largest rectangle that fits inside a semicircle of radius \(10\), where one side of the rectangle lies along the diameter of the semicircle.

    Answer

    100

    Exercise \(\PageIndex{11}\)

    Find the area of the largest rectangle that fits inside a semicircle of radius \(r\), where one side of the rectangle lies along the diameter of the semicircle.

    Answer

    \(r^2\)

    Exercise \(\PageIndex{12}\)

    For a circular cylinder with surface area 50, including the top and the bottom, find the ratio of height to base radius that maximizes the volume.

    Answer

    Ratio of height to base radius = 2.

    Exercise \(\PageIndex{13}\)

    For a circular cylinder with given surface area \(S\), including the top and the bottom, find the ratio of height to base radius that maximizes the volume.

    Answer

    Ratio of height to base radius = 2.

    Exercise \(\PageIndex{14}\)

    You want to make cylindrical containers to hold 1 liter using the least amount of construction material. The side is made from a rectangular piece of material, and this can be done with no material wasted. However, the top and bottom are cut from squares of side \(2r\), so that \(2(2r)^2=8r^2\) of material is needed (rather than \(2\pi r^2\), which is the total area of the top and bottom). Find the dimensions of the container using the least amount of material, and also find the ratio of height to radius for this container. (Take 1 liter = 1000 cm\(^3\).)

    Answer

    Radius = 5 cm, height = \(40/\pi\) cm (\(\approx 12.7\) cm), ratio of height to radius = \(8/\pi\).

    Exercise \(\PageIndex{15}\)

    You want to make cylindrical containers of a given volume \(V\) using the least amount of construction material. The side is made from a rectangular piece of material, and this can be done with no material wasted. However, the top and bottom are cut from squares of side \(2r\), so that \(2(2r)^2=8r^2\) of material is needed (rather than \(2\pi r^2\), which is the total area of the top and bottom). Find the optimal ratio of height to radius.

    Answer

    Optimal ratio of height to radius = \(8/\pi\).

    Exercise \(\PageIndex{16}\)

    Given a right circular cone, you put an upside-down cone inside it so that its vertex is at the center of the base of the larger cone and its base is parallel to the base of the larger cone. If you choose the upside-down cone to have the largest possible volume, what fraction of the volume of the larger cone does it occupy? (Let \(H\) and \(R\) be the height and base radius of the larger cone, and let \(h\) and \(r\) be the height and base radius of the smaller cone. Hint: Use similar triangles to get an equation relating \(h\) and \(r\).)

    Answer

    \(4/27\)

    Exercise \(\PageIndex{17}\)

    In example \(\PageIndex{12}\), what happens if \(w \ge v\) (that is, your speed on sand is at least your speed on the road)?

    Answer

    You should go directly from D to A, straight across the sand.

    Exercise \(\PageIndex{18}\)

    A container holding a fixed volume is being made in the shape of a circular cylinder with a hemispherical top. (The hemispherical top has the same radius as the cylinder.) Find the ratio of the height of the cylinder to the radius of the cylinder which minimizes the cost of the container if (a) the cost per unit area of the top is twice as great as the cost per unit area of the side, and the container is made with no bottom; (b) the same as in (a), except that the container is made with a circular bottom, for which the cost per unit area is 1.5 times the cost per unit area of the side.

    Answer

    Ratio of height to radius: (a) 2; (b) 7/2.

    Exercise \(\PageIndex{19}\)

    A piece of cardboard is 1 meter by \(1/2\) meter. A square is to be cut from each corner and the sides folded up to make an open-top box. What are the dimensions of the box with maximum possible volume?

    Answer

    \(\left(\dfrac{1}{2}+\dfrac{\sqrt{3}}{6}\right),\quad\dfrac{\sqrt{3}}{6},\quad\left(\dfrac{1}{4}-\dfrac{\sqrt{3}}{12}\right),\quad\) all in meters.

    Exercise \(\PageIndex{20}\)

    (a) A square piece of cardboard of side \(a\) is used to make an open-top box by cutting out a small square from each corner and bending up the sides. How large a square should be cut from each corner in order that the box have maximum volume? (b) What if the piece of cardboard used to make the box is a rectangle of sides \(a\) and \(b\)?

    Answer

    (a) \(a/6\quad\) (b) \(\dfrac{a+b-\sqrt{a^2-ab+b^2}}{6}\)

    Exercise \(\PageIndex{21}\)

    A window consists of a rectangular piece of clear glass with a semicircular piece of colored glass on top; the colored glass transmits only \(1/2\) as much light per unit area as the clear glass. If the distance from top to bottom (across both the rectangle and the semicircle) is 2 meters and the window may be no more than 1.5 meters wide, find the dimensions of the rectangular portion of the window that lets through the most light.

    Answer

    Height, 1.25 meters. Width, 1.5 meters.

    Exercise \(\PageIndex{22}\)

    A window contains a rectangular piece of clear glass with a semicircular piece of colored glass on top. Suppose that the colored glass transmits only \(k\) times as much light per unit area as the clear glass (\(k\) is between \(0\) and \(1\)). If the distance from top to bottom (across both the rectangle and the semicircle) is a fixed distance \(H\), find (in terms of \(k\)) the ratio of vertical side to horizontal side of the rectangle for which the window lets through the most light.

    Answer

    If \(k \lt 2/\pi\) the ratio is \(\dfrac{2−k\pi}{4}.\;\) But if \(k \ge 2/\pi\), the ratio reduces to zero, because to let in the most light (whilst maintaining a fixed vertical height and unrestricted horizontal width), the window must consist only of the semicircle with no rectangle.

    Exercise \(\PageIndex{23}\)

    You are designing a poster to contain a fixed amount \(A\) of printing (measured in square centimeters) and have margins of \(a\) centimeters at the top and bottom and \(b\) centimeters at the sides. Find the ratio of vertical dimension to horizontal dimension of the printed area on the poster if you want to minimize the amount of posterboard needed.

    Answer

    \(a/b\)

    Exercise \(\PageIndex{24}\)

    The strength of a beam of rectangular cross section is proportional to the product of its width \(w\) times the square of its depth \(d\). Find the dimensions of the strongest beam that can be cut from a cylindrical log of radius \(r\).

    Figure \(\PageIndex{6}\). Cutting a beam.

    Figure \(\PageIndex{6}\). Cutting a beam.

    Answer

    \(w=\dfrac{2\sqrt{3}}{3}r,\quad d=\dfrac{2\sqrt{6}}{3}r\)

    Exercise \(\PageIndex{25}\)

    What fraction of the volume of a sphere is taken up by the largest cylinder that can be fitted inside the sphere?

    Answer

    Fraction \(=1/\sqrt{3},\;\approx 0.58\).

    Exercise \(\PageIndex{26}\)

    The U.S. post office will accept a box for shipment only if the sum of the length and girth (distance around) is at most 108 inches. Find the dimensions of the largest volume acceptable box which has a square front and back.

    Answer

    \(36 \times 18 \times 18\;\)inches.

    Exercise \(\PageIndex{27}\)

    Find the dimensions of the lightest cylindrical can containing 0.25 liter (=250 cm \({}^3\)) if the top and bottom are made of a material that is twice as heavy (per unit area) as the material used for the side.a

    Answer

    Cylinder radius \(=\dfrac{5}{\sqrt[3]{2\pi}},\;\approx 2.71\) cm. Height \(=10\sqrt[3]{4/\pi}\approx 10.84\) cm.

    Exercise \(\PageIndex{28}\)

    A conical paper cup is to hold \(1/4\) of a liter, i.e. 250 cm\(^3\). Find the height and radius of the cone which minimizes the amount of paper needed to make the cup. Use the formula \(\pi r\sqrt{r^2+h^2}\) for the area of the curved surface of a circular cone of height \(h\) and base radius \(r\).

    Answer

    Height of cone \(=\sqrt[3]{\dfrac{6\times 250}{\pi}}\approx 7.8\;\)cm. Radius of cone (circular base at the top, to hold liquid!) \(=\sqrt[3]{\dfrac{3\times 250}{\pi\sqrt{2}}}\approx 5.5\;\)cm.

    Exercise \(\PageIndex{29}\)

    A conical paper cup is to hold a fixed volume of water. Find the ratio of height to base radius of the cone which minimizes the amount of paper needed to make the cup. Use the formula \( \pi r\sqrt{r^2+h^2}\) for the area of the curved surface of a circular cone of height \(h\) and base radius \(r\), called the lateral area of the cone.

    Answer

    Height / radius \(=\sqrt{2}\).

    Exercise \(\PageIndex{30}\)

    If you fit a right circular cone into a fixed size sphere such that the cone has the largest possible surface area (lateral area plus area of base), what percentage of the volume of the sphere is occupied by the cone? (This exercise is a bit harder.) Hint: Describe the cone by using its base radius \(r\) and slant height \(s=\;\)the distance between the apex and any point on the circular rim of the base, measured along the cone's surface. (Instead of the more usual parameters \(r\), and \(h=\;\)height measured along the cone's central axis.)

    Answer

    The ratio of the volume of the cone to the volume of the sphere is \(\dfrac{1033+33\sqrt{17}}{4096},\approx 0.285416,\;\)so the cone occupies approximately 28.54% of the sphere.

    Exercise \(\PageIndex{31}\)

    Two electrical charges, one a positive charge A of magnitude \(a\) and the other a negative charge B of magnitude \(b\), are located a distance \(c\) apart. A positively charged particle P is situated on the line between A and B. Find where P should be put so that the net force on P away from A towards B is minimal. Assume that the force from each charge is proportional to its strength, and inversely proportional to the square of the distance from the charge.

    Answer

    Force on P is minimal when distance AP is \(\dfrac{c\sqrt[3]{a}}{\sqrt[3]{a}+\sqrt[3]{b}},\;\) and distance PB is \(\dfrac{c\sqrt[3]{b}}{\sqrt[3]{a}+\sqrt[3]{b}}.\)

    Exercise \(\PageIndex{32}\)

    Find the fraction of the area of a triangle that is occupied by the largest rectangle that can be drawn in the triangle (with one of its sides along a side of the triangle). Show that this fraction does not depend on the dimensions of the given triangle.

    Answer

    The area of the largest inscribed rectangle is equal to half the area of the triangle.

    Exercise \(\PageIndex{33}\)

    How are your answers to Problem \(\PageIndex{9}\) affected if the cost per item for the \(x\) items, instead of being simply $2, decreases below $2 in proportion to \(x\) (because of economy of scale and volume discounts) by 1 cent for each 25 items produced?

    Answer

    $7000 profit, for 2500 items at a price of $5 per item.

    Exercise \(\PageIndex{34}\)

    You are standing near the side of a large wading pool of uniform depth when you see a child in trouble. You can run at a speed \(v_1\) on land and at a slower speed \(v_2\) in the water. Your perpendicular distance from the side of the pool is \(a\), the child's perpendicular distance is \(b\), and the distance along the side of the pool between the closest point to you and the closest point to the child is \(c\) (see figure \(\PageIndex{7}\) below). Without stopping to do any calculus, you instinctively choose the quickest route (shown in the figure) and save the child. Our purpose is to derive a relation between the angle \(\theta_1\) your path makes with the perpendicular to the side of the pool when you're on land, and the angle \(\theta_2\) your path makes with the perpendicular when you're in the water. To do this, let \(x\) be the distance between the closest point to you at the side of the pool and the point where you enter the water. Write the total time you run (on land and in the water) in terms of \(x\) (and also the constants \(a,b,c,v_1,v_2\)). Then set the derivative equal to zero. The result, called "Snell's law" or the "law of refraction", also governs the bending of light when it goes from air into water.

    Figure \(\PageIndex{7}\). Wading pool rescue.

    Figure \(\PageIndex{7}\). Wading pool rescue.

    Answer

    The total time taken to reach the child is a minimum when \(\sin\theta_1/v_1=\sin\theta_2/v_2\).

    Contributors

    David Guichard (Whitman College)

    • Integrated by Justin Marshall.


    This page titled 6.1: Optimization is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by Terry Betteridge, Editor via source content that was edited to the style and standards of the LibreTexts platform.