Constrained Variation and Lagrange Multipliers

Ordinary calculus already knows how to extremize under a side condition: to make f(x1,…,xn)f(x_1,\dots,x_n) stationary on the surface g(x)=0g(\mathbf{x})=0 you do not solve ∇f=0\nabla f=0 but ∇f=λ ∇g\nabla f=\lambda\,\nabla g, because the constraint has forbidden some directions of motion. The calculus of variations meets exactly this situation in infinite dimensions. We want a function y(x)y(x) that makes a functional J[y]J[y] stationary, but the admissible yy are fenced in by extra requirements: a fixed length, a fixed area, a normalization, a surface the curve must lie on. Setting δJ=0\delta J=0 over all δy\delta y now gives the wrong answer, because the constraint correlates the variations — they are no longer free to be cancelled one point at a time. The cure is the same idea promoted to function space, and two structurally different constraints appear. An isoperimetric (integral) constraint K[y]=∫abG dx=ℓK[y]=\int_a^b G\,\mathrm{d}x=\ell pins one global number, so a single constant λ\lambda buys back the lost degree of freedom. A holonomic (pointwise) constraint g(y,x)=0g(y,x)=0 must hold at every xx — a continuum of constraints — so its multiplier becomes a whole function λ(x)\lambda(x). Either way the recipe is identical: adjoin the constraint to the functional, extremize freely, and re-impose the constraint to fix the multiplier. What makes the method worth mastering is that the multiplier is almost never mere bookkeeping. It comes out as the tension in a hanging chain, the radius of the optimal circle, the energy eigenvalue of a wave problem, the inverse temperature of a thermal distribution, the reaction on a bead sliding on a wire — one construction quietly underwriting the catenary, the isoperimetric theorem, geodesics, Sturm–Liouville theory, and the constraint forces of Lagrangian mechanics.

Key takeaways
  • A constrained variational problem makes a functional J[y]J[y] stationary subject to side conditions — either integral (isoperimetric) constraints K[y]=ℓK[y]=\ell or pointwise (holonomic) constraints g(y,x)=0g(y,x)=0.
  • The method adjoins each constraint to the functional with an undetermined multiplier, turning a constrained problem into free stationarity of the augmented functional J−λKJ-\lambda K.
  • An integral constraint costs one constant λ\lambda; a pointwise constraint holding at every xx costs a multiplier function λ(x)\lambda(x) determined alongside y(x)y(x).
  • The multipliers are extra unknowns, fixed by re-imposing the constraints — and their values usually are the physics: tension, reaction, chemical potential, eigenvalue.
  • Geometrically the gradient of JJ must lie in the span of the constraint gradients at the extremum, promoting ∇f=λ ∇g\nabla f=\lambda\,\nabla g from Rn\mathbb{R}^n to function space.
  • Classic cases: the hanging chain (catenary), the isoperimetric problem (the circle), geodesics on surfaces, and the eigenvalue problems of Sturm–Liouville theory.
  • Key idea: adjoin each constraint to the functional with a multiplier — a constant for an integral constraint, a function λ(x) for a pointwise one — then extremize freely; the multipliers are extra unknowns fixed by re-imposing the constraints.
The core insight

Adjoin each constraint to the functional with a multiplier — a constant for an integral constraint, a function λ(x)\lambda(x) for a pointwise one — then extremize freely; the multipliers are extra unknowns fixed by re-imposing the constraints.

Where this lives today

The augmented-functional idea has quietly become a load-bearing beam of computational science. In machine learning, the support-vector machine is literally a constrained variational problem: maximize a margin subject to classification inequalities, solved through its Lagrangian dual, where the nonzero multipliers pick out the "support vectors," and its Karush–Kuhn–Tucker conditions are the inequality-constraint generalization of equation (1). In optimal control and spacecraft trajectory design, Pontryagin's maximum principle introduces multiplier functions called costates, and a modern low-thrust interplanetary transfer is found by numerically solving exactly the pointwise-multiplier system of equation (5). In electronic-structure theory, density-functional calculations minimize an energy functional at fixed particle number, and the enforcing multiplier is the chemical potential μ\mu that sets whether electrons flow between two materials in contact. An open frontier is enforcing hard physical constraints — conservation laws, positivity, incompressibility — inside neural-network surrogates for physics, where naïvely learned models drift off the constraint surface exactly as a bare δJ=0\delta J=0 would.

The physical picture

Imagine every admissible function as a point, and the whole space of functions as a landscape whose height is JJ. Unconstrained, you roll to the bottom straight downhill, along −∇J-\nabla J. But a constraint carves a curved surface out of that landscape and forbids you to leave it — you can only slide along it. You stop not where the ground is flat, but where it is flat along the surface: the downhill pull of JJ has been used up in directions you are not allowed to take, and whatever remains of ∇J\nabla J points straight out of the surface, parallel to its gradient ∇g\nabla g. The multiplier λ\lambda is nothing but the ratio between those two parallel vectors.

Figure
At a constrained extremum the level set of J is tangent to the constraint surface g = 0, so the gradient ∇f is parallel to ∇g and the multiplier λ is their ratio, ∇f = λ∇g — you stop where the lowest reachable contour just kisses the constraint
You stop where the lowest reachable J-contour just touches the constraint: there ∇f ∥ ∇g J falls inward level sets of J constraint surface g = 0 ∇f = λ∇g ∇g δy stays on surface: df = 0 constrained extremum

Why the two constraint types cost different things follows from the same picture. An integral constraint fixes one global number — a length, an area, a normalization — so it removes exactly one degree of freedom, and one constant λ\lambda restores it. A pointwise constraint is far more demanding: holding separately at every xx, it is really an infinite family of constraints stacked along the interval, each point needing its own multiplier, which assemble into a field λ(x)\lambda(x). Operationally the multiplier lets you pretend the variations are free: you overcount by one degree of freedom, then spend the multiplier to annihilate the correlated piece of δy\delta y, and the fundamental lemma applies to what is left. The payoff is that this forced-in multiplier turns out to be the quantity you most wanted to know — as the isoperimetric problem shows in one hard number.

Figure
Among all closed plane curves of perimeter P = 4 m the circle maximizes enclosed area: A = P²/4π = 1.273 m² beats the equal-perimeter square's 1.000 m², and the Lagrange multiplier comes out equal to the circle's radius, λ = P/2π = 0.637 m
Fixed perimeter P = 4 m: the circle wins — A = P²/4π = 1.273 m² vs the square's 1.000 m² square A = 1.000 m² s = 1 m P = 4 m circle — the extremum A = 1.273 m² +27% area P = 4 m r = λ = 0.637 m the multiplier is the answer: λ = radius = P/2π, and 4πA ≤ P² is saturated

The core equations

The starting point is finite-dimensional, and it is worth stating cleanly because the whole method is its infinite-dimensional echo. To extremize ff on the surface ga=0g_a=0, the gradient of ff cannot have any component tangent to the surface, so it must be a combination of the constraint normals.

∇f=∑aλa ∇ga,ga(x)=0(1)\nabla f=\sum_{a}\lambda_a\,\nabla g_a,\qquad g_a(\mathbf{x})=0 \qquad (1)

where: ff — the function being extremized; gag_a — the constraint functions, a=1,…,ma=1,\dots,m; λa\lambda_a — the undetermined multipliers; x\mathbf{x} — a point in Rn\mathbb{R}^n. Read it as: at the optimum the objective pushes purely along the constraints' normals, and the λa\lambda_a record how hard. The variational problem replaces ff by a functional and x\mathbf x by a function. The isoperimetric setup fixes one integral quantity while extremizing another.

J[y]=∫abF(y,y′,x) dx,K[y]=∫abG(y,y′,x) dx=ℓ(2)J[y]=\int_a^b F(y,y',x)\,\mathrm{d}x,\qquad K[y]=\int_a^b G(y,y',x)\,\mathrm{d}x=\ell \qquad (2)

where: JJ — the functional to extremize; KK — the integral constraint functional; ℓ\ell — its fixed prescribed value; F,GF,G — the two integrands; y(x)y(x) — the unknown function with fixed endpoints. Read it as: one number, ℓ\ell, is frozen while the whole shape of yy is otherwise free. Adjoining KK with a single constant λ\lambda produces an ordinary Euler–Lagrange equation for the augmented integrand — the central result for integral constraints.

∂Φ∂y−ddx∂Φ∂y′=0,Φ≡F−λ G(3)\frac{\partial \Phi}{\partial y}-\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial \Phi}{\partial y'}=0,\qquad \Phi\equiv F-\lambda\,G \qquad (3)

where: Φ\Phi — the augmented integrand F−λGF-\lambda G; λ\lambda — the single constant multiplier. Read it as: solve the ordinary Euler–Lagrange equation, but for F−λGF-\lambda G instead of FF; the constant λ\lambda rides along as an unknown. A pointwise constraint is a different animal. Requiring g=0g=0 at every xx demands a multiplier that can vary with xx.

g(y1,…,yn,x)=0  ∀x  ⟹  Φ=F+λ(x) g(4)g(y_1,\dots,y_n,x)=0\ \ \forall x \ \ \Longrightarrow\ \ \Phi=F+\lambda(x)\,g \qquad (4)

where: gg — the constraint required at every xx; λ(x)\lambda(x) — the multiplier function; yiy_i — several dependent functions. Read it as: enforced pointwise, the constraint's price is a function, not a number. Varying the several yiy_i then gives an augmented Euler–Lagrange system whose extra term is a generalized constraint force.

∂F∂yi−ddx∂F∂yi′+λ(x) ∂g∂yi=0,g=0(5)\frac{\partial F}{\partial y_i}-\frac{\mathrm{d}}{\mathrm{d}x}\frac{\partial F}{\partial y_i'}+\lambda(x)\,\frac{\partial g}{\partial y_i}=0,\qquad g=0 \qquad (5)

where: ii — runs over the dependent functions; λ(x) ∂g/∂yi\lambda(x)\,\partial g/\partial y_i — the generalized force that keeps the solution on the constraint. Read it as: the ordinary equations of motion plus a force normal to the constraint, of strength λ(x)\lambda(x). The same machinery converts a ratio of integrals into an eigenvalue problem. Extremizing the numerator at fixed denominator turns the Rayleigh quotient into a Sturm–Liouville equation with the multiplier as eigenvalue.

J[y]=∫ab(p y′2−q y2) dx∫abw y2 dx  ⟹  −(p y′)′+q y=λ w y(6)J[y]=\frac{\int_a^b\big(p\,y'^2-q\,y^2\big)\,\mathrm{d}x}{\int_a^b w\,y^2\,\mathrm{d}x}\ \ \Longrightarrow\ \ -(p\,y')'+q\,y=\lambda\,w\,y \qquad (6)

where: p,q,wp,q,w — the Sturm–Liouville coefficient functions with weight w>0w>0; λ\lambda — the multiplier, now identified as the eigenvalue; ∫w y2\int w\,y^2 — the normalization that is being held fixed. Read it as: normalization is the constraint, and its multiplier is the energy. Every case above is one line of a single master recipe: vary the augmented functional freely, then let the constraint pin the multiplier.

δ ⁣(J−λK)=0withλ fixed by K[y]=ℓ(7)\delta\!\left(J-\lambda K\right)=0\quad\text{with}\quad \lambda\ \text{fixed by}\ K[y]=\ell \qquad (7)

where: J−λKJ-\lambda K — the augmented functional; K[y]=ℓK[y]=\ell — the constraint that closes the system. Read it as: the multiplier is the one extra unknown that matches the one extra equation, the constraint itself.

Derivation AThe multiplier rule from the constrained first variation

The goal is to prove that adjoining an integral constraint with a single constant is not a trick but a theorem: when a competing variation is forced to preserve K[y]=ℓK[y]=\ell, stationarity of JJ is equivalent to the ordinary Euler–Lagrange equation for Φ=F−λG\Phi=F-\lambda G, with λ\lambda a genuine constant fixed by the constraint. The key move is a two-parameter family of variations, so one parameter can be spent enforcing the constraint while the other stays free.

Step 1. Perturb the extremal with two independent bump functions, y→y+ε1η1+ε2η2y\to y+\varepsilon_1\eta_1+\varepsilon_2\eta_2, both vanishing at the endpoints, and expand to first order. This gives δJ=ε1J1+ε2J2\delta J=\varepsilon_1 J_1+\varepsilon_2 J_2 and δK=ε1K1+ε2K2\delta K=\varepsilon_1 K_1+\varepsilon_2 K_2, where Ji=∫EF ηi dxJ_i=\int E_F\,\eta_i\,\mathrm{d}x, Ki=∫EG ηi dxK_i=\int E_G\,\eta_i\,\mathrm{d}x, and EF,EGE_F,E_G are the Euler–Lagrange expressions of F,GF,G. Why two parameters: a single bump cannot both stay on the constraint and probe an independent direction, so we need one to spend and one to keep.

Step 2. Enforce the constraint to first order, δK=0\delta K=0, which reads ε1K1+ε2K2=0\varepsilon_1 K_1+\varepsilon_2 K_2=0. This ties ε1\varepsilon_1 and ε2\varepsilon_2 together — they are no longer independent — which is precisely why δJ=0\delta J=0 over "all" variations would be wrong. Why it matters: the correlation between the variations is the whole difficulty; the constraint has removed one direction of freedom.

Step 3. Define λ≡J2/K2\lambda\equiv J_2/K_2 (assuming K2≠0K_2\neq0, i.e. the constraint is not degenerate at the extremal). Substituting the constraint relation ε2=−ε1K1/K2\varepsilon_2=-\varepsilon_1 K_1/K_2 into δJ\delta J gives δJ=ε1(J1−λK1)\delta J=\varepsilon_1\big(J_1-\lambda K_1\big). Stationarity for the now-free ε1\varepsilon_1 forces J1−λK1=0J_1-\lambda K_1=0, i.e. ∫(EF−λEG) η1 dx=0\int(E_F-\lambda E_G)\,\eta_1\,\mathrm{d}x=0. Why λ\lambda is a constant: J2/K2J_2/K_2 is one fixed number for the extremal, independent of xx, which is exactly the constant multiplier promised in equation (3).

Step 4. Since η1\eta_1 is arbitrary, the fundamental lemma of the calculus of variations gives EF−λEG=0E_F-\lambda E_G=0 pointwise — the Euler–Lagrange equation for Φ=F−λG\Phi=F-\lambda G. The extremal is thus a one-parameter family in λ\lambda; substituting it back into K[y]=ℓK[y]=\ell fixes the value of λ\lambda. Why re-imposing the constraint is mandatory: the augmented equation alone is underdetermined, and K[y]=ℓK[y]=\ell is the missing equation that closes the count. *Why this is consistent: specializing to F=fF=f, G=gG=g with no xx-integral recovers the finite-dimensional rule ∇f=λ∇g\nabla f=\lambda\nabla g of equation (1).*

Go deeper · Derivation B · 2 minThe hanging chain and its tension
Derivation BThe hanging chain and its tension

The goal is to show that a uniform flexible chain of fixed length LL hung between two supports takes a catenary shape y=ccosh⁡((x−x0)/c)y=c\cosh((x-x_0)/c), and — the point of the exercise — that the multiplier enforcing the length constraint sets the horizontal tension through c=T0/(ρg)c=T_0/(\rho g). We minimize gravitational potential energy at fixed arclength, so the constraint is integral and the multiplier is a single constant.

Step 1. Write the energy and the constraint. With ds=1+y′2 dx\mathrm{d}s=\sqrt{1+y'^2}\,\mathrm{d}x, the potential energy is U=ρg∫aby1+y′2 dxU=\rho g\int_a^b y\sqrt{1+y'^2}\,\mathrm{d}x, and the fixed length is L=∫ab1+y′2 dxL=\int_a^b\sqrt{1+y'^2}\,\mathrm{d}x. Why an integral constraint: the chain's total length is a single frozen number, so exactly one constant multiplier is called for.

Step 2. Adjoin the length with a constant λ\lambda: the augmented integrand is Φ=(ρg y−λ)1+y′2\Phi=(\rho g\,y-\lambda)\sqrt{1+y'^2}. Absorbing ρg\rho g by setting μ=λ/(ρg)\mu=\lambda/(\rho g) gives the cleaner Φ=(y−μ)1+y′2\Phi=(y-\mu)\sqrt{1+y'^2}. Why shift yy: the multiplier merely relocates the height origin, which already hints that it carries the units of a length.

Step 3. Because Φ\Phi has no explicit xx, the Beltrami identity Φ−y′ ∂Φ/∂y′=const\Phi-y'\,\partial\Phi/\partial y'=\text{const} applies. Computing it gives (y−μ)/1+y′2=c(y-\mu)/\sqrt{1+y'^2}=c, a first-order equation. Why Beltrami: an xx-independent integrand always yields this first integral, dropping the order and sparing us the second-order Euler–Lagrange equation.

Step 4. Rearrange to dy/(y−μ)2/c2−1=± dx\mathrm{d}y/\sqrt{(y-\mu)^2/c^2-1}=\pm\,\mathrm{d}x and integrate; the left side is an inverse hyperbolic cosine, so y−μ=ccosh⁡((x−x0)/c)y-\mu=c\cosh((x-x_0)/c). The three constants c,x0,μc,x_0,\mu are set by the two endpoints and the length LL. Why this is the catenary: the hyperbolic cosine is the unique shape whose slope grows in step with the accumulated weight below it.

Step 5. Read off the physics. A force balance on the chain gives the horizontal tension T0=ρg cT_0=\rho g\,c, so the multiplier — hidden inside cc — is the tension. Raising T0T_0 (pulling the ends harder) increases cc and flattens the curve, exactly as a tightened clothesline sags less. Why this is the payoff: the constant we were forced to introduce is the single most physical quantity in the problem. *Why this is the standard result: the procedure yields the catenary y=ccosh⁡(x/c)y=c\cosh(x/c) with c=T0/(ρg)c=T_0/(\rho g), confirming that the multiplier encodes the horizontal tension.*

Go deeper · Derivation C · 1 minGeodesics and the pointwise multiplier
Derivation CGeodesics and the pointwise multiplier

The goal is to derive the equation of a shortest path constrained to a surface g(r)=0g(\mathbf r)=0, and to see the jump from a constant multiplier to a multiplier function: because the curve must stay on the surface at every point, the multiplier becomes λ(s)\lambda(s), and the resulting equation says the path curves only as much as the surface forces it to. We minimize arclength subject to a pointwise (holonomic) constraint.

Step 1. Write the length and the constraint. The length is L=∫r˙⋅r˙ dtL=\int\sqrt{\dot{\mathbf r}\cdot\dot{\mathbf r}}\,\mathrm{d}t, and the surface condition g(r)=0g(\mathbf r)=0 must hold for all tt along the curve. Why a multiplier function: an equation that must hold at every parameter value is a continuum of constraints, so its price is a function λ(t)\lambda(t), not a constant.

Step 2. Adjoin the constraint pointwise: Φ=r˙⋅r˙+λ(t) g(r)\Phi=\sqrt{\dot{\mathbf r}\cdot\dot{\mathbf r}}+\lambda(t)\,g(\mathbf r). Applying equation (5) with r=(x,y,z)\mathbf r=(x,y,z) produces one Euler–Lagrange equation per coordinate, each carrying a λ(t) ∂g/∂ri\lambda(t)\,\partial g/\partial r_i term. Why this term is a force: it is exactly the generalized constraint force that pushes the curve back onto the surface.

Step 3. Choose the arclength parameter so that ∣r˙∣=1|\dot{\mathbf r}|=1; the kinetic-like term then reduces to the second derivative and the system collapses to d2r/ds2=λ(s) ∇g\mathrm{d}^2\mathbf r/\mathrm{d}s^2=\lambda(s)\,\nabla g. Why arclength simplifies everything: it removes the square-root normalization and leaves a clean statement about curvature.

Step 4. Interpret it geometrically. The vector d2r/ds2\mathrm{d}^2\mathbf r/\mathrm{d}s^2 is the curve's acceleration, and ∇g\nabla g is the surface normal, so the equation says the path accelerates only along the normal — it never bends within the surface. On a sphere this singles out the great circles, and λ(s)\lambda(s) measures the normal curvature the surface imposes. Why this is a geodesic: a curve that bends only as forced by its surface is the straightest possible path confined to it. *Why this is correct: on the unit sphere the solution is a great circle, and λ(s)\lambda(s) equals the normal curvature the sphere imposes on the path.*

Limiting cases

The augmented machinery collapses onto familiar unconstrained and finite-dimensional results in each limit.

CaseResultMeaning
No constraintλ→0\lambda\to 0With KK or gg absent, Φ→F\Phi\to F and the ordinary Euler–Lagrange equation is recovered.
Finite-dimensional∇f=λ ∇g\nabla f=\lambda\,\nabla gWhen the "functional" depends on finitely many variables it is an ordinary function, and the method is calculus Lagrange multipliers.
Pointwise vs integralλ(x) vs λ=const\lambda(x)\ \text{vs}\ \lambda=\text{const}A continuum of constraints needs a multiplier field; one global constraint needs a single constant.
Degenerate constraintδK[y0]=0\delta K[y_0]=0If the constraint is stationary at the candidate (an abnormal extremal), the rule may fail and JJ itself must be adjoined with its own multiplier.

Worked examples

1 · Maximum-entropy dice: the multiplier is an inverse temperature

A six-sided die is loaded so that its long-run mean is ⟨i⟩=4.5\langle i\rangle=4.5 instead of the unbiased 3.53.5. Of all distributions with that mean, which is the least presumptuous — the one of maximum entropy — and what does the constraint's Lagrange multiplier turn out to be?

Step 1. Set up the constrained extremum. Maximize the Gibbs entropy S=−∑i=16piln⁡piS=-\sum_{i=1}^6 p_i\ln p_i subject to two constraints: normalization ∑ipi=1\sum_i p_i=1 and the mean ∑ii pi=4.5\sum_i i\,p_i=4.5. Two constraints means two multipliers, α\alpha for normalization and β\beta for the mean.

Step 2. Extremize the augmented function. Setting ∂/∂pi[−∑piln⁡pi−α∑pi−β∑i pi]=0\partial/\partial p_i\big[-\sum p_i\ln p_i-\alpha\sum p_i-\beta\sum i\,p_i\big]=0 gives −ln⁡pi−1−α−βi=0-\ln p_i-1-\alpha-\beta i=0, hence pi=e−βi/Zp_i=e^{-\beta i}/Z with Z=∑i=16e−βiZ=\sum_{i=1}^6 e^{-\beta i} absorbing the normalization multiplier. This is the Boltzmann form — an exponential in the constrained quantity, with β\beta the multiplier on it.

Step 3. Fix β\beta by re-imposing the constraint. Requiring ⟨i⟩=− dln⁡Z/dβ=4.5\langle i\rangle=-\,\mathrm{d}\ln Z/\mathrm{d}\beta=4.5 is one transcendental equation for β\beta; solving it numerically gives \boldsymbol{\beta=-0.371} (equivalently e−β=1.449e^{-\beta}=1.449). The multiplier is negative because we forced the mean above the unbiased value, tilting weight toward the high faces — a formal negative temperature.

Step 4. Read off the distribution and check it. The probabilities are p1=0.054, p2=0.079, p3=0.114, p4=0.165, p5=0.240, p6=0.347p_1=0.054,\ p_2=0.079,\ p_3=0.114,\ p_4=0.165,\ p_5=0.240,\ p_6=0.347; they sum to 11, give ⟨i⟩=4.5\langle i\rangle=4.5 by construction, and yield entropy S=1.614S=1.614 nats — below the unconstrained maximum ln⁡6=1.792\ln 6=1.792 nats, as it must be once a constraint bites. The multiplier β is exactly the inverse temperature of statistical mechanics: had the constraint been energy, β=1/kBT\beta=1/k_BT and pi∝e−βEip_i\propto e^{-\beta E_i} would be the Boltzmann distribution itself.

2 · Rayleigh–Ritz: the multiplier is an energy eigenvalue

Estimate the ground-state energy of a particle of mass mm in an infinite square well of width LL (potential zero on [0,L][0,L], infinite outside) by extremizing ⟨H⟩\langle H\rangle subject to normalization, using the simple trial function ψ(x)=x(L−x)\psi(x)=x(L-x).

Step 1. Frame it as a constrained variation. Minimize ⟨H⟩=∫0Lψ∗H^ψ dx\langle H\rangle=\int_0^L\psi^*\hat H\psi\,\mathrm{d}x subject to ∫0L∣ψ∣2 dx=1\int_0^L|\psi|^2\,\mathrm{d}x=1. Equation (6) tells us the multiplier on the normalization is the energy eigenvalue: the stationary value of the Rayleigh quotient is an upper bound on the true ground-state energy.

Step 2. Form the Rayleigh quotient with the trial function. With H^=−(ℏ2/2m) d2/dx2\hat H=-(\hbar^2/2m)\,\mathrm{d}^2/\mathrm{d}x^2, integrate by parts to get ⟨H⟩=ℏ22m∫0Lψ′2 dx∫0Lψ2 dx\langle H\rangle=\dfrac{\hbar^2}{2m}\dfrac{\int_0^L\psi'^2\,\mathrm{d}x}{\int_0^L\psi^2\,\mathrm{d}x}. The trial ψ=x(L−x)\psi=x(L-x) vanishes at both walls, so it is admissible.

Step 3. Evaluate the two integrals. With ψ′=L−2x\psi'=L-2x, the numerator is ∫0L(L−2x)2 dx=L3/3\int_0^L(L-2x)^2\,\mathrm{d}x=L^3/3, and the denominator is ∫0Lx2(L−x)2 dx=L5/30\int_0^L x^2(L-x)^2\,\mathrm{d}x=L^5/30. Their ratio is 10/L210/L^2, so ⟨H⟩=ℏ22m⋅10L2=5ℏ2mL2\langle H\rangle=\dfrac{\hbar^2}{2m}\cdot\dfrac{10}{L^2}=\dfrac{5\hbar^2}{mL^2}.

Step 4. Compare with the exact answer. The true ground state is E1=π2ℏ22mL2=4.9348 ℏ2mL2E_1=\dfrac{\pi^2\hbar^2}{2mL^2}=\dfrac{4.9348\,\hbar^2}{mL^2}. The estimate 5.000 ℏ2/mL2\mathbf{5.000\,\hbar^2/mL^2} sits just 1.32 % above it — and above, never below, because the multiplier (the stationary Rayleigh quotient) is a rigorous upper bound on the lowest eigenvalue. A crude parabola pins the ground-state energy to better than 2 % in one line — the whole engine of the Rayleigh–Ritz method.

Physics of the portrait

Constrained variation is where geometry, mechanics, and probability meet, and one name presides over all three: the man who turned his predecessors' ad-hoc constraint tricks into a single systematic calculus.

Origins · 1 minJoseph-Louis Lagrange and how this was discovered
JL
Joseph-Louis Lagrange
1736–1813 · calculus of variations and analytical mechanics

Born Giuseppe Lodovico Lagrangia in Turin, Lagrange announced himself at nineteen with a letter to Euler in 1755 that recast the young calculus of variations in purely analytic form — the δ\delta-operator and systematic treatment of variations that still bear his imprint. Euler, who had built the subject on delicate geometric arguments, was so taken with the cleaner method that he held back his own work so the newcomer could publish first. Over the next decades Lagrange made the multiplier his signature tool. In the Mécanique analytique of 1788 — a book he boasted held not a single diagram — he showed that all of mechanics flows from a variational principle, and that constraints (a bead on a wire, a rigid rod, a rolling contact) need not be solved away by clever coordinates but can be adjoined to the action with undetermined multipliers whose values are the constraint forces themselves. This is the origin of the phrase "Lagrange's undetermined multipliers." Stripped to finite dimensions it is the ∇f=λ∇g\nabla f=\lambda\nabla g rule of multivariable calculus; promoted back to function space it is the augmented Euler–Lagrange equation of this article. He spent his last years in Paris presiding over the commission that designed the metric system, and lent his name to the equilibrium points of the three-body problem and the remainder form in Taylor's theorem.

History
1696
— Johann Bernoulli poses the brachistochrone, seeding the calculus of variations
1744
— Euler's Methodus inveniendi gives the first systematic theory of isoperimetric problems
1755
— the nineteen-year-old Lagrange sends Euler the analytic δ-variation method
1788
— Lagrange's Mécanique analytique adjoins constraints to the action with undetermined multipliers
1877
— Rayleigh's Theory of Sound turns the constrained quotient into a variational bound on eigenvalues

Going further

Texts. Stone & Goldbart, Mathematics for Physics, ch. 1 (Calculus of Variations) · Arfken & Weber, Mathematical Methods for Physicists, 7th ed., ch. 22 · Riley, Hobson & Bence, Mathematical Methods for Physics and Engineering, 3rd ed., ch. 22 · Gelfand & Fomin, Calculus of Variations, ch. 1–2 (the cleanest proof of the isoperimetric rule) · Lanczos, The Variational Principles of Mechanics, ch. II (multipliers as constraint forces) · Hassani, Mathematical Physics, ch. on variational methods. The multiplier theorem (Derivation 1) uses a two-parameter argument; specializing it recovers ∇f=λ∇g\nabla f=\lambda\nabla g of equation (1). The catenary is y=ccosh⁡(x/c)y=c\cosh(x/c) with c=T0/ρgc=T_0/\rho g. The isoperimetric figure uses r=P/2π=0.637r=P/2\pi=0.637 m, A=P2/4π=1.273A=P^2/4\pi=1.273 m² for P=4P=4 m, saturating 4πA≤P24\pi A\le P^2. Worked example 1 (maximum-entropy dice, mean 4.54.5) gives β=−0.371\beta=-0.371, p=(0.054,0.079,0.114,0.165,0.240,0.347)p=(0.054,0.079,0.114,0.165,0.240,0.347), S=1.614S=1.614 nats <ln⁡6<\ln 6; the identification β=1/kBT\beta=1/k_BT is textbook MaxEnt. Worked example 2 (Rayleigh–Ritz, ψ=x(L−x)\psi=x(L-x)) gives ⟨H⟩=5ℏ2/mL2\langle H\rangle=5\hbar^2/mL^2 versus exact π2ℏ2/2mL2=4.9348 ℏ2/mL2\pi^2\hbar^2/2mL^2=4.9348\,\hbar^2/mL^2, a 1.32 % upper bound.

Prerequisites. First Variation and Stationarity · Euler–Lagrange Equation · Fundamental Lemma of the Calculus of Variations · Functionals and Function Spaces. Leads to. Isoperimetric Problems · Geodesics as Variational Problems · Lagrangian Mechanics · Hamilton's Principle of Stationary Action.

Ask the tutor: Ask me to work any constrained problem end to end — pick the catenary, the isoperimetric circle, a geodesic, or a Rayleigh–Ritz eigenvalue, and we will build the augmented functional, extremize, and pin down exactly what its multiplier means.

Why can I get away with treating δy as free once I add the multiplier?

Because the multiplier is chosen to cancel exactly the correlated part of the variation. On the constraint surface the variations at different points are linked — you cannot wiggle yy freely without violating K[y]=ℓK[y]=\ell. Derivation 1 shows that adjoining λ\lambda and setting δ(J−λK)=0\delta(J-\lambda K)=0 removes that link: the value λ=J2/K2\lambda=J_2/K_2 makes the coefficient of the dependent variation vanish, leaving a genuinely independent variation to which the fundamental lemma applies. So "treating δy\delta y as free" is legitimate precisely because the multiplier has absorbed the constraint's correlation.

When is the multiplier a constant and when is it a function?

It depends on how many constraints you really have. An integral (isoperimetric) constraint such as fixed length or fixed normalization is a single equation about the whole curve, so it removes one degree of freedom and is bought back with one constant λ\lambda. A holonomic (pointwise) constraint such as "the curve lies on this surface" must hold separately at every point of the interval — infinitely many independent conditions — so it requires an independent multiplier at each point, which assembles into a function λ(x)\lambda(x). A quick test: if you can write the constraint as "∫(… ) dx=\int(\dots)\,\mathrm{d}x= number", it is one constant; if it is "(… )=0(\dots)=0 for all xx", it is a function.

Is the multiplier physically meaningful or just a bookkeeping device?

Almost always meaningful. The reason the method is beloved in physics is that the multiplier you are forced to introduce turns out to be the quantity you most wanted: the horizontal tension in the catenary, the radius of the optimal circle in the isoperimetric problem, the eigenvalue (energy) in Sturm–Liouville and Schrödinger problems, the inverse temperature β=1/kBT\beta=1/k_BT or chemical potential in statistical mechanics, the reaction force in constrained Lagrangian mechanics. If you ever find yourself discarding a multiplier as clutter, stop and ask what it measures — it is usually the answer.

How does this reduce to the ∇f = λ∇g I learned in multivariable calculus?

Directly. If the "functional" depends on only finitely many variables, J=f(x1,…,xn)J=f(x_1,\dots,x_n), with constraints ga(x)=0g_a(\mathbf x)=0, there is no integral and no Euler–Lagrange derivative — the augmented condition ∇(f−∑aλaga)=0\nabla\big(f-\sum_a\lambda_a g_a\big)=0 is just ∇f=∑aλa∇ga\nabla f=\sum_a\lambda_a\nabla g_a, equation (1). The variational method is the same statement lifted to infinite dimensions, where the gradient becomes the Euler–Lagrange expression and the finite sum of multipliers can become a multiplier function.

What is the difference between a holonomic and an isoperimetric constraint?

An isoperimetric constraint is integral: it fixes the value of a functional, like the total length ∫1+y′2 dx=L\int\sqrt{1+y'^2}\,\mathrm{d}x=L or the normalization ∫∣ψ∣2=1\int|\psi|^2=1. It constrains a global number and costs one constant multiplier. A holonomic constraint is pointwise and algebraic: a relation g(y,x)=0g(y,x)=0 the solution must satisfy at every point, like "the bead stays on the wire" — an identity holding everywhere, which costs a multiplier function. The names are historical: "isoperimetric" from the original fixed-perimeter problem, and "holonomic" (from Hertz) for constraints expressible as integrable, position-only relations.

Can the multiplier method ever fail?

Yes, in the degenerate or "abnormal" case. Derivation 1 assumed K2≠0K_2\neq0 — that the constraint actually responds to variation at the candidate curve. If instead the constraint is itself stationary there, δK[y0]=0\delta K[y_0]=0 for all admissible variations, the ratio λ=J2/K2\lambda=J_2/K_2 is undefined and the simple rule breaks down. The fix is the symmetric statement μ0 δJ+μ1 δK=0\mu_0\,\delta J+\mu_1\,\delta K=0 with the two multipliers not both zero, allowing μ0=0\mu_0=0 where the objective plays no role. Such extremals are rare in physics, but they are why careful texts state the rule with this extra generality.

Before this

Where this leads