Start the course

Applications

How to solve optimization problems in calculus

8 min readUpdated

Quick answer

To solve an optimization problem, write the quantity to make largest or smallest (the objective) as a formula, use the problem's condition (the constraint) to rewrite it in terms of one variable, and find that variable's sensible range. Then find the critical numbers and compare the objective's values there and at the endpoints. Answer the question that was asked, with units.

Key points
  • Every optimization problem has an objective (what to maximize or minimize) and a constraint (a fixed condition).
  • Use the constraint to write the objective in terms of a single variable before differentiating.
  • Find the domain: the values of the variable that make physical sense.
  • Compare the critical numbers with the endpoints; with no endpoints, a single critical number that is a local max or min is the absolute one.

What is an optimization problem?

Optimization means finding the best possible value: the largest area a fence can enclose, the least material that makes a can, the shortest route, the greatest profit. Mathematically, these are problems about the absolute maximum or minimum of a function. The calculus part is short; the real skill is turning the words into the right function.

Two words help organize every problem. The objective is the quantity you want to make as large or as small as possible. The constraint is a condition that can't change, such as a fixed length of fence or a fixed volume. The constraint is what links the variables together.

What are the steps for solving optimization problems?

  1. Understand and picture. Read carefully, and draw a diagram if there is any geometry.
  2. Name the quantities with letters, and decide which quantity is the objective.
  3. Write the objective as a formula. It may involve two or more variables at first.
  4. Use the constraint to write the objective in terms of one variable.
  5. Find the domain: which values of that variable make sense? Lengths can't be negative, for example.
  6. Find the absolute maximum or minimum on the domain: find the critical numbers, and compare the objective's values there and at the endpoints.
  7. Answer the question that was asked, with units. If it asks for dimensions, give dimensions, not just the area.

How do you maximize area with a fixed perimeter?

Worked example: The largest rectangle

You have 200 m of fence to enclose a rectangular garden. What dimensions give the largest area?

  1. Name. Let the sides be x and y meters. Objective: the area A=xy.
  2. Constraint. All four sides use the fence: 2x+2y=200, so x+y=100 and y=100−x.
  3. One variable. A(x)= x(100−x)= 100x−x2.
  4. Domain. Both sides must be at least 0: 0≤x≤100.
  5. Critical numbers. A′(x)=100−2x=0 gives x=50.
  6. Compare. A(0)=0, A(50)= 50⋅50= 2500, A(100)=0. The largest is 2500, at x=50, which makes y=100−50=50.

Answer: A 50 m by 50 m square, with area 2500 m².

How do you solve the open box problem?

Worked example: The largest open box

An open-topped box is made from a 12 in by 12 in sheet of cardboard by cutting equal squares from the corners and folding up the sides. What size of square gives the largest volume?

  1. Name. Let x be the side of each cut square, in inches. Folding up gives a box x high with a square base of side 12−2x (each edge loses x at both ends).
  2. Objective. Volume = base area × height: V(x)=(12−2x)2x.
  3. Domain. The cut can't be negative, and two cuts can't exceed 12: 0≤x≤6.
  4. Differentiate with the product rule: V′(x)= (12−2x)2⋅1+x⋅2(12−2x)(− 2).
  5. Factor out (12−2x): V′(x)= (12−2x)[(12−2x)−4x]= (12−2x)(12−6x).
  6. Critical numbers: 12−2x=0 gives x=6 (an endpoint), and 12−6x=0 gives x=2.
  7. Compare. V(0)=0, V(6)=0, and V(2)= (12−4)2⋅2= 64⋅2= 128.

Answer: Cut 2 in squares; the box is 8 in by 8 in by 2 in, with volume 128 in³.

123456255075100125largest: V(2) = 128V = 0 at the ends
The volume V(x)=x(12−2x)2 for cuts from 0 to 6 inches: zero at both ends, largest at x=2.
Common mistake

Differentiating before reducing to one variable. In the box problem, V= (base side)2×height has two unknowns; the cut size x determines both, so write everything in terms of x first.

What if there are no endpoints?

Sometimes the domain is an open interval, such as all r>0, so there are no endpoints to compare. Then this fact settles it:

One critical number
If f is continuous on an interval and has only one critical number there, and that critical number is a local minimum (or maximum), then it is the absolute minimum (or maximum) on the interval.
Why it works
  1. Suppose the single critical number c is a local minimum, but some other point d had a smaller value.
  2. Going from c toward d, the graph first rises (since c is a local minimum) and must later come back down below f(c).
  3. Turning from rising to falling would need a local maximum in between, which would be a second critical number. That's impossible, so f(c) is the smallest value.
Worked example: The cheapest can

A cylindrical can must hold 1000 cm³. What radius and height use the least metal (the smallest surface area, including top and bottom)?

  1. Name. Radius r, height h, in cm. Objective: surface area S=2πr2+2πrh (two circles plus the side, which unrolls into a rectangle 2πr by h).
  2. Constraint. Volume πr2h=1000, so h= 1000πr2.
  3. One variable. S(r)= 2πr2+2πr⋅1000πr2= 2πr2+2000r, for r>0 (no endpoints).
  4. Critical number. S′(r)= 4πr−2000r2= 0 gives 4πr3=2000, so r3=500π and r= 500/π3≈5.42.
  5. Check it's a minimum. S″(r)= 4π+4000r3>0 for r>0, so it's a local minimum, and as the only critical number it's the absolute minimum.
  6. Height. h= 1000πr2. Since πr3=500, this is 1000πr3⋅r= 1000500r= 2r≈10.84.

Answer: Radius about 5.42 cm and height about 10.84 cm: the height equals the diameter.

How do you find the shortest distance to a curve?

Distance involves a square root, which makes the derivative messy. A useful trick: the distance is smallest exactly where the distance squared is smallest, so minimize that instead.

Worked example: Closest point on a parabola

Find the points on y=x2 closest to the point (0,2).

  1. A point on the curve is (x,x2). Its distance squared from (0,2) is D(x)=x2+(x2−2)2.
  2. Multiply out: D(x)= x2+x4−4x2+4= x4−3x2+4.
  3. D′(x)= 4x3−6x= 2x(2x2−3), which is 0 at x=0 and x=±3/2.
  4. Compare: D(0)=4, and D(±3/2)= 94−92+4= 74. As x→±∞, D grows without bound, so the smallest value is 74.
  5. At x=±3/2, y=x2=32.

Answer: The closest points are (±3/2, 32), at distance 7/4= 72≈1.32.

What are the most common mistakes in optimization problems?

  • Skipping the domain and then reporting a critical number that makes no physical sense, like a negative length.
  • Forgetting the endpoints, which can give the true maximum or minimum.
  • Not checking that a critical number is a maximum (or minimum) rather than the opposite.
  • Answering a different question: giving the area when the problem asked for the dimensions.
Tip

If a problem asks how fast something is changing at one moment rather than for the best possible value, it's a related rates problem instead.

Learn it step by step

The full lessons in the course explain this from the ground up, with graphs, worked examples, and practice problems that each have a complete worked solution.

Open the lesson

Frequently asked questions

What is the first step in an optimization problem?

Read the problem, draw a picture, and name the quantities. Then identify the objective (what to maximize or minimize) and the constraint (the fixed condition).

Why do you need a constraint?

The objective usually involves two variables, and calculus here needs one. The constraint links them, so you can write one in terms of the other.

How do you know if you've found a maximum or a minimum?

Compare the objective's values at the critical numbers and endpoints, or use the first or second derivative test. With one critical number and no endpoints, a local max or min is the absolute one.

Do I need to check the endpoints?

Yes, whenever the domain is a closed interval. The largest or smallest value can be at an endpoint, where the derivative needn't be zero.

Why minimize distance squared instead of distance?

Because squaring doesn't change which point is closest (for positive distances, a smaller distance means a smaller square), and it removes the square root, making the derivative much simpler.