Skip to content
Tutorials Center
My learning

Topics

Lesson 22 of 39 · Applications of Derivatives

Optimization Problems

Solve real-world optimization problems with calculus: turn words into a function of one variable, find its maximum or minimum, and verify with code.

Engineers want the strongest design for the least material. Farmers want the most land for a given amount of fence. Businesses want the highest profit. All of these are optimization problems: find the largest or smallest value of some quantity under given conditions. Calculus gives a dependable method.

The method

  1. Read and sketch. Draw a picture and label the quantities.
  2. Name the quantity to optimize (area, cost, volume, ...) and write a formula for it. It will usually have two variables.
  3. Use the constraint (a fixed amount of fence, a fixed volume) to eliminate one variable, leaving a function of a single variable.
  4. State the domain. What values make physical sense? (Lengths must be positive.)
  5. Find critical points by solving f'(x) = 0, then compare f at the critical points and at the domain's endpoints.
  6. Answer the question asked, with units, and check it is reasonable.

Example 1: the biggest rectangular pen

A farmer has 100 m of fencing and wants a rectangular pen of the greatest possible area. What dimensions should she use?

Let the sides be x and y. The constraint is the perimeter: 2x + 2y = 100, so y = 50 - x. We want to maximize A = x · y. Substitute:

Text
A(x) = x(50 - x) = 50x - x²,   domain 0 < x < 50
A'(x) = 50 - 2x = 0   ->   x = 25

Then y = 25, so the best shape is a square, with area 625 m². To confirm it is a maximum: A''(x) = -2 < 0, concave down everywhere, so x = 25 is a maximum. At the ends of the domain (x → 0 or x → 50) the area goes to zero, so it is also the absolute maximum.

Python Check the fence problem by brute force

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

This brute-force search is a useful sanity check. It agrees with the calculus answer: width 25 m, area 625 m².

Example 2: the cheapest can

A cylindrical can must hold 330 cm³ (about a soft-drink can). Which radius r and height h use the least metal? Treat the metal as the total surface area S = 2πr² + 2πrh (two circular ends plus the side).

The volume constraint is πr²h = 330, so h = 330 / (πr²). Substitute:

Text
S(r) = 2πr² + 2πr · 330/(πr²) = 2πr² + 660/r
S'(r) = 4πr - 660/r²

Setting S'(r) = 0 gives 4πr³ = 660, so r³ = 165/π and r ≈ 3.74 cm. Then h = 330 / (π r²), which equals 2r (a known result for the minimum-area cylinder: the height equals the diameter). We confirm with sympy.

Python Minimum surface area of a can

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Real cans are often a little taller than this ideal design because of manufacturing, handling and appearance, so cost is not only about the metal.

Example 3: a problem with endpoints

A closed interval requires checking the endpoints. A company's daily profit in dollars from making x units is P(x) = -2x² + 80x - 300, but the factory can only make between 0 and 15 units a day.

P'(x) = -4x + 80 = 0 gives x = 20, which is outside the domain [0, 15]. So the critical point is not allowed, and the maximum must happen at an endpoint. P(0) = -300 and P(15) = -450 + 1200 - 300 = 450. The best choice is 15 units, for a profit of $450. The calculus peak at 20 units is simply out of reach.

An optimum found by setting f' = 0 must lie inside the allowed domain. If it does not, check the endpoints.

Tips for word problems

  • Draw the picture, even for a "simple" problem.
  • Use only one variable before you differentiate.
  • If the variable is a length, remember that it must be positive.
  • Verify that your answer is a maximum or minimum, using the first or second derivative test.
  • Write a sentence answering the original question.
Python Optimization helper: maximize any function on an interval

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What is the first thing to do with the constraint equation in an optimization problem?

    The constraint lets you rewrite the objective as a function of one variable, which you can then differentiate.
  2. 2. A rectangle has perimeter 40 m. What is its largest possible area?

    The best rectangle is a square with side 10 m, so the area is 100 m².
  3. 3. On [0, 15], P'(x) = 0 only at x = 20. Where is the maximum of P?

    x = 20 is outside the domain, so a continuous function on [0, 15] has its maximum at a critical point inside the interval or at an endpoint. There are no critical points inside, so it is at an endpoint.
  4. 4. Why should you check the second derivative (or sign changes) after finding f'(x) = 0?

    A critical point might be a maximum, a minimum or neither. The tests tell you which.

Summary

  • Turn the problem into a function of one variable using the constraint.
  • State the domain, find critical points, and compare values at critical points and endpoints.
  • Verify the nature of the optimum and answer in words with units.
  • Brute-force numeric search is a handy independent check.

Next: Newton's Method