Variational Calculus
The calculus of variations is concerned with finding functions that extremize (minimize or maximize) functionals — mappings from a space of functions to the real numbers. This framework lies at the heart of classical mechanics (Hamilton's principle), optics (Fermat's principle), general relativity (the Einstein-Hilbert action), and quantum field theory (path integrals). Here we develop the core machinery from first principles, derive the Euler-Lagrange equation, and apply it to celebrated problems including the brachistochrone and geodesics.
1. Functionals and Their Extrema
Ordinary calculus deals with functions $f: \mathbb{R} \to \mathbb{R}$ and finding points $x^*$ where$f'(x^*) = 0$. The calculus of variations generalizes this to functionals, which are mappings from a space of functions to the reals.
Definition. A functional $J[y]$ assigns a real number to each function$y(x)$ in some admissible class. The canonical form is:
where $F$ is a given function of three arguments called the Lagrangian (or integrand), and $y' = dy/dx$. The square brackets in $J[y]$ are conventional notation emphasizing that$J$ depends on the entire function $y(x)$, not just on its value at a point.
Examples of Functionals
- Arc length: $J[y] = \int_a^b \sqrt{1 + (y')^2}\, dx$ with $F = \sqrt{1 + (y')^2}$.
- Surface of revolution area: $J[y] = 2\pi \int_a^b y\sqrt{1 + (y')^2}\, dx$.
- Action in mechanics: $S[q] = \int_{t_1}^{t_2} L(q, \dot{q}, t)\, dt$ where $L = T - V$ is the Lagrangian.
- Optical path length: $J[y] = \int_a^b n(x,y)\sqrt{1 + (y')^2}\, dx$ where $n$ is the refractive index.
Boundary Conditions
We typically seek extrema among functions satisfying fixed boundary conditions:
The admissible class consists of all sufficiently smooth functions satisfying these endpoint conditions. A function $y^*(x)$ is an extremal if $J[y^*]$ is stationary with respect to all admissible variations. To make this precise, we introduce the concept of the first variation.
2. The Euler-Lagrange Equation: Full Derivation
Let $y^*(x)$ be the extremal function. Consider a one-parameter family of comparison functions:
where $\epsilon$ is a small parameter and $\eta(x)$ is an arbitrary smooth function satisfying$\eta(a) = \eta(b) = 0$ (so the boundary conditions are preserved). The functional becomes a function of $\epsilon$:
For $y^*$ to be an extremal, we need $\Phi'(0) = 0$ for all admissible $\eta$. Differentiating under the integral sign:
Setting $\epsilon = 0$ gives the first variation:
Integration by Parts
The key step is to integrate the second term by parts. Let $u = \partial F/\partial y'$ and $dv = \eta'\, dx$:
The boundary term vanishes because $\eta(a) = \eta(b) = 0$. Therefore:
The Fundamental Lemma
We invoke the fundamental lemma of the calculus of variations: if$\int_a^b g(x)\,\eta(x)\,dx = 0$ for all smooth $\eta$ vanishing at the endpoints, and $g$ is continuous, then $g(x) \equiv 0$ on $[a,b]$.
Applying the lemma yields the Euler-Lagrange equation:
This is a second-order ODE for $y(x)$ (since the total derivative $d/dx$ of $\partial F/\partial y'$generally involves $y''$). It is the necessary condition for $y$ to be an extremal.
Beltrami Identity (When F Does Not Depend on x Explicitly)
If $F = F(y, y')$ (no explicit $x$-dependence), there is a first integral. Compute:
where we used the Euler-Lagrange equation in the last step. Thus:
This reduces the problem from a second-order to a first-order ODE, which is a significant simplification. In mechanics, when the Lagrangian has no explicit time dependence, the Beltrami identity gives conservation of energy.
3. The Brachistochrone Problem
The brachistochrone ("shortest time" in Greek) was posed by Johann Bernoulli in 1696: find the curve connecting two points along which a bead slides (frictionlessly, under gravity) in the least time.
Setting Up the Functional
Let the bead start from rest at the origin and slide to point $(x_1, y_1)$ with $y$ measured downward. Conservation of energy gives the speed:
The time to traverse an infinitesimal arc length $ds = \sqrt{dx^2 + dy^2}$ is $dt = ds/v$. Using$y$ as the independent variable and writing $x = x(y)$:
Here $x' = dx/dy$ and the integrand is $F(y, x, x') = \sqrt{(1 + x'^2)/(2gy)}$. Since $F$ does not depend explicitly on $x$, the Euler-Lagrange equation gives a first integral (the Beltrami identity adapted for the absent variable):
Solution: The Cycloid
After algebraic manipulation, setting the constant as $1/\sqrt{2g \cdot 2a}$, we find:
The substitution $y = a(1 - \cos\theta)$ yields $dy = a\sin\theta\, d\theta$ and:
where we used the half-angle identities. Integrating:
This is the parametric equation of a cycloid — the curve traced by a point on the rim of a circle of radius $a$ rolling along a horizontal line. The parameter $a$ is determined by the endpoint condition $(x_1, y_1)$.
4. Geodesics
A geodesic is a curve of extremal length on a surface or in a Riemannian manifold. In general relativity, freely falling particles follow geodesics of spacetime.
Geodesics in a General Metric
On a surface with metric $ds^2 = g_{ij}\, dx^i\, dx^j$, the arc length functional is:
Applying the Euler-Lagrange equation to this functional yields the geodesic equation:
where $\Gamma^\mu_{\alpha\beta}$ are the Christoffel symbols derived from the metric.
Geodesics on a Sphere
On a sphere of radius $R$, the metric is $ds^2 = R^2(d\theta^2 + \sin^2\theta\, d\phi^2)$. Using $\theta$ as the independent variable, the arc length becomes:
Since $F$ does not depend on $\phi$ explicitly, the Euler-Lagrange equation gives:
This is Clairaut's relation. Solving for $\phi'$ and integrating gives great circles as the geodesics on a sphere, confirming that the shortest path between two points on a sphere is an arc of a great circle.
5. Isoperimetric Problems and Lagrange Multipliers
The classical isoperimetric problem asks: among all closed curves of a given perimeter, which encloses the maximum area? The answer is a circle. More generally, we want to extremize a functional subject to constraints.
Constrained Variational Problems
Suppose we wish to extremize $J[y] = \int_a^b F(x, y, y')\, dx$ subject to the constraint:
By analogy with finite-dimensional optimization, we introduce a Lagrange multiplier $\lambda$and form the augmented functional:
The extremal satisfies the Euler-Lagrange equation for the combined integrand $\tilde{F} = F + \lambda G$:
Example: Maximum Area for Fixed Perimeter
For a curve $y(x)$ from $(0,0)$ to $(L,0)$, the enclosed area is$A[y] = \int_0^L y\, dx$ and the arc length constraint is$\int_0^L \sqrt{1 + y'^2}\, dx = \ell$. The augmented integrand is:
The Euler-Lagrange equation yields:
Solving gives $(x - c_1)^2 + (y - c_2)^2 = \lambda^2$, which is a circle of radius $|\lambda|$. This confirms that among all curves of fixed length, the circle encloses the greatest area.
Multiple Constraints
With $m$ constraints $K_j[y] = \ell_j$ for $j = 1, \ldots, m$, we introduce multipliers$\lambda_1, \ldots, \lambda_m$ and extremize:
This technique extends naturally to higher-dimensional problems and is the foundation of the method used in quantum mechanics for constrained optimization (e.g., the Rayleigh-Ritz method for finding bound-state energies).
6. Hamilton's Principle
Hamilton's principle (the principle of stationary action) states that the physical trajectory of a mechanical system between times $t_1$ and $t_2$ is the one that makes the action stationary:
where $L = T - V$ is the Lagrangian, $q_i$ are generalized coordinates, and $\dot{q}_i = dq_i/dt$.
Derivation of Lagrange's Equations from Hamilton's Principle
Applying the Euler-Lagrange equation to the action with $F = L$, $y \to q_i$, $y' \to \dot{q}_i$, $x \to t$:
These are the Lagrange equations of motion. For a particle with$L = \frac{1}{2}m\dot{x}^2 - V(x)$:
recovering Newton's second law.
The Hamiltonian and Legendre Transform
The Beltrami identity applied to the action (when $L$ has no explicit time dependence) gives:
This is the Hamiltonian, and its conservation is the energy conservation theorem. Defining the conjugate momenta $p_i = \partial L / \partial \dot{q}_i$, we write$H = H(q_i, p_i, t)$ via the Legendre transform. Hamilton's equations follow:
7. Noether's Theorem from the Variational Perspective
Emmy Noether's theorem (1918) establishes a deep connection between symmetries and conservation laws. We derive it within the variational framework.
Statement
Theorem (Noether): If the action $S = \int L\, dt$ is invariant under a continuous one-parameter family of transformations $q_i \to q_i + \epsilon\, \xi_i(q, t)$,$t \to t + \epsilon\, \tau(q, t)$, then the quantity
is conserved along physical trajectories ($dI/dt = 0$).
Derivation
Consider an infinitesimal transformation with parameter $\epsilon$:
Invariance of the action means $\delta S = 0$ to first order in $\epsilon$. The change in the action has two contributions: the change in the integrand and the change in the limits. After careful computation (using the chain rule and the Leibniz rule for the endpoint variation):
The first group of terms vanishes by the Euler-Lagrange equations (since we evaluate on physical trajectories). Since $\delta S = 0$ and $t_1, t_2$ are arbitrary, the integrand of the remaining total derivative must vanish:
Applications
- Time translation ($\tau = 1, \xi_i = 0$): Conserved quantity is $-H = -(T+V)$, giving energy conservation.
- Spatial translation ($\tau = 0, \xi_j = \delta_{ij}$): Conserved quantity is $p_i$, giving momentum conservation.
- Rotation ($\tau = 0$, $\xi_i$ generates rotation): Conserved quantity is a component of angular momentum, giving angular momentum conservation.
Noether's theorem has far-reaching consequences in quantum field theory, where gauge symmetries lead to conserved currents (electric charge, color charge, etc.) and the Ward-Takahashi identities.
8. Extensions of the Euler-Lagrange Framework
Several Dependent Variables
For a functional depending on $n$ functions $y_1(x), \ldots, y_n(x)$:
we obtain $n$ coupled Euler-Lagrange equations:
Higher Derivatives
If the integrand depends on higher derivatives $y''$, the functional$J = \int_a^b F(x, y, y', y'')\, dx$ leads to the Euler-Poisson equation:
This arises in elasticity theory (Euler-Bernoulli beam equation) and in certain higher-derivative field theories.
Functionals of Several Independent Variables
For field theories, we need functionals of the form$J[\phi] = \int \mathcal{L}(\phi, \partial_\mu\phi, x^\mu)\, d^4x$ where $\phi$ is a field. The corresponding Euler-Lagrange equation is:
This is the equation of motion for a classical field. For the Klein-Gordon Lagrangian$\mathcal{L} = \frac{1}{2}(\partial_\mu\phi)(\partial^\mu\phi) - \frac{1}{2}m^2\phi^2$, the Euler-Lagrange equation gives $(\Box + m^2)\phi = 0$, the Klein-Gordon equation.
9. Python Simulation: Brachistochrone and Geodesics
Below we verify the variational calculus results computationally. We compare the brachistochrone (cycloid) against straight-line and circular-arc paths, compute travel times numerically, and visualize geodesics on a sphere.
Click Run to execute the Python code
Code will be executed with Python 3 on the server
10. Summary and Connections
The calculus of variations provides a unifying framework that permeates theoretical physics:
| Concept | Key Result | Physics Application |
|---|---|---|
| Euler-Lagrange equation | $\partial_y F - \frac{d}{dx}\partial_{y'} F = 0$ | Equations of motion |
| Beltrami identity | $F - y' F_{y'} = C$ | Energy conservation |
| Brachistochrone | Cycloid | Optimal transport |
| Geodesic equation | $\ddot{x}^\mu + \Gamma^\mu_{\alpha\beta}\dot{x}^\alpha\dot{x}^\beta = 0$ | General relativity |
| Isoperimetric / multipliers | Augmented Euler-Lagrange | Constrained optimization |
| Hamilton's principle | $\delta S = 0$ | All of classical mechanics |
| Noether's theorem | Symmetry $\Leftrightarrow$ conservation law | QFT, gauge theories |
The variational perspective reveals that the fundamental laws of physics are not arbitrary differential equations but rather consequences of extremizing action functionals. This insight extends to quantum mechanics through Feynman's path integral formulation, where a particle explores all possible paths weighted by$e^{iS/\hbar}$, and the classical trajectory emerges in the limit $\hbar \to 0$ via stationary phase.