Tutorials › AP Calculus › Optimization Problems with Constraints
← All AP Calculus Tutorials
AP Calculus AB & BC Intermediate

Optimization Problems with Constraints

How to turn a real-world restriction into an equation, reduce an optimization problem to one variable, and use derivatives to find the maximum or minimum value.

What Makes a Constraint Problem Different?

Optimization problems ask you to find the largest or smallest possible value of some quantity. In many AP Calculus problems, however, the variables are not independent. A condition in the problem tells you how they are related.

That condition is called a constraint. Your job is to use the constraint to rewrite the quantity you want to optimize in terms of a single variable.

For example, suppose a rectangle has a fixed perimeter. You cannot choose its length and width independently. If the perimeter is 40, then the dimensions must satisfy a relationship such as . That relationship is the constraint.

The Basic Structure

Almost every constrained optimization problem can be organized into two equations:

The objective function is what you are trying to maximize or minimize. The constraint equation tells you how the variables are related.

The key idea is simple: use the constraint to eliminate one variable from the objective function. Once the objective is a function of one variable, ordinary calculus takes over.

A Reliable Step-by-Step Method

  1. Identify the quantity being optimized. Is the problem asking for maximum area, minimum cost, maximum volume, minimum distance, or something else?
  2. Define your variables. Give every important dimension or quantity a variable and include units when helpful.
  3. Write the objective function. Express the quantity you want to maximize or minimize.
  4. Write the constraint equation. Translate the information that restricts the variables.
  5. Solve the constraint for one variable.
  6. Substitute into the objective function. You should now have a one-variable function.
  7. Find critical points. Differentiate the objective function and solve , including any points where the derivative is undefined.
  8. Check the domain and endpoints. A critical point is a candidate, not automatically the answer.
  9. State the answer in context. Give the requested quantity and appropriate units.

Worked Example 1: Maximum Area with a Fixed Perimeter

Example 1: Rectangle Constraint

A rectangular garden has a perimeter of 40 meters. What dimensions maximize its area?

Step 1 — Define variables: Let be the length and be the width.
Step 2 — Write the objective: The area is .
Step 3 — Write the constraint: The perimeter condition gives .
Step 4 — Solve the constraint: .
Step 5 — Substitute: .
Step 6 — Differentiate: .
Step 7 — Find the critical point: Set the derivative equal to zero: , so .
Step 8 — Determine the dimensions: .
Step 9 — Confirm the maximum: The area is , and the function is a downward-opening parabola on the feasible interval, so this critical point gives the maximum.
Answer: The garden should be 10 m by 10 m, with maximum area 100 m².

Worked Example 2: Minimizing Material

Example 2: Open-Top Box

An open-top box has a square base. The box must have a volume of 32 cubic inches. Find the dimensions that minimize the amount of material used.

Step 1 — Define variables: Let be the side length of the square base and be the height.
Step 2 — Write the objective: Because the box has no top, the surface area is .
Step 3 — Write the constraint: The volume must be 32, so .
Step 4 — Solve for height: .
Step 5 — Substitute into the objective: .
Step 6 — Differentiate: .
Step 7 — Find the critical point: , giving .
Step 8 — Find the height: .
Step 9 — Confirm the minimum: For positive , the surface-area function decreases before the critical point and increases afterward. Therefore the critical point is a minimum.
Answer: The minimum-material box has a square base with side length 4 inches and height 2 inches.

Worked Example 3: Minimum Distance

Example 3: Distance from a Point to a Curve

Find the point on the parabola that is closest to the point .

Step 1 — Define variables: A point on the parabola is .
Step 2 — Write the objective: The distance from to is .
Step 3 — Use the constraint: Since the point lies on the parabola, .
Step 4 — Substitute: .
Step 5 — Simplify the objective: Instead of minimizing the square root, minimize its square. This gives .
Step 6 — Differentiate: .
Step 7 — Find critical points: , so .
Step 8 — Determine the closest point: The corresponding point is .
Answer: The point on the parabola closest to is .

Why We Often Optimize the Square of a Distance

Distance formulas frequently contain a square root. For example:

Because the square-root function is increasing for nonnegative inputs, minimizing the distance is equivalent to minimizing the expression inside the square root.

This is an important AP Calculus technique. It avoids unnecessary chain-rule algebra while giving exactly the same location of the minimum.

How to Recognize the Constraint

The constraint is usually hidden in the wording of the problem. Look for phrases such as:

One Variable Is the Goal

The most important structural step is reducing the objective function to one variable. If you reach a derivative such as , you have probably not used the constraint completely.

For example, suppose you want to maximize but your constraint says . Solve the constraint:

Then substitute into the objective:

Now the optimization problem is a standard one-variable calculus problem.

Common Mistakes

Confusing the objective with the constraint

The objective is what you are trying to maximize or minimize. The constraint is the restriction that connects your variables. Write both separately before doing any calculus.

Differentiating before eliminating a variable

If your objective still contains two independent variables, you are not ready to differentiate in a typical AP Calculus optimization problem. Use the constraint first.

Finding a critical point but never checking it

A critical point is only a candidate. Use the first derivative test, second derivative test, endpoint comparison, or another valid argument to establish that it actually produces the requested maximum or minimum.

Forgetting the physical domain

Lengths, widths, heights, and distances cannot normally be negative. The algebraic equation may allow values that make no physical sense, so always consider the context.

Giving the wrong quantity as the final answer

If the question asks for the dimensions, do not stop after finding the maximum area. If it asks for the minimum cost, do not report only the dimensions. Answer exactly what the problem asks.

Practice Problems

Question 1

A rectangle has a perimeter of 60 meters. What dimensions maximize its area?

Show answer
Question 2

An open-top box has a square base and volume 108 cubic inches. Find the dimensions that minimize its surface area.

Show answer
Question 3

A farmer has 200 meters of fencing and wants to enclose a rectangular field along a straight river. No fencing is needed along the river. What dimensions maximize the area?

Show answer
Question 4 (Distance)

Find the point on that is closest to the point .

Show answer

Test yourself: AP Calculus practice exams

Ready to check what you know? Work an AP-style practice exam, then open the full solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon