Euler–Lagrange Equation
A practical guide to the Euler–Lagrange equation: the core result of calculus of variations used in Lagrangian mechanics and many optimisation problems.
Continue where you stopped
The core idea
On this page
The Euler–Lagrange equation is the core result of calculus of variations: it tells you how to find a function y(x) that makes an integral “as small as possible” (or as large).
It is the mathematical engine behind Lagrangian mechanics, but it also appears in optics (Fermat’s principle), geometry (shortest paths), and many optimisation problems.
1) The standard setup
You want to extremise a functional of the form:
where y' = dy/dx and F is a function you know.
The Euler–Lagrange equation is:
- Write down F(x,y,y') from the integral.
- Compute ∂ F/∂ y and ∂ F/∂ y'.
- Plug into the Euler–Lagrange equation and solve the resulting ODE.
- Use boundary/initial conditions to fix constants.
2) How it looks in mechanics (the form you actually use)
In Lagrangian mechanics you extremise the action:
where q(t) is a coordinate (or a set of coordinates) and q dot = dq/dt.
This is the same Euler–Lagrange idea with the mapping:
- x → t
- y → q(t)
- y' → q dot (t)
- F → L (the Lagrangian)
So the Euler–Lagrange equation becomes:
For many standard systems:
3) Two high-value shortcuts (“first integrals”)
A. If F does not depend on y explicitly
If ∂ F/∂ y = 0, then
B. If F does not depend on x explicitly (Beltrami identity)
If ∂ F/∂ x = 0, then
4) Worked example (minimal “energy” curve)
Minimise
subject to y(0) = 0 and y(1) = 1.
Here F = (y')². Since F does not depend on y explicitly, use the shortcut:
Compute:
Apply boundary conditions:
- y(0) = 0 ⇒ C = 0
- y(1) = 1 ⇒ k = 1
So the minimiser is:
5) Worked physics example: mass–spring oscillator
Consider a mass m on a spring of constant k with coordinate x(t).
Kinetic energy:
Potential energy:
So the Lagrangian is:
Compute the partial derivatives:
Apply Euler–Lagrange:
This is simple harmonic motion with angular frequency:
General solution:
If you are given initial conditions x(0) = x₀ and x dot (0) = v₀, then:
6) Multiple variables (physics form)
Several dependent variables (many coordinates)
If F = F(x,y₁,…,yₙ,y₁',…,yₙ'), then for each i:
Fields (several independent variables)
For a field φ(x₁,…,xₙ), a common form is:
7) Constraints (Lagrange multipliers)
If you want to extremise I[y] subject to a constraint J[y] = constant, a standard technique is:
and then apply Euler–Lagrange to the combined integrand F + λ G.
Related pages
Matrices and linear algebra
Useful for coupled coordinates and normal modes.
Partial derivatives
You’ll use partial derivatives constantly in variational calculus.