Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 46 ยท Optimization Models

Calculus and design: finding the best single choice

Learn the calculus recipe for optimization: write one objective, eliminate the constraint, set the derivative to zero and check the result with worked design examples.

When you have one or two quantities to choose and a smooth formula for what you want, calculus is the fastest route to the best answer. At the top of a hill the ground is flat, so the slope is zero. That single observation, plus a little care about edges, solves a surprising range of design problems: the cheapest container, the most profitable price, the fastest route. In this lesson you will build a reusable recipe and apply it three times.

A U-shaped curve of surface area against radius for a 330 cubic centimetre cylinder with the minimum at radius 3.74 cm, next to a drawing of the can whose height equals its diameter.
The surface area of a can of fixed volume has a single lowest point, where the derivative is zero.

What you will learn

  • A five-step recipe for single-variable optimization.
  • How to use a constraint to reduce two variables to one.
  • How to confirm a maximum or minimum with the second derivative and the endpoints.
  • Why the best can has a height equal to its diameter, and why real cans differ.

Key terms

Critical point: a value where the derivative is zero (or undefined) and so may be a maximum or minimum.

Second-derivative test: if fโ€ฒ(x) = 0 and fโ€ณ(x) > 0 the point is a local minimum; if fโ€ณ(x) < 0 it is a local maximum.

Elimination: using a constraint to express one variable in terms of another.

Marginal analysis: studying the change in an outcome from one extra unit of a choice.

The recipe

  1. Draw and name. Sketch the situation and define the variables, with units.
  2. Write the objective as a formula in those variables.
  3. Use the constraint to eliminate variables until only one remains.
  4. Differentiate and solve fโ€ฒ(x) = 0.
  5. Check. Use the second derivative or compare values; compare also with the endpoints of the allowed range; then ask whether the answer is realistic.

Example 1: the river fence

A farmer has 100 m of fencing and builds a rectangular pen against a straight river, so only three sides need fence. Let x be the length of each side perpendicular to the river. The side parallel to the river is 100 โˆ’ 2x. The area is

A(x) = x ยท (100 โˆ’ 2x) = 100x โˆ’ 2xยฒ, with 0 โ‰ค x โ‰ค 50.

Aโ€ฒ(x) = 100 โˆ’ 4x = 0 gives x = 25. Aโ€ณ = โˆ’4 < 0, so it is a maximum. The pen is 25 m by 50 m with area 1,250 mยฒ. At the endpoints x = 0 and x = 50 the area is zero, so the interior critical point wins. Interesting detail: the side along the river is twice the others.

Example 2: the cheapest can

A cylindrical can must hold V = 330 cmยณ. Metal costs the same everywhere, so minimize the surface area. Variables: radius r and height h.

  • Objective: A = 2ฯ€rยฒ + 2ฯ€rยทh (two circular ends and the side).
  • Constraint: ฯ€ rยฒ h = V, so h = V/(ฯ€ rยฒ).
  • Eliminate: A(r) = 2ฯ€rยฒ + 2V/r.

Aโ€ฒ(r) = 4ฯ€r โˆ’ 2V/rยฒ = 0 gives rยณ = V/(2ฯ€), so r = (V/2ฯ€)^(1/3). With V = 330, r โ‰ˆ 3.74 cm, h = V/(ฯ€rยฒ) โ‰ˆ 7.49 cm, and A โ‰ˆ 264 cmยฒ. The second derivative Aโ€ณ = 4ฯ€ + 4V/rยณ is positive, so it is a minimum.

Look at the ratio: h = V/(ฯ€ rยฒ) = 2ฯ€ rยณ/(ฯ€ rยฒ) = 2r. The ideal can is as tall as it is wide. That is a result for any volume, because the volume cancels out of the ratio.

Why are real cans usually taller and thinner? The model left things out: the lid and base may use thicker metal than the wall, the seams cost material and labour, a taller can is easier to hold with one hand, and it fits shelves and vending machines. When your model and reality disagree, it is a signal to revise the model, as you will see in the modelling cycle.

Example 3: the best ticket price

A theatre sells q = 400 โˆ’ 8p tickets when the price is p dollars. Each ticket costs the theatre 5 dollars to serve. Profit is P(p) = (p โˆ’ 5)(400 โˆ’ 8p). Expand: P = โˆ’8pยฒ + 440p โˆ’ 2000. Pโ€ฒ = โˆ’16p + 440 = 0 gives p = 27.5. Then q = 400 โˆ’ 220 = 180 tickets and P = 22.5 ร— 180 = 4,050 dollars. Compare with maximizing revenue alone: R = p(400 โˆ’ 8p) peaks at p = 25. Adding the cost per ticket pushes the best price higher, because each lost customer saves a cost as well as a sale.

Python Derive the can with symbolic algebra

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.

Common misconceptions

"Setting the derivative to zero always gives the maximum." It gives candidates. Some are minima, some are neither (like x = 0 for xยณ), and the true optimum can sit at an endpoint.

"The optimum is the same when the objective changes slightly." Maximizing revenue gave a price of 25 and maximizing profit gave 27.5. A small change in the goal moved the answer.

"Calculus gives the best design." It gives the best design for your formula. If the formula leaves out a cost, the answer will too.

Ticket prices and the sensitivity of the answer

How much does it matter if we get the price slightly wrong? Near the top of a smooth curve the function is flat, so being off by a little costs very little. This is a general comfort of optimization: small errors in the choice often cost little, while large errors cost a lot. The next demo draws revenue and profit and measures the loss from a 10 percent pricing error.

Python Revenue, profit and a pricing mistake

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.

Explore the can

Move the radius. The volume stays fixed at 330 cmยณ, so the height must change, and the surface area (the metal you pay for) changes with it.

Can radius slider

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. A farmer has 100 m of fence for three sides of a pen against a river. What is the largest possible area?

    A = x(100 - 2x) peaks at x = 25 with area 25 * 50 = 1,250.
  2. 2. For a can of fixed volume with minimum surface area, how are the height and radius related?

    From A'(r) = 0 we get r^3 = V/(2 pi), so h = V/(pi r^2) = 2r.
  3. 3. After finding f'(x) = 0, what should you do next?

    A critical point may be a maximum, a minimum or neither, and the optimum may be at an endpoint.
  4. 4. Demand is q = 400 - 8p and each ticket costs 5 dollars to serve. Why is the best price higher than the revenue-maximizing price of 25?

    Selling one fewer ticket saves its cost, which shifts the profit-maximizing price upward to 27.50.

Summary

  • Recipe: define variables, write the objective, use the constraint, solve fโ€ฒ = 0, check.
  • The river pen is best at 25 m by 50 m; the can is best with h = 2r.
  • Maximizing profit and maximizing revenue are different problems with different answers.
  • Calculus optimizes your formula; revise the model if the answer looks wrong in the real world.

Next: Linear programming models