The Principle of Least Action

Jason Gross, December 7, 2010
Last Updated September 23, 2023

Introduction

Recall that we defined the Lagrangian to be the kinetic energy less potential energy, L=K-U, at a point.  The action is then defined to be the integral of the Lagrangian along the path,

S==(∫_(Subscript[t, 0])^(Subscript[t, 1]))Ldt==(∫_(Subscript[t, 0])^(Subscript[t, 1]))K-Udt

It is (remarkably!) true that, in any physical system, the path an object actually takes minimizes the action.  It can be shown that the extrema of action occur at

((∂L)/(∂q))-(d/(dt))((∂L)/(∂(OverDot[q])))==0

This is called the Euler equation, or the Euler-Lagrange Equation.

Derivation

Courtesy of Scott Hughes’s Lecture notes for 8.033.  (Most of this is copied almost verbatim from that.)

Suppose we have a function f(x,(OverDot[x]);t) of a variable x and its derivative (OverDot[x])==dx/dt.  We want to find an extremum of

J=(∫_(Subscript[t, 0])^(Subscript[t, 1]))f(x(t),(OverDot[x])(t);t)dt

Our goal is to compute x(t) such that J is at an extremum.  We consider the limits of integration to be fixed.  That is, x((Subscript[t, 1])) will be the same for any x we care about, as will x((Subscript[t, 2])).

Imagine we have some x(t) for which J is at an extremum, and imagine that we have a function which parametrizes how far our current path is from our choice of x:

x(t;α)=x(t)+α A(t)

The function A is totally arbitrary, except that we require it to vanish at the endpoints: A((Subscript[t, 0]))=A((Subscript[t, 1]))=0.  The parameter α allows us to control how the variation A(t) enters into our path x(t;α).

The “correct” path x(t) is unknown; our goal is to figure out how to construct it, or to figure out how f behaves when we are on it.

Our basic idea is to ask how does the integral J behave when we are in the vicinity of the extremum.  We know that ordinary functions are flat --- have zero first derivative --- when we are at an extremum.  So let us put

J(α)=(∫_(Subscript[t, 0])^(Subscript[t, 1]))f(x(t;α),(OverDot[x])(t;α);t)dt

We know that α=0 corresponds to the extremum by definition of α.  However, this doesn’t teach us anything useful, sine we don’t know the path x(t) that corresponds to the extremum.

But we also know We know that (Subscript[((∂J)/(∂α))|, α=0])=0 since it’s an extremum.  Using this fact,

((∂J)/(∂α))=(∫_(Subscript[t, 0])^(Subscript[t, 1]))(((∂f)/(∂x)) ((∂x)/(∂α))+((∂f)/(∂(OverDot[x]))) ((∂(OverDot[x]))/(∂α)))dt
((∂x)/(∂α))=(∂/(∂α))(x(t)+α A(t))=A(t)
((∂(OverDot[x]))/(∂α))=(∂/(∂α))(d/(dt))(x(t)+α A(t))=((dA)/(dt))

So

((∂J)/(∂α))=(∫_(Subscript[t, 0])^(Subscript[t, 1]))(((∂f)/(∂x)) A(t)+((∂f)/(∂(OverDot[x])))((dA)/(dt)))dt

Integration by parts on the section term gives

(Subscript[(∫_(Subscript[t, 0])^(Subscript[t, 1]))((∂f)/(∂(OverDot[x])))((dA)/(dt))dt=A(t)((∂f)/(∂(OverDot[x])))|, (Subscript[t, 0])]^(Subscript[t, 1]))-(∫_(Subscript[t, 0])^(Subscript[t, 1]))A(t)(d/(dt))((∂f)/(∂(OverDot[x])))dt

Since A((Subscript[t, 0]))=A((Subscript[t, 1]))=0, the first term dies, and we get

((∂J)/(∂α))=(∫_(Subscript[t, 0])^(Subscript[t, 1]))A(t)(((∂f)/(∂x)) -(d/(dt))((∂f)/(∂(OverDot[x]))))dt

This must be zero.  Since A(t) is arbitrary except at the endpoints, we must have that the integrand is zero at all points:

((∂f)/(∂x)) -(d/(dt))((∂f)/(∂(OverDot[x])))=0

This is what was to be derived.

Least action: F=m a

Suppose we have the Newtonian kinetic energy, K =(1/2)m (v^2), and a potential that depends only on position, U=U((OverVector[r])).  Then the Euler-Lagrange equations tell us the following:

Clear[U,m,r]
L=(1/2) m ((r'[t])^2)-U[r[t]];
(∂_({r[t]}))L-Dt[(∂_({r'[t]}))L,t,Constants->m]==0

Rearrangement gives

-((∂U)/(∂r))=m (Overscript[r, ¨]) 
F=m a

Least action with no potential

Suppose we have no potential, U=0.  Then L=K, so the Euler-Lagrange equations become

((∂K)/(∂q))-(d/(dt))((∂K)/(∂(OverDot[q])))==0

For Newtonian kinetic energy, K =(1/2)m ((OverDot[x])^2), this is just

(d/(dt))m (OverDot[x])==0
m (OverDot[x])=m v
x=(Subscript[x, 0])+v t

This is a straight line, as expected.

Least action with gravitational potential

Suppose we have gravitational potential close to the surface of the earth, U=m g y, and Newtonian kinetic energy, K=(1/2)m ((OverDot[y])^2).  Then the Euler-Lagrange equations become

-m g-(d/(dt))m (OverDot[y])=-m g-m (Overscript[y, ¨])==0
-g=(Overscript[y, ¨])
y=(Subscript[y, 0])+(Subscript[a, y])t-(1/2)g (t^2)

This is a parabola, as expected.

Constants of motion: Momenta

We may rearrange the Euler-Lagrange equations to obtain

((∂L)/(∂q))=(d/(dt))((∂L)/(∂(OverDot[q])))

If it happens that ((∂L)/(∂q))=0, then (d/(dt))((∂L)/(∂(OverDot[q]))) is also zero.  This means that ((∂L)/(∂(OverDot[q]))) is a constant (with respect to time).  We call ((∂L)/(∂(OverDot[q]))) a (conserved) momentum of the system.

Linear Momentum

By noting that Newtonian kinetic energy, K =(1/2)m (v^2), is independent of the time derivatives of position, if potential energy depends only on position, we can infer that ((∂L)/(∂(OverDot[x]))) (and, similarly, ((∂L)/(∂(OverDot[y]))) and ((∂L)/(∂(OverDot[z])))) are constant.  Then ((∂L)/(∂(OverDot[x])))=(∂/(∂(OverDot[x])))((1/2)m ((OverDot[x])^2))=m (OverDot[x]).  This is just standard linear momentum, m v.

Angular Momentum

Let us change to polar coordinates.

x[t_]:=r[t]Cos[θ[t]]
y[t_]:=r[t]Sin[θ[t]]
K=Expand[FullSimplify[(1/2)m(((x'[t])^2)+((y'[t])^2))]]//TraditionalForm

Using dot notation, this is

K/.r_'[t]->OverDot[r]/.r_[t]->r//TraditionalForm

Note that θ does not appear in this expression.  If potential energy is not a function of θ (is only a function of r), then ((∂L)/(∂(OverDot[θ])))=m (r^2) (OverDot[θ])  is constant.  This is standard angular momentum, m (r^2)ω= r m r ω=r×m v.

Classic Problem: Brachistochrone (“shortest time”)

Problem

A bead starts at x=0, y=0, and slides down a wire without friction, reaching a lower point ((Subscript[x, f]),(Subscript[y, f])).  What shape should the wire be in order to have the bead reach ((Subscript[x, f]),(Subscript[y, f])) in as little time as possible.

Solution

Idea

Use the Euler equation to minimize the time it takes to get from ((Subscript[x, i]),(Subscript[y, i])) to ((Subscript[x, f]),(Subscript[y, f])).

Implementation

Letting ds be the infinitesimal distance element and v be the travel speed,

T==(∫_(Subscript[t, i])^(Subscript[t, f]))((ds)/v)dt
ds=(Sqrt[(((dx))^2)+(((dy))^2)])=dy(Sqrt[1+(((x'))^2)])             x'=((dx)/(dy))
v=(Sqrt[2g y])             (Assumption: bead starts at rest)
T=(∫_0^(Subscript[y, f]))(Sqrt[((1+(((x'))^2))/(2g y))])dy

Now we apply the Euler equation to f=(Sqrt[((1+(((x'))^2))/(2g y))]) and change t->y, (OverDot[x])->x'.

((∂f)/(∂x))-(d/(dy)) ((∂f)/(∂(OverDot[x])))==0
((∂f)/(∂x))=0
 ((∂f)/(∂(OverDot[x])))=(1/(Sqrt[2g y]))((x')/(Sqrt[1+(((x'))^2)]))
(d/(dy)) ((∂f)/(∂(OverDot[x])))==0   ⟶   (1/(Sqrt[2g y]))((x')/(Sqrt[1+(((x'))^2)]))=Constant

Squaring both sides and making a special choice for the constant gives

((((x'))^2)/(2g y(1+(((x'))^2))))=(1/(4 g A))
⟶     (((((dx)/(dy))))^2)=((y/(2A))/(1-y/(2A)))=((y^2)/(2 A y-(y^2)))
⟶     x=(∫_0^(Subscript[y, f]))((dx)/(dy))dy=(∫_0^(Subscript[y, f]))(y/(Sqrt[2 A y-(y^2)]))dy

To solve this, change variables:

y=A(1-cos(θ)),      dy=A sin(θ)dθ

FullSimplify[2A y-(y^2)/.y->A(1-Cos[θ])]

(y/(Sqrt[2 A y-(y^2)]))dy=((A(1-cos(θ)))/(Sqrt[(A^2)(sin^2)(θ)]))A sin(θ) dθ=A(1-cos(θ))
x=(∫_0^θ)A(1-cos(θ))dθ=A(θ-sin(θ))

Full solution: The brachistochrone is described by

x=A(θ-sin(θ))
y=A(1-cos(θ))

There’s no analytic solution, but we can compute them.

Clear[x,y,A,θ,soln,yf,xf,xmax,θmax,Asol,f];
RepeatedFindRoot[fs_,{θ,θ0_},{A,A0_},n_:3,nMaxIterations_:OptionValue[FindRoot,MaxIterations]]:=If[n≤1,FindRoot[fs,{θ,θ0},{A,A0},MaxIterations->nMaxIterations],Module[{err,soln,k=Reap[Quiet[Check[Sow[RepeatedFindRoot[fs,{θ,θ0},{A,A0},n-1,nMaxIterations]],Throw]]]},{err,{{soln}}}=k;If[SameQ[err,soln],soln,FindRoot[fs,{θ,Mod[(θ/.soln),2π,-2π]},{A,A/.soln},MaxIterations->nMaxIterations]]]]
Manipulate[Module[{y=Function[{A,θ},A (1 - Cos[θ])],x =Function[{A,θ}, A(θ - Sin[θ])]},Module[{soln=RepeatedFindRoot[{x[A,θ]==xf,y[A,θ]==yf},{θ,-π},{A,-1},3,1000]},Module[{Asol=A/.soln,θmax=θ/.soln},ParametricPlot[{x[Asol,θ],y[Asol,θ]},{θ,0,θmax},PlotRange->{{0,xmax},{ymax,0}},PlotStyle->Black]]]],{{xmax,2π,(Subscript[x, max])},0,4π},{{ymax,-2.5,(Subscript[y, max])},0,-20},{{xf,4,(Subscript[x, f])},1,6},{{yf,-2,(Subscript[y, f])},0,-5}]

Classic Problem: Catenary

Problem

Suppose we have a rope of length l and linear mass density λ.  Suppose we fix its ends at points ((Subscript[x, 0]),(Subscript[y, 0])) and ((Subscript[x, f]),(Subscript[y, f])).  What shape does the rope make, hanging under the influence of gravity?

Solution

Idea

Calculate the potential energy of the rope as a function of the curve, y(x), and minimize this quantity using the Euler-Lagrange equations.

Implementation

Suppose we have curve parameterized by t, (x(t), y(t)).  The potential energy associated with this curve is

U==(∫_0^l)λ g yds
ds=(Sqrt[(((dx))^2)+(((dy))^2)])=dy(Sqrt[1+(((x'))^2)])             x'=((dx)/(dy))
U=(∫_(Subscript[y, 0])^(Subscript[y, f]))λ g y(Sqrt[1+(((x'))^2)])dy

Note that if we choose to factor ds the other way (for y'), we get a mess.

Now we apply the Euler-Lagrange equation to f=λ g y(Sqrt[1+(((x'))^2)]) and change t->y, (OverDot[x])->x'.

((∂f)/(∂x))-(d/(dy)) ((∂f)/(∂x'))==0
((∂f)/(∂x))=0
 ((∂f)/(∂x'))=((λ g y x')/(Sqrt[1+(((x'))^2)]))

Since ((∂f)/(∂x))=0,  ((∂f)/(∂x')) is constant, say a= (1/(λ g))((∂f)/(∂x'))=((y x')/(Sqrt[1+(((x'))^2)])).  Then

x'=((dx)/(dy))=±(a/(Sqrt[(y^2)-(a^2)]))

Using the fact that

∫((dy)/(Sqrt[(y^2)-(a^2)]))==(cosh^(-1))((y/a))+b,

integration of x' gives

x(y)=±a (cosh^(-1))((y/a))+b

where b is a constant of integration.

Plotting this for a=1, b=0 gives:

Clear[y];Manipulate[ParametricPlot[{{-a ArcCosh[(t/a)]+b,t},{a ArcCosh[(t/a)]+b,t}},{t,ymin,ymax},PlotStyle->Black,AspectRatio->Automatic],{{a,1},-5,5},{{b,0},-5,5},{{ymin,0,(Subscript[y, min])},-5,5},{{ymax,2,(Subscript[y, max])},-5,5}]

Problem: Bead on a Ring

From 8.033 Quiz #2

Problem

A bead of mass m slides without friction on a circular hoop of radius R. The angle θ is defined so that when the bead is at the bottom of the hoop, θ=0. The hoop is spun about its vertical axis with angular velocity ω. Gravity acts downward with acceleration g.
Find an equation describing how θ evolves with time.
Find the minimum value of ω for the bead to be in equilibrium at some value of θ other than zero.
(“equilibrium” means that (OverDot[θ]) and (Overscript[θ, ¨]) are both zero.) How large must ω be in order to make θ=π/2?

Solution

The general Lagrangian for the object in Cartesian coordinates is

Clear[x,y,z,t];(L=(1/2)m(((x'[t])^2)+((y'[t])^2)+((z'[t])^2))-m g z[t])//TraditionalForm

Converting to polar coordinates, and using the constraints that ϕ=ω t and r=R, using the conversion

x=R sin(θ) cos(ω t)
y=R sin(θ) sin(ω t)
z=R-R cos(θ)

gives

Clear[r,θ,ϕ];Defer[L]==(Lpolar=Expand[FullSimplify[L/.{x->Function[t,R Cos[ω t]Sin[θ[t]]],y->Function[t,R Sin[ω t]Sin[θ[t]]],z->Function[t,R-R Cos[θ[t]]]}]])/.θ'[t]->(OverDot[θ])/.θ[t]->θ//TraditionalForm
0==Defer[(∂_θ)L-Dt["",t](∂_(OverDot[θ]))L]==(EL=Expand[FullSimplify[(∂_(θ[t]))Lpolar-(∂_t)(∂_(θ'[t]))Lpolar]])/.θ[t]->θ//TraditionalForm
θ''[t]==(θ''[t]/.Solve[EL==0,θ''[t]][[1]])//TraditionalForm

Finding the minimum value of ω for the bead to be in equilibrium gives

(θ''[t]/.Solve[EL==0,θ''[t]][[1]])==0//TraditionalForm
Refine[Reduce[(θ''[t]/.Solve[EL==0,θ''[t]][[1]])==0,Cos[θ[t]]],Sin[θ[t]]≠0&&R Cos[θ[t]]≠0&&g>0&&R ω≠0]/.θ[t]->θ//TraditionalForm

In order for this to have a solution, we must have

ω≥(Sqrt[(g/R)])

If θ=π/2, then cos(θ)=0, so ω=∞.

Problem 11.8: K & K 8.12

Problem

A pendulum is rigidly fixed to an axle held by two supports so that it can only swing in a plane perpendicular to the axle. The pendulum consists of a mass m attached to a massless rod of length l. The supports are mounted on a platform which rotates with constant angular velocity Ω. Find the pendulum’s frequency assuming the amplitude is small.

Solution by torque

(From the problem set solutions)

The torque about the pivot point is

(Subscript[(OverVector[τ]), p])==(OverVector[α]) (Subscript[I, p])

(OverHat[k]):         -g ℓ m sin(θ)+ℓ (Subscript[F, cent]) cos(θ)==(Overscript[θ, ¨]) (Subscript[I, p])

The centrifugal effective force is

(Subscript[F, cent])=m (ℓ sin(θ))(Ω^2)

For small angles, sin(θ)≃θ, cos(θ)≃1.  Then equation (1) becomes

-g ℓ m θ+m (ℓ^2) θ (Ω^2)≃m (ℓ^2)(Overscript[θ, ¨]) 
(Overscript[θ, ¨]) +((g/ℓ)- (Ω^2))θ≃0
ω=(Sqrt[(g/ℓ)-(Ω^2)])

If (Ω^2)>(g/ℓ), the motion is no longer harmonic.

Solution by least action

The general Lagrangian for the object in Cartesian coordinates is

Clear[x,y,z,t];(L=(1/2)m(((x'[t])^2)+((y'[t])^2)+((z'[t])^2))-m g z[t])//TraditionalForm

Converting to polar coordinates, and using the constraints that ϕ=Ω t and r=ℓ, using the conversion

x=ℓ sin(θ) cos(Ω t)
y=ℓ sin(θ) sin(Ω t)
z=ℓ-ℓ cos(θ)

gives

Clear[ℓ,θ,ϕ];Defer[L]==(Lpolar=Expand[FullSimplify[L/.{x->Function[t,ℓ Cos[Ω t]Sin[θ[t]]],y->Function[t,ℓ Sin[Ω t]Sin[θ[t]]],z->Function[t,ℓ-ℓ Cos[θ[t]]]}]])/.θ'[t]->(OverDot[θ])/.θ[t]->θ//TraditionalForm
0==Defer[(∂_θ)L-Dt["",t](∂_(OverDot[θ]))L]==(EL=Expand[FullSimplify[(∂_(θ[t]))Lpolar-(∂_t)(∂_(θ'[t]))Lpolar]])/.θ[t]->θ//TraditionalForm
θ''[t]==(θ''[t]/.Solve[EL==0,θ''[t]][[1]])//TraditionalForm

Note that this is, after minor changes of variable, the exact same equation that we found in the previous problem.  We should(’ve) expect(ed) this.
Making the first order approximation that θ≈0 (Taylor expanding around θ=0 to the first order), we get

θ''(t)==-((g/ℓ)-(Ω^2))θ(t)

This is the differential equation for a harmonic oscillator, with

ω=(Sqrt[(g/ℓ)-(Ω^2)])

If (Ω^2)>(g/ℓ), the motion is no longer harmonic.

Options[EulerLagrangeEquation]:={Constants->OptionValue[Dt,Constants],NonConstants->OptionValue[D,NonConstants]}
EulerLagrangeEquation[L_,q_,dq_,t_,OptionsPattern[]]:=D[L,q,NonConstants->OptionValue[NonConstants]]-Dt[D[L,dq,NonConstants->OptionValue[NonConstants]],t,Constants->OptionValue[Constants]]==0