Skip to content
Tutorials Center
My learning

Topics

Lesson 38 of 39 · Projects and Practice

Project: Design the Best Can

A hands-on optimization project: find the cheapest cylindrical can for a fixed volume, with different material costs, using calculus and numerical checks.

In this project you will design a cylindrical can that holds a fixed volume at the lowest possible cost. You will use derivatives, a numerical search and a plot, and you will see how a changed assumption (different material prices) changes the best shape. The numbers are invented for the exercise; real factory costs also include printing, seams, shipping and shelf space.

Step 1: the model

A can is a cylinder with radius r (cm) and height h (cm). It must hold V = 330 cm³ (330 mL). The two circular ends together have area 2πr². The side has area 2πrh.

Suppose the ends are made from thicker metal that costs a per cm², and the side costs b per cm². The material cost is

Text
C = a · 2πr² + b · 2πrh

The volume constraint πr²h = V lets us write h = V/(πr²). Substitute:

Text
C(r) = 2πa r² + 2bV / r

Step 2: calculus

Differentiate: C'(r) = 4πa r - 2bV / r². Setting it to zero gives

Text
r³ = bV / (2πa)

The second derivative C''(r) = 4πa + 4bV/r³ is positive for r > 0, so this is a minimum.

Then h = V/(πr²). Substituting V = 2πa r³ / b shows the surprisingly simple result

Text
h / r = 2a / b

If the ends and the side cost the same (a = b), then h = 2r: the height equals the diameter. If the ends cost twice as much (a = 2b), the best can is taller and thinner: h = 4r.

Python Optimal can for any prices

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.

Step 3: check by brute force

Never trust a single method. Search over many radii and see which one is cheapest.

Python Brute-force search for the cheapest radius

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.

Step 4: see the cost curve

The plot shows cost against radius for three price settings. Each curve has a single lowest point, and the minimum is wide and flat. This explains why real cans may deviate a little from the mathematical optimum with very small cost penalties.

Python Cost curves

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.

Your tasks

  1. Derive the formula r³ = bV/(2πa) yourself, starting from the cost function.
  2. Compute the best can for V = 500 cm³ with a = b. How do the radius and height compare with the 330 cm³ can?
  3. Real cans must also include a lip. Suppose each end needs an extra ring of 1 mm around its circumference, effectively using area π(r + 0.1)² for each end. Modify the cost function in the code, search numerically and see how the best radius changes. (Hint: use a numeric search; the calculus gets messier.)
  4. Measure a real can at home (radius and height in cm). How does its h/r ratio compare with the optimum? Why might designers choose differently (grip, stacking, shelf space, cost of printing)?
  5. Write one paragraph that explains, to a classmate, why the best shape depends on the ratio of the prices.

Optimization in practice often balances several goals at once. The mathematical optimum is a starting point for design, not the last word.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. If the ends and the side cost the same per cm², the cheapest can for a given volume has

    With a = b the ratio h/r = 2a/b = 2, so the height equals the diameter.
  2. 2. If the ends cost twice as much as the side (a = 2b), the best can is

    h/r = 2a/b = 4: expensive ends mean you want less end area, hence a thinner can.
  3. 3. Why do we substitute h = V/(πr²) into the cost?

    The constraint lets us eliminate h so we can differentiate with respect to r alone.
  4. 4. A brute-force search that agrees with the calculus answer

    Two independent methods agreeing is a strong check against algebra mistakes.

Summary

  • Model: cost C(r) = 2πa r² + 2bV/r after using the volume constraint.
  • The minimum is at r³ = bV/(2πa), and h/r = 2a/b.
  • Verify with a brute-force search and a plot.
  • Changing the assumptions (prices, lips, shipping) changes the best design.

Next: Project: A Falling Object with Air Resistance