Mathwords logoMathwords

Calculus of Variations — Definition, Formula & Examples

Calculus of variations is a branch of mathematical analysis that finds the function (not just a number) which maximizes or minimizes a given integral expression called a functional. Instead of asking 'what value of x minimizes f(x)?' it asks 'what entire curve y(x) minimizes a quantity that depends on y and its derivatives?'

The calculus of variations seeks extremals of functionals of the form J[y]=abF(x,y,y)dxJ[y] = \int_a^b F(x, y, y') \, dx, where yy belongs to a specified class of admissible functions satisfying given boundary conditions. A necessary condition for y(x)y(x) to be an extremal is that it satisfy the Euler–Lagrange equation FyddxFy=0\frac{\partial F}{\partial y} - \frac{d}{dx}\frac{\partial F}{\partial y'} = 0.

Key Formula

FyddxFy=0\frac{\partial F}{\partial y} - \frac{d}{dx}\frac{\partial F}{\partial y'} = 0
Where:
  • F(x,y,y)F(x, y, y') = The integrand of the functional, depending on x, y, and dy/dx
  • y(x)y(x) = The unknown function to be determined
  • yy' = The first derivative dy/dx

How It Works

You start with a functional — an integral whose value depends on your choice of function y(x)y(x). To find the function that makes this integral stationary (a maximum, minimum, or saddle point), you derive and solve the Euler–Lagrange equation. This ODE acts as the analog of setting a derivative equal to zero in ordinary calculus. The solution, combined with the boundary conditions y(a)=yay(a) = y_a and y(b)=yby(b) = y_b, gives you the extremal function. Extensions handle multiple dependent variables, higher-order derivatives, and constraints via Lagrange multipliers.

Worked Example

Problem: Find the curve y(x) that minimizes the functional J[y]=01(y)2dxJ[y] = \int_0^1 (y')^2 \, dx subject to y(0)=0y(0) = 0 and y(1)=3y(1) = 3.
Identify F: Here the integrand is F(x,y,y)=(y)2F(x, y, y') = (y')^2. Compute the needed partial derivatives.
Fy=0,Fy=2y\frac{\partial F}{\partial y} = 0, \quad \frac{\partial F}{\partial y'} = 2y'
Apply Euler–Lagrange: Substitute into the Euler–Lagrange equation.
0ddx(2y)=0    y=00 - \frac{d}{dx}(2y') = 0 \implies y'' = 0
Solve the ODE: The general solution is a straight line. Apply the boundary conditions to find the constants.
y=Ax+B,y(0)=0B=0,y(1)=3A=3y = Ax + B, \quad y(0)=0 \Rightarrow B=0, \quad y(1)=3 \Rightarrow A=3
Answer: The minimizing curve is y(x)=3xy(x) = 3x, a straight line — confirming that the shortest path (in this metric) between two points is a line.

Why It Matters

The calculus of variations underpins Lagrangian and Hamiltonian mechanics, where the equations of motion arise from extremizing the action integral. It is essential in optimal control theory, general relativity (geodesics), and machine learning (variational autoencoders). Physics, aerospace engineering, and economics courses at the advanced undergraduate level all rely on it.

Common Mistakes

Mistake: Treating a functional like an ordinary function and trying to 'take the derivative and set it to zero' without using the Euler–Lagrange equation.
Correction: A functional maps an entire function to a number, not a point to a number. You must use variational methods — specifically the Euler–Lagrange equation — to find extremals.