Tutorials › AP Calculus › Optimization: Minimizing Cost and Distance
← All AP Calculus Tutorials
AP Calculus AB & BC Intermediate

Optimization: Minimizing Cost and Distance

Learn how to turn real-world cost and distance problems into functions you can minimize using derivatives. The key is translating the situation correctly, building one-variable objective function, and proving that the critical point gives the minimum.

What Optimization Problems Are Asking

Optimization problems ask you to find the value of a variable that makes some quantity as small or as large as possible. In this tutorial, the goal is specifically minimization: finding the least possible cost, shortest distance, minimum amount of material, or another smallest value.

The calculus itself is usually not the hardest part. The difficult step is translating the words into an objective function that depends on only one variable. Once you have that function, derivatives give you a systematic way to locate the minimum.

The basic idea is simple: find where the derivative is zero or undefined, then determine which candidate actually produces the minimum value.

The Optimization Framework

Most AP Calculus optimization problems can be organized into the same sequence. Before differentiating anything, identify exactly what quantity the problem wants you to minimize.

  1. Identify the quantity to minimize. This is your objective function.
  2. Define your variables. Choose variables that have clear meanings in the problem.
  3. Write the objective function. Express cost, distance, area, or another quantity in terms of your variables.
  4. Use the given information to eliminate variables. Your final objective function should normally contain only one variable.
  5. Find the critical points. Solve or identify where the derivative is undefined.
  6. Check the candidates. Use the first derivative test, second derivative test, endpoints, or another appropriate method.
  7. Interpret the answer. State what the critical value means in the original context.

Minimizing Distance

A common optimization problem asks for the point on a curve that is closest to a given point. The distance formula is the natural starting point, but there is a useful trick that makes the calculus easier.

Because the square-root function is increasing, minimizing the distance is equivalent to minimizing the squared distance. Squaring removes the square root and usually makes the derivative much simpler.

Example 1: Minimum Distance to a Parabola

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

Step 1: Let be a point on the parabola.
Step 2: Write the squared distance from to .
Step 3: Substitute into the distance function.
Step 4: Differentiate and find the critical points.
Step 5: The critical point gives . Therefore the corresponding point is .
Result: The point on the parabola closest to is .

Minimizing Cost

Cost optimization problems often involve two different ways of producing, transporting, or constructing something. Each option has a different cost per unit, so the total cost depends on how much work is assigned to each option.

The central idea is to write the total cost as a function of one variable. If one part costs more than another, the optimal solution balances the additional cost against the reduction in distance or quantity associated with that choice.

Example 2: Minimizing Construction Cost

A rectangular garden must have an area of square feet. The fencing for one pair of opposite sides costs $4 per foot, while the fencing for the other pair costs $10 per foot. Find the dimensions that minimize the total fencing cost.

Step 1: Let be the length of the sides with the $4-per-foot fencing, and let be the other dimension.
Step 2: Use the area constraint:
Step 3: Solve for one variable:
Step 4: Write the total cost. There are two sides of each type:
Step 5: Substitute the area constraint:
Step 6: Differentiate:
Step 7: Set the derivative equal to zero:
Step 8: The positive solution is . Using the area constraint gives .
Result: The cost is minimized when the garden has dimensions .

Minimizing Travel Cost

A particularly important AP Calculus pattern combines distance and different costs per unit distance. A person, vehicle, pipeline, or cable may travel through two different environments, with one route costing more per unit distance than another.

The trick is to express every portion of the total cost using the same variable. Then differentiate the complete cost function.

Example 3: Minimizing the Cost of a Cable

A power station is located miles offshore. A cable must connect the station to a location on a straight shoreline. The cable costs $5,000 per mile underwater and $2,000 per mile along the shoreline. A point on the shoreline is miles from the point directly opposite the station. Where should the cable reach the shore to minimize total cost?

Step 1: Let be the distance along the shoreline from the point directly opposite the station to the point where the cable reaches shore.
Step 2: The underwater distance is given by the Pythagorean theorem:
Step 3: The shoreline distance is .
Step 4: Write total cost:
Step 5: Differentiate:
Step 6: Set the derivative equal to zero:
Step 7: Solving gives approximately .
Interpretation: The cheapest route does not necessarily minimize the physical distance. Because underwater cable is more expensive per mile, the optimal route balances the shorter underwater distance against the additional shoreline distance.

Minimum Distance and the Derivative

There is a useful geometric interpretation behind many distance problems. At a minimum-distance point, the derivative of the distance function is zero because the distance stops decreasing and begins increasing.

For a point moving along a curve, the closest point often occurs where the line connecting the fixed point to the curve is perpendicular to the curve's tangent line.

This geometric condition can sometimes provide a faster route to the answer, but on an AP Calculus problem you should still be able to justify the minimum using derivatives.

Using the Second Derivative Test

Once you find a critical point, you still need to determine whether it actually produces a minimum. One common method is the second derivative test.

If the second derivative is positive at the critical point, the graph is concave up there, so the critical point is a local minimum.

Example 4: Confirming a Minimum

Suppose an optimization problem produces the objective function .

Step 1: Differentiate:
Step 2: Find the critical point:
Step 3: Compute the second derivative:
Step 4: Evaluate at the critical point:
Conclusion: Because the second derivative is positive, the function is concave up at the critical point. Therefore the critical point produces a local minimum.

Absolute Minimum: Don't Forget the Endpoints

If the variable is restricted to a closed interval, finding is not enough. An absolute minimum can occur at an interior critical point or at an endpoint.

For an objective function defined on , the complete procedure is:

  1. Find all critical points inside the interval.
  2. Evaluate the objective function at each critical point.
  3. Evaluate the objective function at both endpoints.
  4. Compare all resulting values.
  5. The smallest value is the absolute minimum.

Common Mistakes

Minimizing the wrong quantity

Before taking a derivative, ask exactly what the problem wants minimized. If the problem asks for minimum cost, your objective function must represent cost, not merely distance. A route with the shortest physical distance may not have the lowest cost.

Leaving two variables in the objective function

You usually cannot differentiate a one-variable optimization problem until you have used the given constraint to eliminate one variable. If your objective function still contains both and , look for the equation that connects them.

Forgetting units or the meaning of the variable

An answer such as is incomplete if the reader does not know what represents. Always translate the numerical result back into the original situation.

Assuming every critical point is a minimum

Setting the derivative equal to zero only identifies candidates. Use the second derivative test, the first derivative test, or comparison of candidates and endpoints to establish that the result is actually a minimum.

Using distance instead of squared distance

When minimizing Euclidean distance, the square root can make the derivative unnecessarily complicated. Since distance and squared distance have the same minimizing point, minimizing squared distance is usually cleaner.

A Reliable AP Calculus Strategy

When you see a minimum-cost or minimum-distance problem on the AP exam, use this checklist:

  1. What am I minimizing? Write it down.
  2. What variables describe the situation? Define them clearly.
  3. What equation connects the variables? This is your constraint.
  4. Can I rewrite the objective function using one variable?
  5. What is the derivative?
  6. Where is the derivative zero or undefined?
  7. Which candidate actually gives the minimum?
  8. What does the answer mean in context?

The most important habit is to separate the modeling from the calculus. First build the correct objective function. Then use derivatives to optimize it.

Practice Problems

Question 1

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

Show answer
Question 2

A rectangular enclosure has an area of square feet. Three sides use material costing $6 per foot, while the fourth side uses material costing $10 per foot. Find the dimensions that minimize the total cost.

Show answer
Question 3

A point lies on the line . Find the point on the line closest to .

Show answer
Question 4 (Cost Optimization)

A company needs to transport material from a warehouse to a construction site. The material can travel along a road at one cost per mile and across an open field at a higher cost per mile. Set up a one-variable cost function and explain how its critical point can be used to find the least-cost route.

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