16 Euler–Lagrange Equations
The Euler–Lagrange equation expresses the stationary-action principle used in mechanics.
16.1 Pendulum Example
Consider a pendulum of mass m connected to a fixed pivot by a rod of length l. The same configuration may be represented by redundant Cartesian coordinates (x,y) or by polar coordinates (r,\theta).
The coordinate transformation and its time derivative are
x=r\sin\theta, \qquad y=-r\cos\theta,
\dot{x}=\dot{r}\sin\theta+r\cos\theta\,\dot\theta, \qquad \dot{y}=-\dot{r}\cos\theta+r\sin\theta\,\dot\theta.
Consequently, the kinetic and potential energies are
T=\frac{m}{2}\left(\dot r^2+r^2\dot\theta^2\right), \qquad V=-mgr\cos\theta.
The fixed-length constraint r=l eliminates the radial coordinate and gives
T(\theta,\dot\theta)=\frac{m}{2}l^2\dot\theta^2, \qquad V(\theta)=-mgl\cos\theta.
To solve the dynamic equation \theta(t) of the mechanism we can compute the lagrangian L of the system defined as
L(\theta,\dot\theta) = T(\theta,\dot\theta)-V(\theta) = \frac m 2 l^2\dot\theta^2 + lmg\cos\theta
The physical trajectory makes the action \mathcal A stationary:
\mathcal A(\theta) = \int_{t_0}^{t_1} L (\theta,\dot\theta)\, \mathrm{d}t \tag{16.1}
where the values \theta(t_0)= \theta_0 and \theta(t_1)=\theta_1 are known parameters.
In practice to determine the required solution we can use analytical tool to find the trajectory that can then be demonstrated to be the minimum of the action \mathcal{A} (that’s indeed a functional).
However we can also try to analytically determine the function \theta^\star(t) that minimize the functional \mathcal{A}(\cdot) by computing the directional derivatives.
Let now consider the function \theta^\star(t) and a direction \delta\theta(t) that satisfy
\delta\theta(t_0)=\delta\theta(t_1) = 0
we can then use the fundamental lemma of the calculus of variation to determine the minimal function (considering that the expression Equation 16.1 of the action is comparable to Equation 15.1 of the lemma).
To determine a stationary trajectory \theta^\star, the first variation of the action must vanish in every admissible direction \delta\theta:
\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}\alpha} \mathcal{A} \big(\theta^\star + \alpha\, \delta\theta\big) & = \frac{\mathrm{d}}{\mathrm{d}\alpha} \int_{t_0}^{t_1} L\big( \theta ^\star + \alpha\, \delta\theta, \dot\theta^\star + \alpha\, \delta\dot\theta \big) \,\mathrm{d}t \\ & = \int_{t_0}^{t_1} \left[\frac{\partial L}{\partial\theta} \frac{\mathrm{d}}{\mathrm{d}\alpha} \big(\theta^\star + \alpha \,\delta\theta\big) + \frac{\partial L}{\partial\dot\theta} \frac{\mathrm{d}}{\mathrm{d}\alpha} \big(\dot \theta^\star + \alpha \,\dot \delta\theta\big) \right] \, \mathrm{d}t \\ & = \int_{t_0}^{t_1} \left[\big(-lmg\sin(\theta^\star + \alpha\, \delta\theta)\big)\delta\theta + ml^2\big( \dot\theta^\star + \alpha \, \delta\dot\theta \big)\, \delta\dot\theta\right] \, \mathrm{d}t \end{aligned}
Note that from in the first step we made the implicit assumption that
\frac{\mathrm{d}}{\mathrm{d}\alpha} \int = \int\frac{\mathrm{d}}{\mathrm{d}\alpha}
while however this is not always possible. Evaluating the previous expression for \alpha = 0 gives the first variation of the action \mathcal{A} that’s
\begin{aligned} \delta \mathcal{A}(\theta^\star;\delta\theta) & = \frac{\mathrm{d}}{\mathrm{d}\alpha} \mathcal{A}\big(\theta^\star + \alpha\, \delta\theta\big) \Big|_{\alpha = 0}\\ & = \int_{t_0}^{t_1} \big(-lmg \sin\theta^\star\delta\theta + ml^2\dot\theta^\star \delta\dot\theta \big) \, \mathrm{d}t = 0 \qquad \end{aligned}
for all \delta\theta. Performing an integration by part allows to remove the term \delta\dot\theta that’s hard to determine, and in fact
\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}t}\big( ml^2\dot\theta^\star \, \delta\theta\big) & = \frac{\mathrm{d}}{\mathrm{d}t}\big(ml^2\dot\theta^\star\big)\,\delta\theta + ml^2\dot\theta^\star \delta\dot\theta \\ & \Downarrow \\ ml^2\dot\theta^\star \delta\dot\theta &= \frac{\mathrm{d}}{\mathrm{d}t}\big( ml^2\dot\theta^\star \, \delta\theta\big) - \frac{\mathrm{d}}{\mathrm{d}t}\big(ml^2\dot\theta^\star\big)\,\delta\theta \end{aligned}
Performing the substitution of the integration by parts determines the result
\begin{aligned} \delta\mathcal{A} \big(\theta^\star;\delta\theta\big) & = \int_{t_0}^{t_1} \left[ - lmg\sin\theta^\star - \frac{\mathrm{d}}{\mathrm{d}t}\big(ml^2\dot\theta^\star\big) \right]\delta\theta\, \mathrm{d}t + \cancel{\big[ ml^2 \dot\theta^\star \delta\theta \big]\Big|_{t_0}^{t_1} } \\ & = \int_{t_0}^{t_1} \underbrace{\left[ -lmg \sin\theta^\star - \frac{\mathrm{d}}{\mathrm{d}t}\big(ml^2 \dot\theta^\star\big) \right]}_{f(t)} \delta\theta\, \mathrm{d}t = 0 \end{aligned}
We can now see in this formulation that the marked expression represent the function f(x) of the fundamental lemma considering that the relation must be true for all approaching direction \delta\theta, and so it must be
-lmg \sin\theta^\star - \frac{\mathrm{d}}{\mathrm{d}t}\big(ml^2 \dot\theta^\star\big) = 0
The problem now to complete the analyses of the pendulum motion is determining the function \theta^\star(t) that satisfy this expression and also match the boundary conditions \theta(t_0) = \theta_0 and \theta(t_1)=\theta_1.
Equivalently, the stationary path satisfies the pendulum equation
ml^2\ddot\theta+mgl\sin\theta=0, \qquad\text{or}\qquad \ddot\theta+\frac{g}{l}\sin\theta=0.
The derivation above uses the minimal coordinate \theta, which automatically enforces the fixed-length constraint. The same motion can be written with the redundant Cartesian coordinates \bm{q}=(x,y)^\intercal and the holonomic constraint \phi(\bm{q})=x^2+y^2-l^2=0.
In Cartesian coordinates, the Lagrangian is L(\bm{q},\dot{\bm{q}})=\frac{m}{2}\dot{\bm{q}}^\intercal\dot{\bm{q}}-mgy, and the constraint force is represented by a multiplier \lambda. Applying the constrained Euler–Lagrange equations gives \begin{aligned} m\ddot{\bm{q}}+mg\bm{e}_2 &= \nabla\phi(\bm{q})\lambda=2\bm{q}\lambda,\\ \phi(\bm{q}) &= x^2+y^2-l^2=0, \end{aligned} \qquad \bm{e}_2=(0,1)^\intercal. Equivalently, \begin{aligned} m\ddot{x} &= 2x\lambda,\\ m\ddot{y} &= 2y\lambda-mg,\\ x^2+y^2 &= l^2. \end{aligned} This redundant-coordinate formulation is a differential–algebraic equation: the two differential equations are coupled to the algebraic length constraint. Its derivation uses the same variational principle as the reduced equation above, with the constraint included through the Lagrange multiplier.
16.2 General Formulation
Given a generic functional of the form
\mathcal{A}(x) = \int_a^b L \big(x(t),x'(t),t\big)\, \mathrm{d}t
the problem is to minimize the functional \mathcal{A}(x) for a function x \in\mathbb{V} subject to the boundary conditions x(a) = x_a and x(b) = x_b in the function space \mathbb{V} defined as
\mathbb{V} = \big\{ x \ | \ x\in C^2([a,b]) \text{ with } x(a) = x_a,x(b) = x_b \big\}
Let \mathbb{D} the function space of all the feasible directions of derivatives defined as
\mathbb{D} = \big\{ \delta x \ | \ \delta x \in C^{\infty}([a,b]) \text{ with } \delta x(a) = \delta x(b) = 0 \big\}
the function x(t) that minimize the functional is the one whose first variation is zero for any admissible perturbation, and so such that
\delta \mathcal{A}(x;\delta x) = \frac{\mathrm{d}}{\mathrm{d}\alpha} \mathcal{A}(x+\alpha\, \delta x) \Big|_{\alpha = 0} = 0 \qquad \text{for all} \;\delta x \in\mathbb{D}
Assuming the possibility to correctly apply the rule
\frac{\mathrm{d}}{\mathrm{d}\alpha} \int = \int \frac{\mathrm{d}}{\mathrm{d}\alpha}
we can express the directional derivative of the functional \mathcal{A}(x) evaluated in x+ \alpha\, \delta x as
\begin{aligned} \frac{\mathrm{d}\mathcal{A}(x+\alpha\delta x)}{\mathrm{d}\alpha} & = \frac{\mathrm{d}}{\mathrm{d}\alpha} \int_a^b L \big( x + \alpha\, \delta x ,x' + \alpha\, \delta x', t\big)\, \mathrm{d}t \\ & = \int_a^b \left( \frac{\partial L}{\partial x}\delta x + \frac{\partial L}{\partial x'}\delta x'\right)\, \mathrm{d}t \\ \frac{\mathrm{d}\mathcal{A}}{\mathrm{d}\alpha}\Big|_{\alpha = 0} & = \int_a^b \left( \frac{\partial L}{\partial x}(x,x',t)\delta x + \frac{\partial L}{\partial x'}(x,x',t)\delta x' \right)\, \mathrm{d}t \end{aligned}
By performing the integration by part it’s possible do reconvert the term associated do \delta x' into pieces depending on \delta x one of which, when evaluated, becomes zero due to the fact that \delta x(a) = \delta x(b) = 0:
\begin{aligned} \frac{\mathrm{d}\mathcal{A}}{\mathrm{d}\alpha} \Big|_{\alpha = 0} & = \int_a^b \left[ \frac{\partial L}{\partial x}(x,x',t) - \frac{\mathrm{d}}{\mathrm{d}t} \left(\frac{\partial L}{\partial x'}(x,x',t) \right) \right] \delta x\, \mathrm{d}t \\ & + \int_a^b\frac{\mathrm{d}}{\mathrm{d}t} \left(\frac{\partial L}{\partial x'}(x,x',t)\delta x \right) \, \mathrm{d}t \\ & = \int_a^b \left[ \frac{\partial L}{\partial x}(x,x',t) - \frac{\mathrm{d}}{\mathrm{d}t} \left(\frac{\partial L}{\partial x'}(x,x',t) \right) \right] \delta x\, \mathrm{d}t \\ &+ \cancel{\left[ \frac{\partial L}{\partial x'}(x,x',t)\delta x \right]_{t=a}^{t=b}} \end{aligned}
In this case the substitution by part has been obtained by performing the operation
\frac{\mathrm{d}}{\mathrm{d}t} \left( \frac{\partial L}{\partial x'}(x,x',t)\delta x \right) = \frac{\mathrm{d}}{\mathrm{d}t} \left( \frac{\partial L}{\partial x'}(x,x',t) \right) \delta x + \frac{\partial L}{\partial x'}(x,x',t)\delta x'
If we in fact explicit the term containing \delta x' we have
\frac{\partial L}{\partial x'}(x,x',t)\delta x' = \underbrace{\frac{\mathrm{d}}{\mathrm{d}t} \left(\frac{\partial L}{\partial x'}(x,x',t)\delta x \right)}_\text{term \#1} - \underbrace{\frac{\mathrm{d}}{\mathrm{d}t} \left(\frac{\partial L}{\partial x'}(x,x',t)\right) \delta x}_\text{term \#2}
The second term still remains in the variation of the functional \mathcal{A}, while the first term is eliminated because it’s evaluation becomes
\begin{aligned} \int_a^b\frac{\mathrm{d}}{\mathrm{d}t} \left(\frac{\partial L}{\partial x'}\delta x \right) \,\mathrm{d}t &= \left[ \frac{\partial L}{\partial x'}(x(t),x'(t),t) \delta x(t) \right]_a^b \\ &= \frac{\partial L}{\partial x'}(x(b),x'(b),b) \delta x(b) - \frac{\partial L}{\partial x'}(x(a),x'(a),a) \delta x(a) \end{aligned}
From the definition of \mathbb D, \delta x(a)=\delta x(b)=0, so the boundary term vanishes.
We can now see that the necessary stationarity condition for the functional \mathcal{A}, by using the fundamental lemma of calculus of variation, is requiring that the function f(t) defined as follows is identically null:
\frac{\mathrm{d}\mathcal{A}(x+\alpha\, \delta x)}{\mathrm{d}\alpha} \Big|_{\alpha = 0} = \int_a^b \underbrace{\left( \frac{\partial L}{\partial x} - \frac{\mathrm{d}}{\mathrm{d}t} \frac{\partial L}{\partial x'}\right)}_{=f(t)} \delta x \, \mathrm{d}t = 0 \tag{16.2}
Thus every smooth stationary function must solve the following second-order boundary value problem:
\begin{cases} \frac{\mathrm{d}}{\mathrm{d}t} \frac{\partial L }{\partial x'} - \frac {\partial L }{\partial x} = 0 \\[0.5em] x(a) = x_a \\ x(b) = x_b \end{cases}
For a vector of generalized coordinates \bm{q}\in\mathbb{R}^n, the same stationarity condition is the Euler–Lagrange system \frac{\mathrm{d}}{\mathrm{d}t} \left(\frac{\partial L}{\partial\dot{\bm{q}}}\right)^\intercal -\left(\frac{\partial L}{\partial\bm{q}}\right)^\intercal=\bm{0}. \tag{16.3}
16.3 First Integrals and Vectors
If L does not depend explicitly on t, the Euler–Lagrange equation implies the Beltrami identity
L-x'\frac{\partial L}{\partial x'}=C.
If L does not depend on x, then \partial L/\partial x' is constant. These first integrals often reduce a second-order Euler–Lagrange equation to a first-order equation.
For a vector-valued curve \bm{x}:[a,b]\to\mathbb{R}^n and L(\bm{x},\dot{\bm{x}},t), the equations hold componentwise:
\frac{\mathrm d}{\mathrm dt}\frac{\partial L}{\partial \dot x_i} -\frac{\partial L}{\partial x_i}=0, \qquad i=1,\ldots,n.
Example 16.1 (First-Variation Example) Given the generic functional defined as
\mathcal{F}(x) = \int_a^b G(x,x',t)\, \mathrm{d}t + x(a)x(b)
to compute its first variation, we use the standard approach and perturb the function x:
\begin{aligned} \frac{\mathrm{d}}{\mathrm{d}\alpha} \mathcal{F} \big(x+\alpha\, \delta x\big) &= \frac{\mathrm{d}}{\mathrm{d}\alpha} \int_a^b G\big(x+\alpha\, \delta x, x' + \alpha\, \delta x',t\big)\, \mathrm{d}t \\[0.5em] & +\frac{\mathrm{d}}{\mathrm{d}\alpha} \Big( \big(x(a) + \alpha \delta x(a)\big)\big(x(b) + \alpha\, \delta x(b)\big)\Big) \\[0.5em] &= \int_a^b \left( \frac{\partial G}{\partial x}\, \delta x + \frac{\partial G}{\partial x'} \delta x' \right) \, \mathrm{d}t \\[0.5em] & + \delta x(a) \big(x(b) + \alpha\, \delta x(b)\big) + \big( x(a) + \alpha\,\delta x(a) \big)\delta x(b) \\[0.5em] &\downarrow\quad\alpha=0 \\[0.5em] &=\int_a^b \left( \frac{\partial G}{\partial x} \delta x + \frac{\partial G}{\partial x'}\delta x' \right) \, \mathrm{d}t + \delta x(a)x(b) + x(a)\delta x(b) \end{aligned}
This redundant formulation can be simplified by using the Gateaux derivative notation \delta that allows to express the first variation as
\begin{aligned} \delta \mathcal{F}(x) & = \delta \left(\int_a^b G(x,x',t)\, \mathrm{d}t + x(a)x(b)\right) \\[0.5em] &= \int_a^b \delta G(x,x',t)\, \mathrm{d}t + \delta\big(x(a)x(b)\big)\\[0.5em] &= \int_a^b \left( \frac{\partial G}{\partial x}(x,x',t)\delta x + \frac{\partial G}{\partial x'}(x,x',t)\delta x' \right)\, \mathrm{d}t \\[0.5em] & + \delta x(a) x(b) + x(a)\delta x(b) \end{aligned}
using integration by part
\frac{\mathrm{d}}{\mathrm{d}t} \left(\frac{\partial G}{\partial x'}(x,x',t)\delta x\right) = \frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial G}{\partial x'}(x,x',t)\delta x + \frac{\partial G}{\partial x'}(x,x',t)\delta x'
and substituting
\begin{aligned} \delta \mathcal{F}(x) &= \int_a^b \underbrace{\left(\frac{\partial G}{\partial x}(x,x',t) -\frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial G}{\partial x'}(x,x',t)\right) }_{(A)} \delta x\, \mathrm{d}t \\[0.5em] & + \underbrace{\left[ x(a)+\frac{\partial G}{\partial x'}(x(b),x'(b),b)\right] }_{(B)}\delta x(b) \\ & + \underbrace{\left[ x(b)-\frac{\partial G}{\partial x'}(x(a),x'(a),a)\right] }_{(C)}\delta x(a) \end{aligned}
using fundamental lemma of calculus of variations (A)=0 and then using variation differents from zero on the border it follows that (B)=(C)=0 and the stationary points of the functional F(x) satisfy the BVP
\left\{\begin{aligned} \frac{\partial G}{\partial x}(x,x',t) -\frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial G}{\partial x'}(x,x',t) &=0 \\ x(a)+\frac{\partial G}{\partial x'}(x(b),x'(b),b) &=0 \\ x(b)-\frac{\partial G}{\partial x'}(x(a),x'(a),a) &=0 \end{aligned}\right.
16.4 Brachistochrone
As saw at the introduction, functional minimization can be used to solve real problem. As example the brachistochrone problem wants to determine the path that minimize the time T to reach point B from a point A for a mass m subjected only to the force of gravity: this means minimizing the function
T = \int_A^B \frac 1 v \, \mathrm{d}s
where v is the velocity of the point over the arc length \mathrm{d}s. In order to describe the problem we consider x as the horizontal axis and y the vertical one (with positive direction the one facing upwards);
the point A is described by the coordinates (x_a,y_a) = (0,0) (so it is at the origin),
the point B = (x_b,y_b) is placed anywhere in the lower semi-plane (in fact we must require that y_b<0 in order to have a free fall of the object).
Considering that at the initial position A both the kinetic and potential energy are zero, due to the conservation of energy we can derive that
0 = mgy + \frac 1 2 m v^2 \quad \implies \quad v = \sqrt{-2gy}
We so have the velocity v as depending from the vertical coordinate y of the point, and so the next step is to relate the arc length \mathrm{d}s with the horizontal variation \mathrm{d}x: we can see that
\mathrm{d}s = \sqrt{\mathrm{d}x^2 + \mathrm{d}y^2} = \sqrt{\mathrm{d}x^2 + y'^2(x)\mathrm{d}x^2} = \sqrt{1 + y'^2} \mathrm{d}x
The initial brachistochrone problem can so be states as the following functional minimization problem:
\begin{aligned} \text{minimize:} \qquad & \mathcal{F}(y) = \int_{x_a}^{x_b} L(y,y')\, \mathrm{d}x \\ \text{subject to:} \qquad & y\big(x_a\big) = y_a = 0 \qquad y\big(x_b\big) = y_b < 0 \end{aligned}
where the independent variable is the x coordinate, and
L(y,y') = \sqrt{\frac{1+y'^2}{-2gy}}
Because L does not depend explicitly on x, the Beltrami identity gives
L-y' L_{y'}=\frac{1}{\sqrt{-2gy\,(1+y'^2)}}=C.
Differentiating this first integral, or applying the Euler–Lagrange equation directly, gives the boundary value problem
\left\{ \begin{aligned} 1+y'(x)^2 + 2\,y(x)y''(x) &= 0 \\[0.5em] y(0) &= 0 \\[0.5em] y(x_b) &= y_b \end{aligned} \right.
Even if it’s not clear at first sight, it can be proven that the solution of the differential equation is a cycloid described by the equations
x(\theta) = \frac{1}{2} k^2 \big(\theta-\sin\theta\big), \qquad y(\theta) = -\frac{1}{2} k^2 \big(1-\cos\theta \big)
where the constant k and the range of the new angle \theta of the parametrization can be found by using the boundary conditions.
In particular, the initial condition on points A allows to state that \theta_a = 0 (in fact x(0) = \frac{1}{2} k^ 2 0 = 0 and also y(0) = 0), while considering the final conditions we can determine both \theta_b and k solving this system of non-linear equation in such variables:
\begin{cases} x_b = \frac{1}{2} k^2 \big(\theta_b - \sin\theta_b\big) \\[0.5em] y_b = -\frac{1}{2} k^2 \big(1-\cos\theta_b\big) \end{cases}
16.5 Second Variation and Legendre Condition
The Euler–Lagrange equation is only a first-order necessary condition. For
\mathcal F(x)=\int_a^b L(x,x',t)\,\mathrm dt,
with fixed endpoints, the second variation at a smooth extremal x^\star in the direction \eta, \eta(a)=\eta(b)=0, is
\delta^2\mathcal F(x^\star;\eta) =\int_a^b\left[ L_{xx}\eta^2+2L_{xx'}\eta\eta'+L_{x'x'}(\eta')^2 \right]\,\mathrm dt,
where all derivatives of L are evaluated along (x^\star,x^{\star\prime},t). A necessary condition for a weak local minimum is the Legendre condition
L_{x'x'}(x^\star,x^{\star\prime},t)\geq0.
The strengthened condition L_{x'x'}>0 is useful but is not by itself sufficient for a minimum; positivity of the complete second variation must be controlled.
Jacobi Condition
After integrating the mixed term by parts, write
\delta^2\mathcal F=\int_a^b\left[P(t)(\eta')^2+Q(t)\eta^2\right]\,\mathrm dt,
with P=L_{x'x'} and Q=L_{xx}-\frac{\mathrm d}{\mathrm dt}L_{xx'}. The associated Jacobi equation is
-\frac{\mathrm d}{\mathrm dt}\big(P(t)v'(t)\big)+Q(t)v(t)=0.
A point c>a conjugate to a is a point for which a nonzero Jacobi field satisfies v(a)=v(c)=0. Under the strengthened Legendre condition, absence of conjugate points on (a,b] is the classical Jacobi criterion associated with positivity of the second variation.
16.6 Weierstrass Necessary Condition
For a strong local minimum, first-order stationarity is not enough. Define the Weierstrass excess function
E(x,p,q,t)=L(x,q,t)-L(x,p,t)-(q-p)L_{x'}(x,p,t).
A smooth strong local minimizer satisfies
E(x^\star(t),x^{\star\prime}(t),q,t)\geq0
for every admissible slope q. Convexity of L with respect to x' implies this inequality. The Weierstrass condition is therefore stronger than the pointwise Legendre condition and is relevant when perturbations may change the derivative substantially while keeping the curve uniformly close.