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.

  • University Physics Year 1
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:

I[y] = ∫ₐ^b F(x,y,y') dx,

where y' = dy/dx and F is a function you know.

The Euler–Lagrange equation is:

(d/dx)((∂ F)/(∂ y')) = (∂ F)/(∂ y).
How to use it
  1. Write down F(x,y,y') from the integral.
  2. Compute ∂ F/∂ y and ∂ F/∂ y'.
  3. Plug into the Euler–Lagrange equation and solve the resulting ODE.
  4. 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:

S[q] = ∫_t₁^t₂ L(q,q dot,t) dt,

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:

(d/dt)((∂ L)/(∂ q dot)) = (∂ L)/(∂ q).

For many standard systems:

L = T-V.

3) Two high-value shortcuts (“first integrals”)

A. If F does not depend on y explicitly

If ∂ F/∂ y = 0, then

(d/dx)((∂ F)/(∂ y')) = 0 ⇒ (∂ F)/(∂ y') = constant.

B. If F does not depend on x explicitly (Beltrami identity)

If ∂ F/∂ x = 0, then

F-y'(∂ F)/(∂ y') = constant.

4) Worked example (minimal “energy” curve)

Minimise

I[y] = ∫₀¹ (y')² dx

subject to y(0) = 0 and y(1) = 1.

Here F = (y')². Since F does not depend on y explicitly, use the shortcut:

(∂ F)/(∂ y') = constant.

Compute:

(∂ F)/(∂ y') = 2y' = constant ⇒ y' = k ⇒ y = kx + C.

Apply boundary conditions:

  • y(0) = 0 ⇒ C = 0
  • y(1) = 1 ⇒ k = 1

So the minimiser is:

y = x.

5) Worked physics example: mass–spring oscillator

Consider a mass m on a spring of constant k with coordinate x(t).

Kinetic energy:

T = 1/2 mx dot ².

Potential energy:

V = 1/2 kx².

So the Lagrangian is:

L = T-V = 1/2 mx dot ²-1/2 kx².

Compute the partial derivatives:

(∂ L)/(∂ x) = -kx, (∂ L)/(∂ x dot) = mx dot .

Apply Euler–Lagrange:

(d/dt)(mx dot) = -kx ⇒ mx double dot + kx = 0.

This is simple harmonic motion with angular frequency:

ω = square root of (k/m) .

General solution:

x(t) = A cos(ω t) + B sin(ω t).

If you are given initial conditions x(0) = x₀ and x dot (0) = v₀, then:

x(t) = x₀ cos(ω t) + v₀/ω sin(ω t).

6) Multiple variables (physics form)

Several dependent variables (many coordinates)

If F = F(x,y₁,…,yₙ,y₁',…,yₙ'), then for each i:

(d/dx)((∂ F)/(∂ yᵢ')) = (∂ F)/(∂ yᵢ).

Fields (several independent variables)

For a field φ(x₁,…,xₙ), a common form is:

(∂ F)/(∂ φ) = ∑ᵢ₌₁ⁿ(∂/(∂ xᵢ))((∂ F)/(∂ (∂ φ/∂ xᵢ))).

7) Constraints (Lagrange multipliers)

If you want to extremise I[y] subject to a constraint J[y] = constant, a standard technique is:

K[y] = I[y] + λ J[y]

and then apply Euler–Lagrange to the combined integrand F + λ G.


  • Matrices and linear algebra

    Useful for coupled coordinates and normal modes.

  • Partial derivatives

    You’ll use partial derivatives constantly in variational calculus.


Back to Mathematics for Undergraduate Physics