Optimization
Optimization problems use derivatives to find the largest or smallest value of a real quantity, such as the greatest area, the least cost or the shortest distance. Write the quantity as a function of one variable, find its domain, find the critical points, and check which one gives the maximum or minimum.
Before this lesson: Absolute Extrema, Second Derivative Test and Literal Equations
The idea behind optimization
Every optimization problem has two parts. The objective function is the quantity you want to make as large or as small as possible. The constraint is an equation that limits your choices, like a fixed amount of fencing or a required volume.
You use the constraint to write the objective function in terms of just one variable. Then it is an absolute extrema problem: find the critical points and compare.
How to solve optimization problems
- Read the problem and draw a picture. Label the quantities with variables.
- Write the objective function: the formula for the quantity to maximize or minimize.
- Write the constraint, solve it for one variable, and substitute it into the objective function.
- Find the domain: the values that make sense in the problem.
- Differentiate, set the derivative equal to 0, and solve.
- Check that you have a max or min: compare the endpoints (closed interval) or use the second derivative test.
- Answer the question that was asked, with units.
Optimization examples
Example 1: Fencing along a river
A farmer has 240 m of fencing to make a rectangular field along a straight river. No fence is needed along the river. What dimensions give the largest area?
2x + y = 240
Let x = each side perpendicular to the river and y = the side parallel to it. The fence covers x + x + y.
y = 240 - 2x
Solve the constraint for y.
A(x) = x(240 - 2x) = 240x - 2x^2
Area = x · y, in one variable. Domain: 0 ≤ x ≤ 120.
A'(x) = 240 - 4x = 0 \Rightarrow x = 60
Set the derivative equal to 0.
A(0) = 0, \; A(60) = 7200, \; A(120) = 0
Compare with the endpoints.
y = 240 - 2(60) = 120
Find the other side.
Answer: 60 m by 120 m (with the 120-m side along the river), for an area of 7,200 m².
Example 2: An open box
An open box is made from a 12-in. by 12-in. square sheet by cutting equal squares of side x from the corners and folding up the sides. What value of x gives the largest volume?
V(x) = x(12 - 2x)^2
The base is (12 − 2x) by (12 − 2x) and the height is x. Domain: 0 ≤ x ≤ 6.
V'(x) = (12 - 2x)^2 + x \cdot 2(12 - 2x)(-2)
Product rule, with the chain rule on the square.
V'(x) = (12 - 2x)(12 - 2x - 4x) = (12 - 2x)(12 - 6x)
Factor out (12 − 2x).
x = 6 \text{ or } x = 2Set each factor equal to 0.
V(0) = 0, \; V(2) = 2(8)^2 = 128, \; V(6) = 0
Compare the candidates.
Answer: cut 2-in. squares. The box is 8 in. by 8 in. by 2 in., with volume 128 in³.
Example 3: The cheapest can
A can (a closed cylinder) must hold 500 cm³. What radius uses the least metal?
\pi r^2 h = 500 \Rightarrow h = \frac{500}{\pi r^2}The constraint is the volume. Solve for h.
S = 2\pi r^2 + 2\pi rh
Surface area: top and bottom plus the side.
S(r) = 2\pi r^2 + \frac{1000}{r}Substitute h: 2πr · 500/(πr²) = 1000/r. Domain: r \gt 0.
S'(r) = 4\pi r - \frac{1000}{r^2} = 0Differentiate and set equal to 0.
r^3 = \frac{1000}{4\pi} = \frac{250}{\pi}Multiply both sides by r² and divide by 4π.
r = \sqrt[3]{\frac{250}{\pi}} \approx 4.30Take the cube root.
S''(r) = 4\pi + \frac{2000}{r^3} \gt 0Second derivative test: positive, so a minimum.
h = \frac{500}{\pi(4.30)^2} \approx 8.60Find the height.
Answer: a radius of about 4.30 cm (height about 8.60 cm). The best can is as tall as it is wide: h = 2r.
Example 4: The closest point on a curve
Find the point on the curve y = \sqrt{x} closest to the point (3, 0).
D^2 = (x - 3)^2 + (\sqrt{x} - 0)^2Distance formula squared (see distance formula). Minimizing D² also minimizes D.
D^2 = x^2 - 6x + 9 + x = x^2 - 5x + 9
Expand and combine like terms.
\frac{d}{dx}\left[D^2\right] = 2x - 5 = 0 \Rightarrow x = 2.5Differentiate and set equal to 0.
y = \sqrt{2.5} \approx 1.581Find the y-coordinate.
D = \sqrt{6.25 - 12.5 + 9} = \sqrt{2.75} \approx 1.658The smallest distance. The second derivative 2 is positive, so it is a minimum.
Answer: the closest point is (2.5, √2.5) ≈ (2.5, 1.581), about 1.658 units away.
Example 5: Setting a ticket price
A theater sells 400 tickets at $20 each. For every $1 increase in price, it sells 10 fewer tickets. What price gives the most revenue?
R(x) = (20 + x)(400 - 10x)
Let x = the number of $1 increases. Revenue = price × tickets.
R(x) = 8000 + 200x - 10x^2
Multiply the binomials (see multiplying binomials).
R'(x) = 200 - 20x = 0 \Rightarrow x = 10
Differentiate and set equal to 0.
R''(x) = -20 \lt 0
Negative: a maximum.
R(10) = (30)(300) = 9000
Price $30, 300 tickets.
Answer: charge $30 per ticket, for a revenue of $9,000 (300 tickets).
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Differentiating before using the constraint | Differentiating A = xy with two variables | Substitute the constraint first so A depends on one variable. |
| Ignoring the domain | Keeping x = 6 in the box problem as the answer | x = 6 makes the volume 0. Check that the answer makes sense. |
| Not checking max vs. min | Assuming a critical point is a maximum | Compare endpoints or use the second derivative test. |
| Answering the wrong question | Giving x = 10 when the problem asks for the price | Reread the question: the price is 20 + x = $30. |
| Forgetting units | “The area is 7200” | Include units: 7,200 m². |
Related methods
Minimizing distance
Distance has a square root, which makes the derivative messy. Since D is smallest exactly when D² is smallest, minimize D² instead, as in Example 4.
Business optimization
Profit is P(x) = R(x) − C(x). At the maximum profit, P′(x) = 0, so R′(x) = C′(x): the marginal revenue equals the marginal cost.
Practice problems
- Find two positive numbers whose sum is 20 and whose product is as large as possible.
- Find the largest area of a rectangle with perimeter 40 cm.
- Find the smallest perimeter of a rectangle with area 64 m².
- A farmer has 600 ft of fencing to make a rectangular pen split into two equal parts by a fence parallel to one side. Find the largest total area.
- An open box with a square base must hold 32 ft³. Find the dimensions that use the least material.
- Find two positive numbers whose product is 36 and whose sum is as small as possible.
- Find the point on the line y = 2x + 1 closest to the origin.
- A rectangle has its base on the x-axis and its upper corners on y = 12 - x^2. Find its largest area.
- A rectangular field of 1,800 m² is fenced. One side costs $10 per meter and the other three cost $5 per meter. Find the dimensions with the lowest cost.
- A company’s revenue is R(x) = 50x - 0.1x^2 and its cost is C(x) = 10x + 1000 dollars for x items. Find the maximum profit.
Show answers
1.
P(x) = x(20 - x) = 20x - x^2
The numbers are x and 20 − x.
P'(x) = 20 - 2x = 0 \Rightarrow x = 10
P″ = −2 is negative: a max.
Answer: 10 and 10, with product 100
2.
2x + 2y = 40 \Rightarrow y = 20 - x
Constraint.
A(x) = x(20 - x), \; A'(x) = 20 - 2x = 0
x = 10; A″ = −2: a max.
Answer: a 10-cm by 10-cm square, with area 100 cm²
3.
P(x) = 2x + \frac{128}{x}With y = 64/x, the perimeter is 2x + 2(64/x).
P'(x) = 2 - \frac{128}{x^2} = 0 \Rightarrow x^2 = 64x = 8, since x \gt 0.
P''(8) = \frac{256}{512} \gt 0Positive: a min.
Answer: an 8-m by 8-m square, with perimeter 32 m
4.
3x + 2y = 600 \Rightarrow y = 300 - 1.5x
Three fences of length x (two sides and the divider) and two of length y.
A(x) = x(300 - 1.5x) = 300x - 1.5x^2
Total area.
A'(x) = 300 - 3x = 0 \Rightarrow x = 100
A″ = −3: a max.
y = 300 - 150 = 150, \; A = 15{,}000Find y and the area.
Answer: 100 ft by 150 ft, total area 15,000 ft²
5.
x^2h = 32 \Rightarrow h = \frac{32}{x^2}Volume constraint.
S(x) = x^2 + 4xh = x^2 + \frac{128}{x}Base plus four sides.
S'(x) = 2x - \frac{128}{x^2} = 0 \Rightarrow x^3 = 64x = 4.
h = \frac{32}{16} = 2, \; S = 16 + 32 = 48S″ = 2 + 256/x³ is positive: a min.
Answer: base 4 ft by 4 ft, height 2 ft (48 ft² of material)
6.
S(x) = x + \frac{36}{x}The numbers are x and 36/x.
S'(x) = 1 - \frac{36}{x^2} = 0 \Rightarrow x = 6S″ = 72/x³ is positive: a min.
Answer: 6 and 6, with sum 12
7.
D^2 = x^2 + (2x + 1)^2 = 5x^2 + 4x + 1
Distance squared from (0, 0).
10x + 4 = 0 \Rightarrow x = -0.4
Differentiate and set equal to 0.
y = 2(-0.4) + 1 = 0.2
The point on the line.
Answer: (−0.4, 0.2), at distance √0.2 ≈ 0.447
8.
A(x) = 2x(12 - x^2) = 24x - 2x^3
Width 2x, height 12 − x². Domain: 0 ≤ x ≤ √12.
A'(x) = 24 - 6x^2 = 0 \Rightarrow x = 2
Positive root.
A(2) = 4(8) = 32
The endpoints give area 0.
Answer: 32 square units (a 4-by-8 rectangle)
9.
C(x) = 10x + 5x + 5(2y) = 15x + \frac{18000}{x}x = the $10 side; y = 1800/x, so 10y = 18000/x.
C'(x) = 15 - \frac{18000}{x^2} = 0 \Rightarrow x^2 = 1200Differentiate and solve.
x = 20\sqrt{3} \approx 34.64, \; y \approx 51.96C″ = 36000/x³ is positive: a min.
Answer: about 34.64 m (the $10 side) by 51.96 m, costing about $1,039.23
10.
P(x) = 50x - 0.1x^2 - 10x - 1000 = 40x - 0.1x^2 - 1000
Profit = R − C.
P'(x) = 40 - 0.2x = 0 \Rightarrow x = 200
P″ = −0.2: a max.
P(200) = 8000 - 4000 - 1000 = 3000
Substitute.
Answer: $3,000, at 200 items
Optimization FAQ
What are the steps for solving optimization problems?
Draw and label, write the objective function, use the constraint to get one variable, find the domain, set the derivative equal to 0, check for a max or min, and answer the question.
How do you know if you found a maximum or a minimum?
On a closed interval, compare f at the critical points and endpoints. Otherwise use the second derivative test, or the first derivative test.
What is the constraint in an optimization problem?
It is the condition that limits your choices, such as a fixed perimeter, volume or budget. You use it to remove one variable.
Why minimize the distance squared?
The square root makes the derivative harder, and D is smallest exactly where D² is smallest, so minimizing D² gives the same point.
Summary
- Identify the objective function and the constraint.
- Use the constraint to write the objective in one variable, and find its domain.
- Set the derivative equal to 0 and solve.
- Confirm a max or min with endpoints or the second derivative test.
- Answer the question asked, with units.
Previous lesson: Curve Sketching
Next lesson: Newton’s Method
Back to the Calculus 1 Index