Karl's Calculus Tutor - Box 5-1: Solutions to Exercises

Box 5.1: Solutions to ExercisesKCT logo

© 1996 by Karl Hahn

1a & 1b) Find maximum(s) and/or minimum(s) of f(x) = -x2 + 3x - 2.

Step 1: Determine the derivative of f(x). You should be adept at finding the derivative of a polynomial by now. We get f'(x) = -2x + 3. Why take the derivative? Because that is how you go about finding stationary points.

Step 2: Solve for the derivative of f(x) to be zero. So the equation to solve for x is:

   -2x + 3  =  0
You learned how to do that in algebra. The solution is x = 1.5. But why do we have to solve this? Because we are looking for stationary points. By definition, a stationary point is where f'(x) = 0. And we already know from the previous step that f'(x) = -2x + 3. Now we know that there is a stationary point for this function at x = 1.5

Step 3: Determine the second derivative of f(x). That just means taking the derivative of its derivative. If f(x) = -x2 + 3x - 2, then as we already determined, f'(x) = -2x + 3. Taking the derivative of that we get f"(x) = -2. Why take the second derivative? Because we need to know it in order to determine whether the stationary point we've located is a maximum or a minimum.

Step 4: Substitute the x-value of the stationary point into f"(x) and determine if the result is positive or negative. In this case where f"(x) = -2, it doesn't matter what you put in for x. f"(x) is always negative. By the rule we discussed in the main text, that means the stationary point we have located at x = 1.5 is a local maximum.

Step 5: Substitute the x-value of the stationary point into f(x). This will determine the y value of the stationary point. So we substitute x = 1.5 into f(x) = -x2 + 3x - 2. We get y = 0.25. So the stationary point is at (1.5, 0.25).

Check your work. Try a few x-values that are near the stationary point and be sure that when you substitute them into f(x) you get something less than the y-value of the stationary point. Why less than? Because we have determined this stationary point to be a maximum. It stands to reason that points near it should be less. Also sketch a quick graph of the function. Does it look like there is a maximum where we say there should be?


2a & 2b) Find maximum(s) and/or minimum(s) of f(x) = x3 - 3x + 1

Step 1: Determine the derivative of f(x). We get f'(x) = 3x2 - 3. Once again we do this because it is the first step in finding stationary points.

Step 2: Solve for the derivative of f(x) to be zero. This gives us the x-values of the stationary points. So the equation to solve for x is:

   3x2 - 3  =  0
Divide out 3 from both sides and you have:
   x2 - 1  =  0
which is a difference of squares and (by what you learned in algebra) can be readily factored into
   (x + 1)(x - 1)  =  0
which means that either x = 1 or x = -1. You can reach the same solutions using the quadratic formula as well on x2 + 0x - 1 = 0.

We found these solutions in order to locate the stationary points, which we now have x-values of x = 1 and x = -1.

Step 3: Determine the second derivative of f(x). This is so we can establish what's a maximum and what's a minimum. Again we find the second derivative of f(x) by taking the derivative of f'(x), which we already found in step 1. So we get f"(x) = 6x.

Step 4: Substitute the x-values of the stationary points into f"(x) and determine if the results are positive or negative. When we substitute x = 1 into f"(x) we get 6, which is positive. By the rule established in the main text, that means that this stationary point is a local minimum. When we substitute x = -1 into f"(x) we get -6, which is negative. By the same rule, that means that this stationary point is a local maximum.

Step 5: Substitute the x-values of the stationary points into f(x). This will determine the y-values of each of the stationary points. We get f(1) = -2 and f(-1) = 3 So that means we have a local maximum at (-1, 3) and a local minimum at (1, -2).

Check your work the same way you did in problems 1a and 1b.


3a & 3b) Find local maximum(s) and/or minimum(s) of:

                 1
   f(x)  =             
            x2 - 2x + 2

Step 1: Determine the derivative of f(x). We do this for the same reason we did in with the other two functions. In this case you have to apply either the quotient rule or the chain rule in order to find the derivative of f(x). The method using the quotient rule is pretty obvious. Can you figure out how to take the derivative using the chain rule? Hint: Break f(x) into a composite of

            1
   g(x)  =   
            x
and another function. Either method of taking the derivative yields the same result:
                -2x + 2
   f'(x)  =                
             (x2 - 2x + 2)2

Step 2: Solve for the derivative of f(x) to be zero. Remember that f'(x) is a quotient, and quotients can be zero only at x-values where the numerator is zero and the denominator is not zero. The numerator, in this case, is -2x + 2. It is zero only at x = 1. You still have to substitute x = 1 into the denominator to make sure the denominator doesn't become zero there. And indeed it does not. So x = 1 is the one stationary point this function has.

Step 3: Determine the second derivative of f(x). This means taking the derivative of f'(x), which, as you saw above, is a quotient of two polynomials. You will definitely have to use the quotient rule to do this. You can also make good use of the chain rule to find the derivative of the denominator of f'(x). In fact, lets do that and find the derivative of the denominator before we continue. We have d(x) = (x2 - 2x + 2)2. This is the composite of g(x) = x2 and h(x) = x2 - 2x + 2.

Taking the derivatives of both of those we have g'(x) = 2x and h'(x) = 2x - 2. When we apply the chain rule to the composite, g(h(x)) we get

   d'(x)  =  g'(h(x))h'(x)  =  2h(x)h'(x)  =  2(x2 - 2x + 2)(2x - 2)
Now that we know the derivative of the denominator of f'(x), we can go on and apply the quotient rule to find the derivative of f'(x). By the rule we have:
             d(x)n'(x) - n(x)d'(x)
   f"(x)  =                         =
                     d2(x)



                      (x2 - 2x + 2)2(-2) - (-2x + 2)(2)(x2 - 2x + 2)(2x - 2)
                                                                              =
                                        (x2 - 2x + 2)4



                      -2(x2 - 2x + 2)2 - 2(-2x + 2)2(x2 - 2x + 2)
                                                                 
                                    (x2 - 2x + 2)4

Step 4: Substitute the x-value of the stationary point into f"(x) and determine if the result is positive or negative. Looks pretty nasty, this f"(x), doesn't it? But we only have to know what its value is at x = 1. Observe that the right-hand half of the numerator to this thing is multiplied by -2x + 2, which is zero at x = 1. So we can ignore the entire right-hand half of the numerator to f"(x) (for the purpose of evaluating it at x = 1 only) and we find that f"(1) = -2, which is negative. Hence, the stationary point at x = 1 is a local maximum.

Step 5: Substitute the x-value of the stationary point into f(x). This will give you the y-value of the stationary point. The original function again is:

                 1
   f(x)  =             
            x2 - 2x + 2
The x-value of the stationary point we determined to be at x = 1. You can quickly find that f(1) = 1. So the stationary point is at (1, 1), and it is a local maximum.

Check your work the same way you did in the first two problems.


Note: In our previous discussion, we talked about the difference between local and global maximums and minimums. Note that a global maximum or minimum is always also a local maximum or minimum. The reverse is not always true. In the above problem set, problems 1 and 3 had local maximums that were also, as it turns out, global (you can confirm this by graphing them). Problem 2 had a local maximum and a local minimum, but neither turns out to be global.


4) This is typical of the kind of optimization word problems that you are likely to get on an exam.

Step 1: Identify the variables. The variable to be optimized is area, A. The rectangle has height, h, and width, w. The semicircle has a radius, r. The perimeter, P, is fixed by the problem at 3 meters.

Step 2: Find the relationships among the variables. The semicircle must span the width of the rectangle. Hence its diameter must be the same as the width. And diameter is twice radius. Hence

   2r  =  w
The perimeter, P, which is a constant and not a variable, is the sum of the three sides plus the arc-length of the semicircle. Two of the sides are of length h, the other is of length w. And the arc-length of a semicircle is p times its radius. So
   P  =  3 meters  =  2h + w + pr
Finally, area, A, is the sum of the area of the rectangle and the area of the semicircle. Using familiar area formulas we get
              1
   A  =  hw +  pr2
              2

Step 3: Substitute until you have the variable to be optimized as a function of just one of the other variables. The variable to be optimized is area, A. You have area shown above as a function of three other variables. You have to get that down to a single variable. First, we can eliminate w because we have determined that 2r = w. So the perimeter equation becomes

   P  =  3 meters  =  2h + 2r + pr
and the area equation becomes
             1
   A = 2hr +  pr2
             2
Since P is a constant and not a variable, we can use the perimeter equation to eliminate another variable, say h. That is
   2h  =  P - 2r - pr
Substituting that back into the area equation, you get
                          1
   A  =  (P - 2r - pr)r +  pr2
                          2
This gives us the variable to be optimized, A, in terms of just one of the other variables.

Step 4: Simplify. Simply multiplying out and gathering like terms simplifies the above equation and makes it easier to deal with. I get

                   1
   A  =  rP - (2 +  p)r2
                   2

Step 5: Take the derivative and set it to zero. This step is at the heart of all optimization problems. You must take the derivative of the variable to be optimized with respect to the one variable you have remaining. In this case, that means taking the derivative of area, A, with respect to radius, r.

          dA
   A'  =      =  P - (4 + p)r
          dr
And now we set that derivative equal to zero.
   0  =  P - (4 + p)r

Step 6: Solve for the remaining variable. The one variable remaining is radius, r. We have a simple equation for it here that is easily solved.

           P       3 meters
   r  =         =            =  0.420074365 meters
         4 + p       4 + p

Step 7: Substitute back to find the variable(s) you eliminated earlier. Here we have

                 2P       6 meters
   w  =  2r  =         =            =  0.84014873 meters
                4 + p       4 + p
and
                                2P      pP
   2h  =  P - 2r - pr  =  P -       -      
                              4 + p   4 + p
If you put this all over a common denominator, you get
          4P + pP - 2P - pP       2P
   2h  =                     =         =  w
                4 + p           4 + p
or
         w
   h  =     =  r  =  0.420074365 meters
         2

Step 8: Determine what the optimized variable is equal to at the point of optimization. You just solved for all the independent variables to optimize the problem. In this case we solved for height, width, and radius. You have actual numbers for them now. Recall back in step 3 where you had a formula for area, A, based upon these variables? Use it now and plug in the numbers to get the actual area.

              1
   A  =  hw +  pr2  =  0.90729815 meters2
              2
And now you are done.

Summary: The main steps all optimization problems are that you first determine the independent variables (height, width, and radius in this case) and the variable to be optimized (area in this case). Then you find all the relationships you can among them. You must, in particular, find an equation that relates the variable to be optimized (area) to the independent variables (height, width, and radius). Now you have to use the relationships you have identified among the independent variables to eliminate all but one of them (we whittled it down to just radius, but you could have taken it down to either of the other two, just as long as you only have one remaining independent variable when you're done).

Then the crucial step is to write the variable to be optimized (area) in terms of the one remaining independent variable (radius). Take the derivative of that equation, and set it to zero. You are now in a position to solve for that one remaining independent variable (radius). Finally, use the relationships among the independent variables to determine the solutions for the ones you eliminated (height and width). Then plug them all back into the equation for the variable to be optimized (area) to determine its value as well.

Review these steps carefully and there will be no optimization problem that can stump you.


5) The problem is to find the point on the curve, y = x2 + x + 1, that is closest to the point (-1, 2).

Step 1: Set up a distance function. If s(x) is the distance from (-1, 2) to (x, y) (where y is defined by the quadratic function above), then by the Pythagorean formula, you have

   s2  =  (x + 1)2 + (y - 2)2  =  (x + 1)2 + (x2 + x + 1 - 2)2
Of course the 1 and the -2 combine, leaving
   s2  =  (x + 1)2 + (x2 + x - 1)2

Step 2: Multiply it out. If you multiply out the two squared summands above, you get

   s2  =  x2 + 2x + 1 + x4 + 2x3 - 2x2 + x2 - 2x + 1
and gathering like terms you have
   s2  =  x4 + 2x3 + 2
You could, if you wanted, take the square root of both sides in order to get distance, s, by itself on the left. But it is not necessary to do so. Remember the second hint? If you minimize s2, you will also minimize s.

Step 3: Take the derivative of both sides. You will have to use implicit differentiation on the left-hand side. What you get is

   2s s'  =  4x3 + 6x2

Step 4: Set the derivative to zero. And since we are setting s' to zero so that we can minimize s, that means that the expression, 2s s', will also be zero. So we have

   0  =  4x3 + 6x2

Step 5: Factor it. Clearly x2 is a factor (indicating that x = 0 is a stationary point). This leaves 4x + 6, which gets us another stationary point at x = -1.5.

Step 6: Determine which critical point in the minimum. Recall that we have determined that the critical points for s2 are at x = 0, and x = -1.5. And because distance, s, is always positive, minimizing or maximizing s2 is provides the minimum and maximum x's for s as well. But which of these x's are minimums and which are maximums? We can find this by finding the second derivative of s2. We already have

   2s s'  =  (s2)'  =  4x3 + 6x2
Taking the derivative again we get
   2(s')2 + 2s s"  =  (s2)"  =  12x2 + 12x
(Observe on the left of the above, if s' = 0, as it is at the stationary points, then the 2(s')2 term counts for nothing. And since distance, s, is always positive, the 2s s" always has the same sign as s").

If you plug in the two stationary points that you determined in the previous step -- that is x = 0, x = -1.5.

   (s2)"  =  0      at x = 0,      y = 1

   (s2)"  =  9      at x = -1.5,   y = 1.75
By the rules we discussed in the main text, this means that x = 0 cannot be determined to be either a maximum or a minimum (it is, in fact, an inflection point in the distance function, and we will be discussing inflection points in the next section). x = -1.5 is a minimum because the second derivative of the distance-squared function is positive there. So the point, (-1.5, 1.75), gives the minimum distance. By plugging x = -1.5 into the distance function, we get s2 = 0.3125. Hence s = 0.559016994.

Comments: One of the intents of this problems was to demonstrate that by minimizing or maximizing the square of a distance function, you are minimizing or maximizing the distance itself. This is because distance is always greater than or equal to zero. There are no negative distances. You could have taken the square root in step 2 to get s by itself, but you would have had to go through much more work finding its first and second derivatives, only to come up with the identical answer provided you made no mistakes.

Finally, you probably observed that you ended up having to factor a cubic in order to arrive at a solution to this problem. Like most problems that you will encounter in your homework or on an exam, this problem was rigged to come out nicely -- in this case so that the cubic would be easy to factor. And when you do encounter having to factor a cubic or quartic on a homework problem or exam, begin by assuming that the problem was rigged to make it easy to factor -- that is that the roots will be small integers or perhaps half-integers. And remember that if (ax + b) (where a and b are integers) evenly divides a polynomial, then a must evenly divide the highest power coefficient and b must evenly divide the constant coefficient. This will limit the expressions you have to try in order to factor it. If you end up after a bunch of tries not being able to factor something, go back and make sure you didn't make any mistakes arriving at the polynomial to be factored.


6) Solving this problem is much easier if you clicked to find out about the derivation of Hero's Formula. Here's another chance to do so.

Step 1: Get the formula in terms of a, b, and c alone. That is, substitute

   a + b + c
            
       2
wherever you see s. This gives
             æ a + b + c  b + c - a  a - b + c  a + b - c ö
   A  =  sqrtç                                            ÷
             è     2          2          2          2     ø
or equivalently
         1  ____________________________________________
   A  =    Ö(a + b + c)(b + c - a)(a - b + c)(a + b - c)
         4
But remember the hint. It said you could maximize the square of the area and get the same result. So
           1
   A2  =     (a + b + c)(b + c - a)(a - b + c)(a + b - c)
          16

Step 2: Multiply it out. You could just multiply it out using brute force, but the path of least resistance involves finding pairs of terms that multiply to the difference of squares. The first term is the same as ( (b + c) + a), and the second is ( (b + c) - a). If you multiply these, you get the difference of squares. That is, you get ( (b + c)2 - a2). The same trick is applicable to the second pair of terms. You have (a - (b - c) ) times (a + (b - c) ). Again, the product is a difference of squares, that is it's (a2 - (b - c)2). The final result is

   16A2  =  ( (b + c)2 - a2) (a2 - (b - c)2)
Now multiply out (b + c)2 and (b - c)2. With a little rearranging of terms, you get
   16A2  =  (2bc - (a2 - b2 - c2) )(2bc + (a2 - b2 - c2) )
which again multiplies out to the difference of squares
   16A2  =  4b2c2 - (a2 - b2 - c2)2

Step 3: Take the derivative of A with respect to a. This is so you can set it to zero and find the stationary point(s). Using the chain rule you get

                   dA
   32A A'  =  32 A     =  -4a(a2 - b2 - c2)
                   da
(Observe that because b and c were declared constant in the problem, the derivative of 4b2c2 is zero)

Step 4: Set the derivative of area equal to zero and solve for a. Setting A' to zero gives

   0  =  -4a(a2 - b2 - c2)
Clearly a = 0 is a solution, but that solution will result in an area of zero, which is by no means the maximum. The other solution is when
   a2  =  b2 + c2
According to the Pythagorean Rule, that means that side a maximizes the area of the triangle when it is chosen so that sides b and c form a right angle and side a becomes the hypotenuse.

It is quite possible that you went through all the difference of squares stuff I did here but got either

   16A2  =  4a2c2 - (b2 - a2 - c2)2
or
   16A2  =  4a2b2 - (c2 - a2 - b2)2
instead. That's ok. All three expressions are equivalent. Which means they should result in identical solutions for a. To demonstrate this, we take the derivative of the first one with respect to a
                   dA
   32A A'  =  32 A     =  8ac2 + 4a(b2 - a2 - c2)
                   da
When you set that to zero and divide out the a, you will find you get the identical solution.


7) This was an economics problem.

Step 1: Turn what you know into functions. You had a demand function that related the number of items sold per month, n, to the price, x, you charged:

   n(x)  =  40000 - 800x
You also had a monthly fixed cost of $1000, and a per item cost of $2. So your cost function will be
   c(n)  =  1000 + 2n
where n is the number sold (which we can determine from the price, x by the demand function, n(x).

Step 2: Find the revenue function. Your revenue will always be price times the number sold, so as a function of price, your revenue is:

   r(x)  =  x n(x)  =  40000x - 800x2

Step 3: Find the profit function. Profit is revenue minus cost:

   p(x)  =  r(x) - c(n(x))  =  40000x - 800x2 - (1000 + 80000 - 1600x)

   p(x)  =  -800x2 + 41600x - 81000
We obtained the above equation by substituting in the expressions we already have for r(x), c(n), and n(x).

Step 4: Take the derivative. To maximize p(x) we need to find p'(x):

   p'(x)  =  -1600x + 41600

Step 5: Maximize the profit. We find the x that maximizes p(x) by finding where p'(x) is zero. You should have no trouble solving this one, and you should get x = $26. You can find the actual monthly profit, revenue, cost, and number sold by substituting this x back into the functions, p(x), r(x), c(n(x)), and n(x) respectively. You can also check your answer to be sure it is a maximum (and not a minimum) by finding p"(x) and making sure that at your solution-x it is negative.


8) Rosie O'Donnell was swimming and needed to reach Tom Cruise on the beach in the minimum possible time. She was 50 meters off shore. Tom was 100 meters down the beach. Rosie swims 1 meter per second and runs 4 meters per second.

Step 1: Set up the problem. How are you going to identify the point on the beach to which she swims? Make a diagram. The beach is a straight line. Draw in Rosie's position in the water and Tom's position on the straight line. Now draw a line perpendicular to the beach that passes through Rosie. Where the beach and the perpendicular intersect is the origin (this is not the only way to set it up, but this is the way I'll do it here). The point on the beach to which Rosie swims is x meters down the beach from this intersection. We need to solve for x.

Step 2: What is Rosie's running time? If she swims to a position x meters down the beach and Tom is 100 meters down the beach, then she has 100 - x meters left to run in order to get to him. If she runs at 4 meters per second, then her running time, tr, is given by

          100 - x
   tr  =         
             4

Step 2: What is Rosie's swimming time? If she swims to a point that is x meters down the beach from where she is, then her swim-path is the hypotenuse of a right triangle. Use the Pythagorean distance formula to set this up. One leg of the triangle is given in the problem as 50 meters long. The other is x meters long. So her swim distance is sqrt(2500 + x2). That means her swimming time, ts, swimming at 1 meter per second, is given by

           _________
          Ö2500 + x2
   ts  =            
               1

Step 3: What is Rosie's total transit time, t? Clearly it is the sum of her running time, tr, and her swimming time, ts.

          _________            x
   t  =  Ö2500 + x2  +  25  -   
                               4

Step 4: Take the derivative of Rosie's transit time with respect to x. That is, find dt/dx. When you set dt/dx to zero, you will be able to solve for the x that minimizes t. You will have to apply the chain rule in order to take this derivative.

   dt                x         1
       =  0  =              -   
   dx           Ö2500 + x2     4

Step 5: Solve for x. You do this by multiplying the above equation through by the radical

               1  _________
   0  =  x  -    Ö2500 + x2
               4
Add one fourth of the radical to both sides
         1  _________
   x  =    Ö2500 + x2
         4
Multiply by 4, then square both sides:
   16 x2  =  2500 + x2

   15 x2  =  2500

          2500
   x2  =      
           15

          50
   x  =       =  12.090994449 meters
         Ö15
So Rosie must swim to a point that is 12.090994449 meters down the beach (toward Tom Cruise) from where she is swimming. Note that Tom could have been 1000 meters down the beach (or any other distance greater than 12.090994449 meters) and this problem would still have come out with precisely the same solution.

Now that you know how to do this one, see if you can do the following variation on it by yourself. Rosie is still swimming 50 meters off shore. But this time Tom Cruise appears on the deck of a beach house that is 100 meters down the beach and 80 meters back from the beach. Rosie can still swim 1 meter per second and run 4 meters per second. At what point on the beach should she swim for in order to minimize her transit time? Just go as far as to set the minimization equation up on this one. Don't bother to solve for x unless you're in the mood for solving a fourth degree polynomial.

For extra credit on the variation of the problem: If you recollect your trigonometry, consider the two angles, qs, which is the angle that Rosie's swimming path makes with the shore, and qr, which is the angle her running path makes with the shore. Can you find a relationship between cos(qs) and cos(qr) and the ratio of her swim speed to her run speed when her transit time is minimized? FYI this problem is identical to the problem of refraction of light in physics. The light beam passing from a medium where it goes at one speed, c1, into a second medium where it goes at a different speed, c2, will always take the path of least time. The angle at which the beam approaches the boundary from the first medium and the angle at which it departs the boundary into the second medium are related by the same equation as what you should have derived above.


Return to Main Text

email me at hahn@netsrq.com