AP Calculus AB and BC

Optimization Setup Builder: Objective vs Constraint

Set up an optimization problem by deciding what you are optimizing (the objective) and separating it from what the problem holds fixed (the constraint). Use the constraint to rewrite the objective in one variable, state the domain, differentiate, find critical points, and confirm the max or min with a derivative test.

Problem 1 of 5
Maximize

A farmer has 100 meters of fencing to enclose a rectangular field. What dimensions x and y give the largest possible area?

First, which quantity does this problem ask you to maximize? (The other two are not what you optimize.)

The optimization setup checklist
  1. 1.Draw and label a picture.
  2. 2.Name the variables.
  3. 3.Write the objective (what you optimize).
  4. 4.Write the constraint (what is fixed).
  5. 5.Substitute to get the objective in one variable.
  6. 6.State the domain, endpoints included.
  7. 7.Differentiate and find the critical points.
  8. 8.Run a derivative test, then answer the actual question with units.

The hardest part of an optimization problem is not the calculus, it is deciding what to optimize. This builder makes you commit to that decision first: it shows a scenario and three candidate formulas, and you choose the one quantity the problem asks you to maximize or minimize. The other two are things you should not optimize: usually a quantity the problem holds fixed (a constraint), and sometimes a related quantity that is the wrong thing to make large or small. Getting this split right is the heart of Topics 5.10 and 5.11 (Introduction to Optimization Problems and Solving Optimization Problems); almost everything after it is procedure.

The objective is the quantity that is free to change and that you want as large or as small as possible: an area, a volume, a length of fence, a distance. The constraint is whatever the problem pins to a fixed value: the 100100 meters of fencing you already own, the 18001800 square feet the pen must enclose, the 1212 inch sheet you start with. A quick test settles most cases: if the problem states a quantity as a specific number, that number is the constraint, so it cannot be the thing you optimize.

The mistake the tool is built to catch

Students routinely set up to optimize the quantity that is actually fixed. If you try to maximize the perimeter when the fencing is already 100100 meters, there is nothing to maximize, the perimeter is stuck at 100100. When you pick one of the other two candidates in the builder, it explains specifically why that quantity is not the objective, often because the problem holds it fixed, and lets you try again; it never names the correct choice, so the retry is reasoning rather than copying.

Once you have named the objective, the builder reveals the rest of the setup one line at a time, in the order the AP rubric rewards. You write the constraint equation, use it to rewrite the objective in a single variable, state the domain, differentiate, solve for the critical points, and run a derivative test before you answer. A persistent checklist keeps the full procedure in view so you internalize the method, not one answer.

  • Draw and label a picture.
  • Name the variables.
  • Write the objective, the quantity you optimize.
  • Write the constraint, the quantity that is fixed.
  • Substitute to get the objective in one variable.
  • State the domain, endpoints included.
  • Differentiate and find the critical points.
  • Run a derivative test, then answer the actual question with units.

The reason for reducing to one variable is that the derivative tools you know act on a function of a single input. The constraint is what lets you do it: solve the constraint for one variable and substitute, and a two variable objective collapses into one you can differentiate. For a rectangle of fixed perimeter, the constraint 2x+2y=1002x + 2y = 100 gives y=50xy = 50 - x, and the area A=xyA = xy becomes a function of xx alone.

2x+2y=100    y=50x    A(x)=x(50x)=50xx22x + 2y = 100 \;\Rightarrow\; y = 50 - x \;\Rightarrow\; A(x) = x(50 - x) = 50x - x^2

With the objective in one variable you differentiate, set the derivative equal to 00 to find the critical points, then confirm which one is the maximum or minimum. Skipping that confirmation is the most common way to lose points: a critical point is only a candidate until a derivative test, or a comparison against the endpoints, proves it wins.

One step in the checklist does more work than it looks: state the domain, endpoints included. The physical setup limits how large or small your variable can be, and those limits matter, because on a closed interval the maximum or minimum can occur at an endpoint rather than at an interior critical point. This is the candidates test for absolute extrema (Topic 5.5): on a closed interval, compare the objective at every critical point and at both endpoints, and the largest or smallest value wins.

For the open-top box cut from a 1212 inch square, the corner cut xx has to satisfy 0x60 \le x \le 6: a cut of 00 leaves a flat sheet, and a cut of 66 removes the whole side. At both endpoints the volume is 00, so neither endpoint can be the maximum, which is why the interior critical point governs here. State the domain anyway, every time, because the moment the endpoints are not obvious losers you will need them.

Closed interval versus open

On a closed interval like 0x60 \le x \le 6 the endpoints are fair game and must be checked. On an open interval like x>0x > 0, the three-sided-pen (minimum-fence) and cylinder problems for instance, no endpoint is attainable, so an interior critical point that a derivative test confirms is the answer. The maximum-area fencing problem, by contrast, is closed, 0x500 \le x \le 50, so its endpoints belong in the check. Reading the domain tells you which situation you are in before you commit to an answer.

Worked example

The largest open-top box

An open-top box is formed from a 1212 inch by 1212 inch square sheet by cutting a square of side xx from each corner and folding up the flaps. Find the value of xx that gives the largest volume.

  1. Step 1, name the objective. You are asked for the largest volume, so the objective is the volume VV. The area of the original sheet is fixed at 144144 square inches, so it is a constraint, not something you can maximize; the base area alone is largest when x=0x = 0, but then the box has no height and no volume, so that is not the goal either.
  2. Step 2, write the constraint and reduce to one variable. Cutting xx from each corner leaves a base of side 122x12 - 2x and a height of xx, so the volume is the product of these: V(x)=x(122x)2V(x) = x(12 - 2x)^2.
  3. Step 3, state the domain. The cut cannot be negative and cannot exceed half the side, so 0x60 \le x \le 6. At x=0x = 0 and x=6x = 6 the volume is 00, so if there is a positive maximum it lives strictly inside the interval.
  4. Step 4, differentiate. Using the product and chain rules and factoring, the derivative comes out cleanly: V(x)=(122x)(126x)V'(x) = (12 - 2x)(12 - 6x).
  5. Step 5, find the critical points. Set V(x)=0V'(x) = 0: (122x)(126x)=0    x=6 or x=2(12 - 2x)(12 - 6x) = 0 \;\Rightarrow\; x = 6 \text{ or } x = 2. The solution x=6x = 6 is an endpoint where the volume is 00, so discard it. The candidate is x=2x = 2.
  6. Step 6, run a derivative test. Check the sign of VV' on either side of x=2x = 2: V(1)=(10)(6)=60>0V'(1) = (10)(6) = 60 > 0 and V(3)=(6)(6)=36<0V'(3) = (6)(-6) = -36 < 0. The derivative changes from positive to negative, so VV has a maximum at x=2x = 2 by the first derivative test.
  7. Step 7, answer the actual question with units. The problem asked for the cut length that maximizes volume, so report x=2x = 2 inches, and evaluate the volume there as a check: V(2)=2(124)2=264=128V(2) = 2(12 - 4)^2 = 2 \cdot 64 = 128.

A corner cut of x=2x = 2 inches gives the largest box, with volume 128128 cubic inches. Notice where the last two steps land: the derivative test justifies the maximum, and the answer carries units. On a free response question, both are where the points live.

Frequently asked questions

How do I tell the objective from the constraint in an optimization problem?

The objective is the quantity you are asked to make as large or as small as possible, and it is free to change: an area, a volume, a length, a distance. The constraint is whatever the problem fixes to a specific value, like 100100 meters of fencing or an enclosed area of 18001800 square feet. A fast test: if the problem states a quantity as a definite number, that number is the constraint, so it cannot be the thing you optimize. Name the objective first, then use the constraint to reduce it to one variable.

Why do I have to state the domain before I optimize?

Because the maximum or minimum can sit at an endpoint, not at an interior critical point. On a closed interval the candidates test (Topic 5.5) says to compare the objective at every critical point and at both endpoints and take the winner. For the open-top box the domain is 0x60 \le x \le 6, and the volume is 00 at both endpoints, so the interior critical point wins; but you only know that after you have written the domain down. When the endpoints are not obvious losers, forgetting them costs the answer.

Should I use the first derivative test or the second derivative test?

Either one justifies a maximum or minimum, so use whichever is less work for your function. The first derivative test checks the sign of ff' just before and just after the critical point: a change from positive to negative is a maximum, negative to positive is a minimum. The second derivative test checks concavity: f<0f'' < 0 at the critical point gives a maximum, f>0f'' > 0 gives a minimum. The second test is quick when ff'' is easy to evaluate, but it is inconclusive when f=0f'' = 0, so fall back to the first derivative test or the candidates test there.

Is optimization on the AP Calculus exam?

Yes, in both AB and BC, as Topics 5.10 and 5.11. It appears in multiple choice and, classically, as a free response question that asks you to build the model and justify the extreme value. The graded steps are the setup and the justification: defining the objective, reducing to one variable, and confirming the maximum or minimum with a derivative test or the candidates test. Reporting a critical point without that justification does not earn full credit, which is exactly why this tool drills the setup rather than the number.