Tutorials › AP Calculus › Sensitivity and Units in Optimization Models

Optimization and L'Hôpital's Rule · Tutorial 407 of 999

Sensitivity and Units in Optimization Models

Check that an optimization model is dimensionally consistent, then interpret how its optimal value changes when a parameter changes.

Advanced 9 min read

What You'll Learn

  • Check that every term in an objective and constraint has compatible units.
  • Interpret the units of a derivative with respect to a parameter.
  • Differentiate an optimal-value function to quantify sensitivity.
  • Use the chain rule to justify why the optimizer’s derivative can vanish from the sensitivity formula.
  • Recognize when changing feasible boundaries or active constraints require extra care.

Why Units and Sensitivity Matter

An optimization answer is more useful when it says not only what choice is best, but also what the best outcome means and how it responds to changing conditions. Units help keep the model meaningful: adding a length to an area is not a valid operation. Sensitivity describes how quickly an optimal value changes as a parameter changes.

In a model with a parameter \(a\), write the objective as \(F(x;a)\), where \(x\) is the decision variable. If an optimal choice is \(x^*(a)\), the corresponding optimal value is

$$ V(a)=F(x^*(a);a). $$

The function \(V\) answers a different question from \(x^*\): \(x^*(a)\) describes the best decision, while \(V(a)\) describes the objective achieved by that decision. Its derivative \(V'(a)\), when it exists, measures the local rate of change in the optimal value as \(a\) changes.

Units in an Optimization Model

A dimensional model assigns units to variables and constants. Every term that is added or subtracted must have the same units, and both sides of an equation must have matching units. Products and quotients combine units in the usual way. For instance, length multiplied by length has units of area.

Definition: The units of a derivative are the units of its output divided by the units of its input. Thus, if \(V\) is measured in dollars and \(a\) in dollars per item, \(V'(a)\) is measured in items.

A derivative’s units are a useful check on its interpretation. If an objective is measured in square meters and the parameter in meters, the derivative of the optimal value with respect to that parameter has units of meters. For a small parameter change \(\Delta a\), the change in optimal value is approximately

$$ \Delta V\approx V'(a)\,\Delta a. $$

The units on the right multiply to the units of \(V\). This approximation is local: it is most reliable when \(\Delta a\) is small and \(V\) is differentiable near the starting value.

Worked Example: A Rectangle with Fixed Perimeter

Worked Example: Sensitivity of Maximum Area to Perimeter

A rectangle has perimeter \(P\) meters. Let one side have length \(x\) meters, so the other side is \(P/2-x\) meters. Find the maximum area as a function of \(P\), and interpret its sensitivity.

The feasible interval is \(0\le x\le P/2\), where \(P>0\). The area objective and its derivative with respect to the decision variable are

$$ A(x;P)=x\left(\frac{P}{2}-x\right) =\frac{P}{2}x-x^2, \qquad \frac{\partial A}{\partial x}=\frac{P}{2}-2x. $$

An interior critical point satisfies \(P/2-2x=0\), so \(x=P/4\). The other side is \(P/2-P/4=P/4\). At either endpoint the area is zero, while at this interior point it is positive, so the critical point gives the absolute maximum:

$$ A_{\max}(P)=\frac{P}{4}\cdot\frac{P}{4} =\frac{P^2}{16}. $$

The units are consistent: \(P^2\) has units of square meters, so \(A_{\max}\) is an area. Differentiating with respect to \(P\) gives

$$ \frac{dA_{\max}}{dP}=\frac{P}{8}. $$

This derivative has units \(\mathrm{m^2/m}=\mathrm{m}\). For example, at \(P=20\,\mathrm{m}\), the optimal rectangle is \(5\,\mathrm{m}\) by \(5\,\mathrm{m}\), and its area is \(25\,\mathrm{m^2}\). The sensitivity there is

$$ \left.\frac{dA_{\max}}{dP}\right|_{P=20\,\mathrm{m}} =\frac{20\,\mathrm{m}}{8} =2.5\,\mathrm{m}. $$

A small increase of \(0.2\,\mathrm{m}\) in perimeter therefore predicts an area increase of approximately \((2.5\,\mathrm{m})(0.2\,\mathrm{m})=0.5\,\mathrm{m^2}\). As a check, at \(P=20.2\,\mathrm{m}\) the formula gives \(20.2^2/16=25.5025\,\mathrm{m^2}\), an actual increase of \(0.5025\,\mathrm{m^2}\), close to the local estimate.

Why the Optimizer’s Rate of Change Often Drops Out

When the optimal decision changes with a parameter, the chain rule has two contributions: the objective can change directly with the parameter, and it can change because the optimal decision moves. At a smooth interior optimum, the first derivative of the objective with respect to the decision variable is zero. That makes the second contribution vanish in the derivative of the optimal value.

Theorem: Suppose \(F(x;a)\) is differentiable near \((x^*(a),a)\), the optimal choice \(x^*(a)\) is differentiable, and it is a local interior optimum satisfying \(F_x(x^*(a);a)=0\). Then $$ V'(a)=F_a(x^*(a);a), \qquad V(a)=F(x^*(a);a). $$ The conclusion applies under these stated interior and differentiability conditions; it does not automatically cover an optimum at an active boundary.

To justify the result, differentiate the defining expression for \(V\). The chain rule gives the full calculation:

1
Write the optimal-value function.
\(V(a)=F(x^*(a);a)\), so the decision \(x^*\) can vary with \(a\).
2
Apply the chain rule.
\(V'(a)=F_x(x^*(a);a)\,x^{*\,\prime}(a)+F_a(x^*(a);a)\).
3
Use interior optimality.
At a differentiable interior optimum, \(F_x(x^*(a);a)=0\). Therefore the first term is zero and \(V'(a)=F_a(x^*(a);a)\).

This is a local result about a smooth interior optimum. If a constraint is active, a boundary is moving, or the optimal choice switches between cases, the assumptions may fail. In those situations, first determine the applicable feasible region and optimal case; then differentiate the resulting value formula where it is differentiable. Do not discard terms solely because a point is called an optimum.

Worked Example: Production Cost and Maximum Profit

Worked Example: How Unit Cost Changes Maximum Profit

Let \(q\) be the quantity produced, measured in items. Suppose the selling price per item is

$$ p(q)=30\,\frac{\mathrm{dollars}}{\mathrm{item}} -\left(1\,\frac{\mathrm{dollars}}{\mathrm{item}^2}\right)q, \qquad 0\le q\le 30\,\mathrm{items}. $$

The parameter \(c\) is the constant production cost per item, measured in dollars per item, with \(0\le c<30\,\mathrm{dollars/item}\). Revenue minus production cost gives the profit

$$ \pi(q;c)= \left(30\,\frac{\mathrm{dollars}}{\mathrm{item}}-c\right)q -\left(1\,\frac{\mathrm{dollars}}{\mathrm{item}^2}\right)q^2. $$

Both terms have units of dollars: a dollars-per-item quantity times \(q\) has units of dollars, and dollars per item squared times \(q^2\) also has units of dollars. Set the derivative with respect to \(q\) equal to zero:

$$ \frac{\partial \pi}{\partial q} =(30\,\mathrm{dollars/item}-c) -2\left(1\,\mathrm{dollars/item^2}\right)q=0. $$

Solving gives

$$ q^*(c)= \frac{30\,\mathrm{dollars/item}-c} {2(1\,\mathrm{dollars/item^2})}. $$

The numerator divided by the denominator has units of items. Since \(c<30\,\mathrm{dollars/item}\), this choice is positive and at most \(15\,\mathrm{items}\), so it lies in the feasible interval. The second derivative is \(-2\,\mathrm{dollars/item^2}<0\), and the profit is a concave quadratic; thus this critical point is the absolute maximum on the interval.

Substitution, or completing the square, gives the maximum-profit function

$$ V(c)= \frac{(30\,\mathrm{dollars/item}-c)^2} {4(1\,\mathrm{dollars/item^2})}. $$

Differentiate with respect to \(c\):

$$ V'(c)= -\frac{30\,\mathrm{dollars/item}-c} {2(1\,\mathrm{dollars/item^2})} =-q^*(c). $$

The units of \(V'(c)\) are dollars divided by dollars per item, or items. To check the formula numerically, take \(c=10\,\mathrm{dollars/item}\). Then \(q^*=20/2=10\,\mathrm{items}\), and

$$ V(10\,\mathrm{dollars/item}) =\frac{(20\,\mathrm{dollars/item})^2} {4(1\,\mathrm{dollars/item^2})} =100\,\mathrm{dollars}. $$

At \(q=10\,\mathrm{items}\), the price is \(20\,\mathrm{dollars/item}\), revenue is \(200\,\mathrm{dollars}\), and production cost is \(100\,\mathrm{dollars}\), confirming the \(100\)-dollar profit. The sensitivity is \(V'(10)=-10\,\mathrm{items}\): a small increase of \(1\,\mathrm{dollar/item}\) in unit cost predicts a profit decrease of about \(10\,\mathrm{dollars}\). This interpretation follows from multiplying the derivative’s units by the parameter change’s units.

Worked Example: Minimum Perimeter for a Required Area

Worked Example: Sensitivity to Required Area

A rectangular enclosure must have area \(A>0\) square meters. If one side is \(x>0\) meters, the other side is \(A/x\) meters. Find the least possible perimeter and its sensitivity to \(A\).

The perimeter as a function of \(x\) is

$$ P(x;A)=2x+\frac{2A}{x}. $$

The units of \(A/x\) are \(\mathrm{m^2/m}=\mathrm{m}\), as required for a length. Differentiate with respect to \(x\):

$$ \frac{\partial P}{\partial x} =2-\frac{2A}{x^2}. $$

Setting this equal to zero gives \(x^2=A\), so the positive solution is \(x=\sqrt A\). The second derivative is \(4A/x^3>0\). Also, \(P(x;A)\) tends to infinity as \(x\) approaches zero from above or as \(x\) grows without bound, so this critical point is the absolute minimum. The other side is \(A/\sqrt A=\sqrt A\). Therefore,

$$ P_{\min}(A)=2\sqrt A+2\sqrt A=4\sqrt A, \qquad \frac{dP_{\min}}{dA}=\frac{2}{\sqrt A}. $$

The derivative has units \(\mathrm{m/m^2}=1/\mathrm{m}\). For \(A=9\,\mathrm{m^2}\), the optimal sides are both \(3\,\mathrm{m}\), the minimum perimeter is \(12\,\mathrm{m}\), and the sensitivity is \(2/3\,\mathrm{m^{-1}}\). An increase of \(0.1\,\mathrm{m^2}\) near this area predicts a perimeter increase of about \((2/3\,\mathrm{m^{-1}})(0.1\,\mathrm{m^2})=0.0667\,\mathrm{m}\), to four decimal places. The optimal-value formula checks this estimate: \(4\sqrt{9.1}-12\approx0.0665\,\mathrm{m}\).

A Common Modeling Mistake

A formula can look familiar and still be invalid if its units do not match. For example, writing \(p(q)=30-q\) dollars per item when \(q\) is measured in items subtracts a quantity in items from a quantity in dollars per item. The subtraction has no consistent physical meaning, so the resulting revenue and profit model are not dimensionally valid.

The correction is to include a slope with units, as in \(p(q)=30\,\mathrm{dollars/item}-(1\,\mathrm{dollars/item^2})q\). Then each term in the price has units of dollars per item, and multiplying price by quantity gives revenue in dollars. A related mistake is to report a sensitivity without its units: the number alone does not say whether it measures dollars per item, meters per square meter, or something else.

Using Sensitivity Carefully

Before interpreting a derivative of an optimal value, check the following:

  • Does each term in the objective and each constraint have consistent units?
  • What are the units of the objective and the parameter, and therefore of their derivative?
  • Is the optimal choice interior and differentiable as the parameter changes?
  • Does the feasible region or active boundary change with the parameter?
  • Is the change small enough for a local linear approximation to be appropriate?

These checks distinguish a mathematically computed derivative from a meaningful model interpretation. They also help identify when a parameter change alters the optimization problem enough that a single smooth sensitivity formula cannot be used across the whole range.

Check Your Understanding

Use units and the conditions for differentiating an optimal-value function to answer these questions.

  1. If an optimal value is measured in cubic meters and a parameter in meters, what are the units of the derivative of the optimal value with respect to that parameter?
  2. For the rectangle with fixed perimeter \(P\), what does \(dA_{\max}/dP=P/8\) mean at \(P=16\,\mathrm{m}\), including its units?
  3. In the production model, why must the coefficient multiplying \(q\) in the price function have units of dollars per item squared?
  4. State the interior-optimum condition that makes the term involving \(x^{*\,\prime}(a)\) vanish when differentiating \(V(a)=F(x^*(a);a)\).
  5. Why might the chain-rule sensitivity formula require extra care when an optimum lies on a parameter-dependent boundary?

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