4.4 Constrained Extrema: Optimizing with a Budget
The problem
Two reagents are to be mixed for the elementary reaction \mathrm{A} + \mathrm{B} \to \mathrm{P}, whose initial rate is k[\mathrm{A}][\mathrm{B}]. Suppose a solubility limit (or a fixed ionic strength, or simply the capacity of the apparatus) caps the total concentration at [\mathrm{A}] + [\mathrm{B}] = C. How should the budget be divided to get the fastest possible start?
Section 4.3 taught us to find a maximum by solving y' = 0, but it taught us for a function of one variable, and here there are two knobs: [\mathrm{A}] and [\mathrm{B}]. Try to ignore the cap and the question collapses — make both concentrations bigger and the rate grows without limit, so the unconstrained problem has no answer at all. It is the budget that gives the question its meaning. We have a quantity to make as large as possible (the objective, q = [\mathrm{A}][\mathrm{B}], which is the rate divided by k) and a rule the choices must obey (the constraint, [\mathrm{A}]+[\mathrm{B}]=C). This section is about how a constraint turns a two-knob problem back into one we already know how to solve — and what the solution means.
One budget removes one knob
The constraint is not an extra complication; it is a relation that removes one degree of freedom. If [\mathrm{A}]+[\mathrm{B}]=C, then once you choose [\mathrm{A}], [\mathrm{B}] is no longer yours to choose: [\mathrm{B}] = C - [\mathrm{A}]. Substitute it into the objective and the two-knob function becomes a one-knob function, q([\mathrm{A}]) = [\mathrm{A}]\,\big(C - [\mathrm{A}]\big), and §4.3 applies unchanged. Geometrically, the allowed choices form a line through the [\mathrm{A}]–[\mathrm{B}] plane, and q restricted to that line is the height of a landscape measured while walking along it. The restricted function is that height profile; its maximum is the answer.
Example 4.4.1 — dividing a concentration budget. With C = 2.00 M, find the split of [\mathrm{A}]+[\mathrm{B}] = C that maximizes the encounter factor q = [\mathrm{A}][\mathrm{B}].
Setting it up. One constraint, two variables: eliminate [\mathrm{B}]. The domain is 0 \le [\mathrm{A}] \le C (concentrations cannot be negative).
Solution. q([\mathrm{A}]) = C[\mathrm{A}] - [\mathrm{A}]^{2}, so by the power rule \frac{dq}{d[\mathrm{A}]} = C - 2[\mathrm{A}] = 0 \quad\Rightarrow\quad [\mathrm{A}] = \frac{C}{2} = 1.00\ \text{M}, \quad [\mathrm{B}] = 1.00\ \text{M}. The second derivative is d^{2}q/d[\mathrm{A}]^{2} = -2 < 0: a cap, a maximum. At the endpoints q = 0 (all A or all B means no encounters), so the interior point wins: q_{\max} = 1.00\ \text{M}^2.
Check. Units: q is in M². An uneven split 0.5/1.5 gives q = 0.75 M², 25 % lower — consistent with a maximum at the even split. The result is also physically sensible: every encounter needs one A and one B, so starving either reagent hurts.
Remark. Both panels of the constrained-extrema studio show exactly this. On the left is the plane with contours of q and the allowed line; on the right is the height profile along that line. Drag the point along the constraint and watch the profile’s tangent become flat at the even split. Change the total concentration C and the optimum follows it.
What the picture says: tangency and parallel gradients
The substitution trick works whenever you can solve the constraint for one variable. Its geometry, however, carries a deeper statement worth having. Draw the contours of the objective — the curves along which q is constant ([\mathrm{A}][\mathrm{B}] = 0.4,\,1.0,\,1.7,\dots, a family of hyperbolas). Walking along the constraint line, you cross contours, climbing or descending, until you reach a point where the line merely grazes a contour and turns back: the highest contour you can reach. At a constrained maximum, the constraint is tangent to a contour of the objective. If it crossed the contour, you could still step to a higher one.
To say this with numbers, we need the vector that points uphill. When a function has two variables, its slope along each axis is an ordinary derivative with the other variable frozen.
Definition 4.4.1 (partial derivative, gradient). For f(x,y), the partial derivative \dfrac{\partial f}{\partial x} is the ordinary derivative with respect to x treating y as a constant, and similarly for \dfrac{\partial f}{\partial y}. The gradient is the vector \nabla f = \left(\frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y}\right), which points in the direction of steepest ascent and is perpendicular to the contour through that point.
No new rules are involved — only the discipline of knowing which letter is the variable. For q = [\mathrm{A}][\mathrm{B}]: \partial q/\partial[\mathrm{A}] = [\mathrm{B}] (treat [\mathrm{B}] as a constant multiplier) and \partial q/\partial[\mathrm{B}] = [\mathrm{A}], so \nabla q = ([\mathrm{B}],\,[\mathrm{A}]). For the budget g = [\mathrm{A}]+[\mathrm{B}], \nabla g = (1,\,1), perpendicular to the constraint line.
Theorem 4.4.1 (parallel gradients). If f has a maximum or minimum on the curve g(x,y) = c at an interior point where \nabla g \neq 0, then there is a number \lambda such that \nabla f = \lambda\,\nabla g.
Proof. Move along the constraint with unit tangent direction \mathbf{t}. When both variables change, the changes in f from the two knobs add — the same “rates add” logic as in §4.2 — so the rate of change of f along the curve is the dot product \nabla f\cdot\mathbf{t}. At an extremum of f restricted to the curve, that rate is zero (the first-derivative condition of §4.3), so \nabla f \perp \mathbf{t}. But g is constant along its own level curve, so likewise \nabla g \perp \mathbf{t}. In the plane, two vectors that are both perpendicular to the same nonzero vector point along the same line; hence \nabla f = \lambda\nabla g for some number \lambda.
The theorem and the substitution method are the same fact seen two ways: setting the derivative along the line to zero is setting \nabla f\cdot\mathbf{t} to zero. At the optimum of Example 4.4.1, \nabla q = ([\mathrm{B}],[\mathrm{A}]) = (1.00,\,1.00) M = \lambda\,(1,1), so \lambda = 1.00 M = C/2. The gradient arrows in the studio are parallel exactly at the optimum, and visibly not parallel anywhere else.
Does the even split ever win again? A family of cases
Back to the reagents. Real reactions are not all \mathrm{A}+\mathrm{B}: an elementary step 2\mathrm{A}+\mathrm{B}\to\mathrm{P} has rate k[\mathrm{A}]^2[\mathrm{B}] and, in general, k[\mathrm{A}]^{a}[\mathrm{B}]^{b}. Keep the budget fixed and change only the exponents: for which feed ratio is the initial rate largest?
For a termolecular step 2\mathrm{A}+\mathrm{B} with a 0.90 M budget the best feed is 0.60 M A and 0.30 M B: feed the reagents in the ratio in which the reaction consumes them. The even split of Example 4.4.1 was not a general principle but the special case a = b = 1.
The multiplier is a price
What is \lambda? It has appeared three times — 1.00 M for the reagents, 0.40 for the chain tension — and each time it was found by comparing gradients. It has a meaning that checks out in both examples. Relax the budget slightly and ask how much the optimal value improves. For the reagents, the best possible q at total C is q^*(C) = C^{2}/4, so \frac{dq^*}{dC} = \frac{C}{2} = \lambda . At C = 2.00 M this is 1.00 M, exactly the \lambda found before; and a numerical check agrees (q^*(1.6) - q^*(1.5) = 0.0775 over a 0.1 M change, a rate of 0.775 — the value of \lambda = C/2 at the midpoint). For the chain, the minimum strain is E^*(L) = (L-2)^2/3, so \frac{dE^*}{dL} = \frac{2(L-2)}{3} = 0.40 \quad\text{at } L = 2.6 = \lambda . Here it is pure physics: the energy cost of stretching the held chain a little further is force times distance, so dE^*/dL is the tension F. In both examples \boxed{\;\lambda = \frac{d(\text{optimal value})}{d(\text{budget})}\;} — the price of the constraint, the amount the optimum improves per unit of extra budget. We have verified this in two cases rather than proved it in general, but it holds in general (it is the shadow price of optimization theory). Its units give it away: \lambda carries (objective units) per (budget units) — M²/M, or energy per length, which is force.
The physical payoff: why heat flows until temperatures match
One more system, and the most important in chemistry, because its multiplier is a quantity you already know. Two bodies exchange energy but are isolated from everything else, so their energies obey a fixed total E_1 + E_2 = E. Statistical mechanics tells us that a body with f quadratic degrees of freedom has entropy S = \tfrac{f}{2}\ln E_i + \text{const} (in units of k_B) — more energy, more accessible microstates, with diminishing returns. Write a = f_1/2 and b = f_2/2. The system will settle where the total entropy is largest: S_{\text{tot}} = a\ln E_1 + b\ln E_2, \qquad E_1 + E_2 = E.
Eliminate E_2 = E - E_1 and differentiate: \frac{dS_{\text{tot}}}{dE_1} = \frac{a}{E_1} - \frac{b}{E - E_1} = 0 \;\Rightarrow\; E_1 = \frac{a}{a+b}\,E . The second derivative -a/E_1^2 - b/E_2^2 < 0 confirms a maximum. And the multiplier: \nabla S = (a/E_1,\; b/E_2) = \lambda\,(1,1), so \frac{a}{E_1} = \frac{b}{E_2} = \lambda . Now recall what dS/dE means in thermodynamics: \dfrac{dS}{dE} = \dfrac{1}{T}. The two slopes at the optimum are 1/T_1 and 1/T_2, so \lambda = 1/T and the optimum is T_1 = T_2: thermal equilibrium is a constrained maximum of entropy, and the multiplier is the inverse temperature. The split E_1 = \frac{a}{a+b}E gives each degree of freedom the same energy — equipartition, derived from a Lagrange condition.
Remarks and cautions
Do not forget the constraint. Setting both partial derivatives of q to zero, [\mathrm{B}] = 0 and [\mathrm{A}] = 0, finds the unconstrained stationary point at the origin, where q = 0 — the wrong question’s answer. The constraint changes which points are admissible and which condition characterizes the best one. The right condition is \nabla f = \lambda\nabla g, never \nabla f = 0.
Parallel gradients find candidates, not verdicts. Like y' = 0 in §4.3, the condition \nabla f = \lambda\nabla g only says where an extremum could be. Classify it with the second derivative of the restricted function (or with the profile), and compare the endpoints of the allowed range — a budget has edges (zero concentration, a bond that cannot compress) where the tangent condition need not hold.
Remark. Read units to identify \lambda: it always carries (objective units) per (budget units). That is M²/M for the reagents, energy per length — a force — for the chain, and k_B per energy — an inverse temperature — for the heat-sharing bodies. A multiplier whose units you cannot interpret is usually a signal to recheck the setup.
Summary
When chemistry fixes a total — of concentration, of length, of energy — two variables become one, because the constraint removes a degree of freedom: solve it for one variable, substitute, and the extrema machinery of §4.3 applies to the restricted function. The geometry behind that algebra is tangency: at a constrained optimum the constraint grazes a contour of the objective, and the gradients of objective and constraint, which are both perpendicular to the allowed direction, are parallel, so \nabla f = \lambda\nabla g. The optimum is not generally an even split — it divides the budget in the stoichiometric ratio for a rate law [\mathrm{A}]^a[\mathrm{B}]^b, and inversely with stiffness for bonds in series — and the multiplier \lambda is the price of the constraint, the rate at which the optimum improves per unit of extra budget, which turned out to be a tension for a stretched chain and an inverse temperature for two bodies sharing energy. What remains open: heat-sharing between two bodies is the simplest case of a far larger problem. With 10^{23} molecules and a single energy budget, how is the energy most probably distributed among them? The same optimization, applied to a vast number of variables, yields the Boltzmann distribution — and that is where the next module goes.
Practice until it sticks
Work through Problem Set 8 — Constrained Extrema, which opens with a fully worked termolecular example, and return to the constrained-extrema studio to test your predictions.