On this concept: Formula

Not sure which lesson to do first? Find your level and get a plan →

Math · Introduction to Calculus · Grade 9-12

Optimization

Optimization finds the largest or smallest value of a function by using the fact that at a smooth peak or valley the slope is zero.

Find critical points by solving f′(x)=0. Second derivative test: if f′′(c)<0, local max; if f′′(c)>0, local min.

Quick Answer

Optimization finds the largest or smallest value of a function by using the fact that at a smooth peak or valley the slope is zero. Use it for any maximize-or-minimize question once the quantity can be written as a function of one variable: the largest area for a given fence, the can that uses the least metal, the ticket price that brings in the most money. Solve f′(x)=0 for the critical points, classify each as a peak or a valley, and on a closed interval compare the endpoints too.

Why This Matters

Optimization turns "what is best?" into a calculation. A can maker can find the shape that uses the least metal, a theatre the price that earns the most, a delivery service the fastest route. Skip the classification and you can report a minimum when the question wanted a maximum; ignore the endpoints and you can miss the true best value entirely.

Intuitive Explanation

With 20 m of fence for a rectangle, a 1×9 pen has area 9, a 3×7 pen 21, a 5×5 pen 25 and a 7×3 pen 21 again. The area rises, peaks and falls. Write it as a function of one side: if one side is x, the other is 10−x, so A(x)=x(10−x)=10x−x2. At the peak the graph is flat for an instant: just before it the area is increasing, just after it the area is decreasing, so the slope changes from positive to negative and passes through zero.

That gives the method. Solve A′(x)=10−2x=0 to get x=5. Then classify: A′′(x)=−2<0, so the graph bends downward and x=5 is a peak. The best pen is the 5×5 square, 25 m². In word problems most of the work is the setup: using the constraint (perimeter 20) to turn a quantity with two variables into a function of one.

A zero slope does not guarantee a maximum, or even an extreme value. f(x)=x3 has f′(0)=0, yet it keeps rising on both sides: the graph only pauses. The best value can also sit at an end of the allowed range. On 0≤x≤3, g(x)=x2−2x has its only critical point at x=1, and that is the minimum, g(1)=−1; the maximum, g(3)=3, is at an endpoint where the slope is not zero.

Think of it like this. Hiking a ridge in fog, you know you are at a summit or the bottom of a dip when the path goes level, so level ground is where to look. But a level spot can also be a flat ledge partway up a climb, and the hike's highest point might be where the trail ends at a cliff. So check every level spot and both ends.

Core idea. Optimization uses derivatives to find a function's maxima and minima by locating where f′(x)=0 and classifying them.


When to Use

Use optimization when a problem asks for the largest, smallest, most or least of something, or the best choice, and the quantity can be written as a function of one variable after using a constraint such as a fixed perimeter, volume or budget. Then solve f′(x)=0, classify each critical point, and check endpoints on a closed interval. If the question asks where a function equals zero, solve f(x)=0 instead. If it asks how fast one quantity changes as another changes over time, that is related rates.

Tip. Ask: Am I seeking an extreme value by finding where the slope is zero and then classifying it?

How to Recognize It

Look for one quantity to make as large or as small as possible, and for a fixed condition that ties the other quantities to it.

  1. Does the question ask when or where a quantity reaches zero, such as when a loan is paid off?

    Yes means finding roots, solving f(x)=0, not optimization. Optimization solves f′(x)=0, because a smooth peak or valley is where the graph levels off, which is usually not where it meets the axis.

  2. Is there a fixed amount linking the variables, such as 100 m of fence or a can that must hold 500 mL?

    Yes means use it to rewrite the target as a function of one variable before differentiating. If several quantities change with time and you need one of their rates, it is related rates instead.

  3. Are there physical limits on the variable, such as a side length between 0 and 50 m?

    Yes means a closed interval, so test the endpoints as well as the critical points, because the best value can sit at an edge. With no such limits, classify each critical point with the second derivative test.

Optimization compared with Solving f(x)=0 (roots), Second derivative test, and Related rates

Every row involves derivatives or zeros, so the steps blend together. Ask what the problem wants: the best value of a quantity (optimization), where a function is zero (roots), whether a critical point is a peak or valley (second derivative test), or how fast linked quantities change (related rates).

Optimization

Meaning
Use this when you must find a maximum or minimum value of a quantity that can be written as a function.
Key test
Am I seeking an extreme value by finding where the slope is zero and then classifying it?
Formula
Find critical points by solving f′(x)=0. Second derivative test: if f′′(c)<0, local max; if f′′(c)>0, local min.
Example
A rectangle has perimeter 20. What dimensions maximize its area?

Solving f(x)=0 (roots)

Meaning
Finds where the function crosses zero, not where its slope is zero.
Key test
Use when locating x-intercepts, not maxima or minima.
Formula
f(x)=0
Example
Roots of x2−4 are ±2, unrelated to its minimum

Second derivative test

Meaning
Classifies a critical point as max or min once it's found, not a separate goal.
Key test
Use after f′(c)=0 to decide concavity at c.
Formula
f′′(c)<0 max, f′′(c)>0 min
Example
f′′=2>0 confirms a minimum

Related rates

Meaning
Connects rates of change over time, not finding an extreme value.
Key test
Use when several quantities change with time and you want one rate.
Formula
dAdt=…
Example
How fast a shadow grows as someone walks

Formula & Notation

Find critical points by solving f′(x)=0. Second derivative test: if f′′(c)<0, local max; if f′′(c)>0, local min.
f has a local maximum at c if ∃δ>0:f(x)≤f(c)  ∀x∈(c−δ,c+δ). Necessary condition (Fermat's theorem): if f is differentiable at an interior extremum c, then f′(c)=0. Second derivative test: f′(c)=0∧f′′(c)<0  ⟹   local max; f′(c)=0∧f′′(c)>0  ⟹   local min.

How to read it: Critical point: c where f′(c)=0 or f′(c) is undefined. Local max/min at c.

Worked Examples

Example 1 — Maximize a rectangle's area

Easy

A rectangle has perimeter 20. What dimensions maximize its area?
Show the steps and the answer
  1. Write area in one variable: sides x and y with 2x+2y=20, so y=10−x and A(x)=x(10−x)=10x−x2.

    The perimeter is the constraint; using it to remove y leaves a function you can differentiate.

  2. Set the derivative to zero: A′(x)=10−2x=0, so x=5.

    At a smooth peak the slope is zero, so the maximum must be at a critical point or an endpoint.

  3. Classify: A′′(x)=−2<0, so x=5 is a maximum.

    A negative second derivative means the graph bends downward there, like the top of a hill.

  4. Find the other side and the area: y=10−5=5 and A=25. Compare endpoints: A(0)=A(10)=0.

    The endpoints are flattened rectangles with no area, so the interior peak is the absolute maximum.

Answer: A 5×5 square with area 25

Takeaway: Use the constraint to get one variable, set the derivative to zero, and confirm the peak with f′′<0 and the endpoints.

Example 2 — Just find a root

Standard

Where does A(x)=10x−x2 equal zero?
Show the steps and the answer
  1. Read the question: it asks where A(x) equals zero, not where it is largest.

    Zeros are where a graph meets the axis; extreme values are where its slope is zero.

  2. Factor: 10x−x2=x(10−x)=0.

    Factoring turns the equation into a product of two simple pieces.

  3. Solve: x=0 or x=10.

    A product is zero when either factor is zero.

  4. Compare with the maximum: A′(x)=0 at x=5, halfway between the roots.

    For a parabola the vertex lies midway between the zeros, but the two questions use different equations.

Answer: x=0 or x=10

Takeaway: Setting the function to zero finds intercepts; setting the derivative to zero finds candidates for extremes.

Example 3 — Find the mistake: the endpoint wins

Application

A company's profit from selling x hundred units, for 0≤x≤6, is P(x)=x3−9x2+24x thousand dollars. Dana solves P′(x)=3x2−18x+24=0, gets x=2 or x=4, and writes: "The maximum profit is P(2)=20 thousand dollars." Find the mistake and correct it.
Show the steps and the answer
  1. Verify the critical points: 3x2−18x+24=3(x−2)(x−4)=0, so x=2 or x=4.

    Dana's algebra is right; the gap is in what she checked afterwards.

  2. Classify with P′′(x)=6x−18: P′′(2)=−6<0 (local max) and P′′(4)=6>0 (local min).

    A local maximum is only the highest point nearby, not necessarily on the whole interval.

  3. Evaluate the candidates and both endpoints: P(0)=0, P(2)=8−36+48=20, P(4)=64−144+96=16, P(6)=216−324+144=36.

    On a closed interval the absolute maximum is the largest of these values.

  4. Pick the largest: P(6)=36.

    Profit dips after x=2, climbs again past x=4, and ends highest at the endpoint, where P′(6)=24 is not zero.

Answer: The maximum profit is $36 thousand, at x=6 (600 units), not $20 thousand at x=2.

Takeaway: On a closed interval, compare every critical point with both endpoints; a local maximum can lose to an endpoint.

Where You'll See It

  • Designing a drink can

    A 355 mL can of radius r cm has surface area S=2πr2+710r. Setting S′=4πr−710r2=0 gives r≈3.84 cm and a height of about 7.7 cm, twice the radius. Real cans are taller and thinner, about 3.3 cm by 12.2 cm, because thicker lids and a comfortable grip also count.

  • Pricing theatre tickets

    A theatre sells 300 tickets at $20 and loses 10 sales for each $1 increase. Revenue at a price of 20+x dollars is R(x)=(20+x)(300−10x), and R′(x)=100−20x=0 at x=5. At $25 it sells 250 tickets for $6,250, more than the $6,000 it made at $20.

  • How light bends into water

    Light travels more slowly in water than in air, and it crosses the surface along the path that takes the least time. Writing the travel time as a function of where the ray meets the surface and setting its derivative to zero gives Snell's law, which predicts the angle of bending.

Common Mistakes

  1. The slip: Stopping at f′(x)=0 without classifying

    Instead: a critical point may be a max, min, or neither; apply the second derivative test.

  2. The slip: Ignoring endpoints on a closed interval

    Instead: the absolute max or min can occur at a or b, not just at interior critical points.

  3. The slip: Optimizing the wrong quantity

    Instead: translate the word problem into a single-variable function of what's being maximized before differentiating.


Mini Practice

Try these on your own. Tap Reveal when you want to check.

  1. Find the maximum value of f(x)=−2x2+12x+1.

    Hint: Set f′(x)=0, then use the sign of f′′ to confirm a maximum.

  2. Find the absolute maximum and minimum of f(x)=x3−3x on [0,3].

    Hint: Compare f at the critical points inside the interval and at both endpoints.

  3. A farmer has 120 m of fence to make three sides of a rectangular pen along a river (no fence on the river side). What is the largest area she can enclose?

    Hint: Call the two sides that touch the river x. Write the area as a function of x only.

  4. An open box is made from a 12 cm by 12 cm sheet by cutting a square of side x cm from each corner and folding up the sides. Which x gives the largest volume, and what is that volume?

    Hint: The base is (12−2x) by (12−2x) and the height is x.

  5. You want the x that makes P(x)=50x−x2 as large as possible. A classmate starts solving 50x−x2=0. Is this a roots problem or an optimization problem?

    Hint: Does the question ask where P is zero or where P is biggest?

  6. To find the maximum of f(x)=x3, a student solves f′(x)=3x2=0, gets x=0, and calls it the maximum. Find the error.

    Hint: Check the sign of f′ just left and just right of x=0.

Want the full set?

50 practice questions for this concept — free to try, every one with a complete worked solution showing the why, not just the answer.

Frequently Asked Questions

Do I always need the second derivative test after finding a critical point?

No. The first derivative test also works: check the sign of f′f' just left and right of the point. Positive then negative is a peak; negative then positive is a valley. On a closed interval it is often quickest to evaluate ff at every critical point and both endpoints and compare. The second derivative test gives no verdict when f′′(c)=0f''(c)=0, as for x4x^4 at x=0x=0, which is in fact a minimum.

Why does the best rectangle for a fixed length of fence always come out as a square?

For a perimeter PP, the area is x(P2−x)x\left(\frac{P}{2}-x\right), a downward parabola that is symmetric about x=P4x=\frac{P}{4}, so the peak comes when both sides equal P4\frac{P}{4}. Change the setup and the answer changes: with a river along one side, so only three sides need fence, the best pen is twice as long, along the river, as it is wide.

What if the variable must be a whole number, like the number of buses to hire?

Calculus treats the variable as smooth, so solve as usual and then test the whole numbers on either side of the critical point. If profit peaks at x=12.4x=12.4, compare x=12x=12 and x=13x=13 in the original function. The nearer whole number is not always the winner, because a curve is usually not symmetric about its peak.

Are drink cans shaped to use the least metal, as the textbook problem suggests?

Not exactly. For a closed cylinder of fixed volume, calculus says the least surface area comes when the height equals the diameter. A standard 355 mL can is about 12.2 cm tall and 6.6 cm wide, much taller than that. The top and bottom use thicker metal, a slim can is easier to hold, and cans must fit machines, boxes and vending slots. The calculus answer is a starting point that real constraints then move.

Learning Path

← Before

Derivative
Optimization

You are here

Next →

Nothing after this yet
You need the Derivative, including the fact that its sign shows where a function rises or falls. Optimization adds a procedure: model the quantity, find where f′=0, classify with the second derivative or a sign chart, and compare endpoints. No single concept comes next; this is where calculus starts answering design questions about box and can dimensions, pricing and shortest paths, and later the least-squares line in statistics.

See Also