Calculus of Variations: The Geometry of Functional Optimization
The Calculus of Variations (CoV) represents a transition from the optimization of finite-dimensional vectors to the optimization of infinite-dimensional objects—functions. While standard differential calculus identifies critical points of a function , CoV identifies “critical functions” that extremize a functional . This field is the mathematical foundation of Lagrangian mechanics, general relativity, and minimal surface theory.
1. Functionals and the Domain of Optimization
A functional is a mapping from a function space (typically a Sobolev space or space) to the real numbers. The canonical form encountered in physics and geometry is the integral functional:
Here, is the Lagrangian. The domain is usually restricted by Dirichlet boundary conditions: and . The goal is to find such that is a local extremum.
2. The First Variation and Stationary Conditions
To find an extremum, we consider a variation , where is a small parameter and is a smooth “test function” satisfying . The variation of the functional is defined as the Gâteaux derivative:
For to be a stationary point, we require for all admissible . Using the chain rule:
Applying integration by parts to the second term:
Since vanishes at the boundaries, the first term disappears. The condition becomes:
3. The Euler-Lagrange Equation
By the Fundamental Lemma of the Calculus of Variations, if the integral of is zero for every smooth with compact support, then must be zero. This yields the Euler-Lagrange Equation:
This second-order differential equation is the necessary condition for to be an extremizer.
The Beltrami Identity
When the Lagrangian has no explicit dependence on (), the E-L equation admits a first integral:
In physics, this constant often represents the conservation of energy.
4. Classical Variational Problems
4.1 Geodesics: Shortest Paths
A geodesic is a curve that extremizes the distance functional . On a plane, , so . The E-L equation reduces to , implying is constant—a straight line. On curved manifolds, geodesics are governed by the metric tensor and the Christoffel symbols.
4.2 The Brachistochrone
The problem of finding the curve that minimizes the time of travel for a mass sliding under gravity. Using conservation of energy , the time functional is:
Applying the Beltrami Identity to leads to the differential equation for a cycloid.
5. Constraints and Lagrange Multipliers
In “Isoperimetric” problems, we extremize subject to a constraint . We construct the augmented Lagrangian:
where is a constant Lagrange multiplier. An example is finding the shape of a hanging chain (the Catenary), which minimizes gravitational potential energy subject to a fixed length.
6. From Lagrangian to Hamiltonian Dynamics
The transition to Hamiltonian mechanics involves a Legendre transform. We define the generalized momentum:
The Hamiltonian is defined as . This transforms the second-order E-L equation into a system of two first-order equations:
This “canonical” form is central to quantum mechanics and statistical field theory.
7. Noether’s Theorem: Symmetry and Conservation
Noether’s Theorem states that for every continuous symmetry of the action , there is a corresponding conserved quantity.
Suppose is invariant under a transformation . Then: Substituting the E-L equation : Thus, is a constant of motion.
8. The Second Variation and Legendre’s Condition
To distinguish between a minimum and a maximum, we look at . A necessary condition for a minimum is Legendre’s Condition:
If along the path, the stationary point is a local maximum.
9. Python Implementation: Numerical Shooting Method
Analytic solutions are rare. Here we solve the Brachistochrone ODE using a boundary value problem solver.
import numpy as np
from scipy.integrate import solve_bvp
import matplotlib.pyplot as plt
def brachistochrone_ode(x, y):
# y[0] is position, y[1] is derivative y'
# Adding a small epsilon to avoid division by zero at y=0
return np.vstack((y[1], -(1 + y[1]**2) / (2 * (y[0] + 1e-6))))
def boundary_conditions(ya, yb):
# Start at height 1.0, end at height 0.2
return np.array([ya[0] - 1.0, yb[0] - 0.2])
x_nodes = np.linspace(0, 1, 100)
y_initial = np.linspace(1, 0.2, 100).reshape(1, -1)
yp_initial = np.zeros((1, 100))
y_guess = np.vstack((y_initial, yp_initial))
sol = solve_bvp(brachistochrone_ode, boundary_conditions, x_nodes, y_guess)
if sol.success:
plt.plot(sol.x, sol.y[0], label='Numerical Brachistochrone')
plt.gca().invert_yaxis()
plt.legend()
plt.show()