The Lagrange equation is a second order1 differential equation that finds the motion of a system from its energy:
Here is the kinetic energy, is the motion in generalized coordinates and are the generalized forces. The value depends on the degrees of freedom of the system.
If the system is subject to conservative forces and can be written in terms of a Potential , we can further define the Lagrangian to rewrite the equation as
A dynamical system whose equations of motion can be written in this form is said to be a Lagrangian system.
The benefit of using a set of Lagrange equations over a set of Newton's second laws is that they allow picking a parameterization of the constraints such that the constraint forces vanish. The equations that are left can then be solved algorithmically by differentiation, which is typically far easier than what would be necessary with Newton's laws and can also be offloaded to a computer for numerical differentiation.
Validity#
This equation is correct point-wise, for each , and for this reason it is said that the Lagrange equation describes motion locally (as opposed to globally). See Globally-determined motion.
Velocity-dependent forces#
Many forces do not depend on velocity. Examples including the force applied by gravity or the spring pullback force. In these cases, the generalized forces, which inherits arguments from the regular forces, also do not. In other cases though, such as friction or the Lorentz force, the forces depend explicitly on velocity and the function signature becomes with the force itself being
See the examples below on the Coriolis force, inertial frames and electromagnetic forces for practical results on this.
Kinetic energy#
The general form of the Lagrange equation is in terms of kinetic energy. Fortunately, we have a very general expression for it
See Kinetic energy > In analytical mechanics for the derivation. We can substitute this into the Lagrange equation and take the derivatives directly. Starting from the derivative in we get
As for the other derivative, it's a little more complicated:
where we used Kronecker deltas. These allows us to cut down on the sums:
If we rename the second sum's index from to and remember that the matrix is symmetric, we can write , which leads to the exact same sum as the first. Summing the two we get
We now need to take the time derivative:
Note that the highest derivative of is the second, in . This confirms that the Lagrange equation is a second order differential equation.
All of the partial derivatives of , and , alongside the generalized force are functions of and composed with motion, so the whole differential equation can be written as
where is a function that includes everything other than the term. This is still a second order differential equation, just implicitly so since is "trapped" inside the sum. The left hand side now reads as a matrix product between the matrix and the vector , so we can write
To continue, we'll apply the inverse matrix of on both sides: . Since , we get
We now have the same equation in explicit form. What this tells us is that we can, at least in principle, find the motion from the inverse of the kinetic matrix applied onto a (vector-valued) function . Our next step then is to better understand what is.
Linearization#
Like other differential equations, we can linearize the Lagrange equation near an equilibrium point in the approximation of small movement near that point. More correctly, it's not the Lagrange equation itself that we linearize, as much as the general form of the equation for that we do.
We assume that the motion is always near our equilibrium point for all time, so that for all . This also implies that the velocity must be small: (otherwise the moving object could not possibly remain near the equilibrium point). Also, this of course requires to be stable, otherwise the object would diverge from it as soon as it starts moving, making it impossible for motion to be small.
We'll use a Coordinate transformation to set the equilibrium point in ; this just makes the treatment easier and no less general, as motion cannot possibly depend on the choice of coordinates. In these coordinates, and . We are now going to expand the Lagrangian in a Taylor series about :
We'll ignore anything third order and above since motion is small. We now substitute :
where most terms vanish in the equilibrium point. is also constants, so we may as well redefine so that . This leaves us with
or
where is the kinetic matrix evaluated in the minimum and is the "potential" matrix
Plugging this into the Lagrange equation yields
which is a fully general, linearized form of the equation of motion for the approximate Lagrangian above2.
This is a homogeneous, linear, second-order ODE, so the solution isn't too difficult. There are independent solutions and the general solution is the Linear combination of all of them. Following the guidance of the general theory (see Equilibrium point > Linearization near equilibrium points), we ansatz
so
This equation only has nontrivial independent solutions if and are parallel vectors, which is to say one is a scalar multiple of the other: . Plug this in and you get
This has two independent solutions.
Examples#
> If the Lagrange equation is to be believed, this quantity contains the entire dynamics of the system, which we can extract by solving its Lagrange equations. To find it, we'll need the derivatives > $$\frac{ \partial L }{ \partial q } =-m\omega ^{2}q,\quad \frac{ \partial L }{ \partial \dot{q} } =m \dot{q}> Hence the equation > $$\frac{d}{dt} \frac{ \partial L }{ \partial \dot{q} } -\frac{ \partial L }{ \partial q }=0 \quad\Rightarrow \quad m\ddot{q}+m\omega ^{2}q=0\quad\Rightarrow \quad \ddot{q}=-\omega ^{2}qWe now need to take the time derivative of the second:
> The potential is $V(q,\dot{q})=-m(\dot{\mathbf{q}}\times \boldsymbol{\omega})\cdot \mathbf{q}$[^3]. Before we take the derivatives, we should expand the mixed product. The [[Scalar product]] of a [[cross product]] in general is > $$\begin{align} > (\mathbf{a}\times \mathbf{b})\cdot \mathbf{c}&=\left( \sum_{i,j,k=1}^{3} \epsilon_{ijk}a_{i}b_{j}\mathbf{e}_{k} \right)\cdot\left( \sum_{l}c_{l}\mathbf{e}_{l} \right) \\ > &=\sum_{i,j,k=1}^{3} \epsilon_{ijk}a_{i}b_{j}c_{l}\underbrace{ \mathbf{e}_{k}\cdot \mathbf{e}_{j} }_{ \delta_{kj} } \\ > &=\sum_{i,j,k=1}^{3} \epsilon_{ijk}a_{i}b_{j}c_{k} \\ > &=\sum_{i,j,k=1}^{3} \epsilon _{jki}b_{j}c_{k}a_{i} \\ > &=\mathbf{a}\cdot (\mathbf{b}\times \mathbf{c}) > \end{align}which is the well known harmonic oscillator equation.
> The derivatives over the motion are > $$\frac{ \partial V }{ \partial \dot{q}_{j} } =-m(\boldsymbol{\omega}\times \mathbf{q})_{j}\quad\to \quad \frac{d}{dt} \frac{ \partial V }{ \partial \dot{q}_{j} } =-m(\boldsymbol{\omega}\times \dot{\mathbf{q}})=m(\dot{\mathbf{q}}\times \boldsymbol{\omega})_{j}using the Levi-Civita tensor and the Kronecker delta. Now we can rewrite the potential as
> So if we plug these in the definition of the force components we get > $$F_{j}=2m(\dot{\mathbf{q}}\times \boldsymbol{\omega})_{j}and also
> The issue here figuring out the motion relative to the moving frame. Normally, this would require a lot of imagination and lengthy mathematics to try to understand the relative motion. The benefit of Lagrangian mechanics is that no such thing is needed: since frame changes lead to apparent forces, the process of figuring this out is identical to any other force and is just a matter of applying the usual mathematical algorithm; no fancy methods required. > > Since it's inertial, the frame must move at a constant velocity. In our case, we set it to uniform circular motion of [[Frequency|angular frequency]] $\omega$ on the $xy$ plane, such that the [[Coordinate transformation]] is > $$x=q_{1}\cos \omega t-q_{2}\sin \omega t,\quad y=q_{1}\sin \omega t-\cos \omega t,\quad z=q_{3}which is exactly our Coriolis force.
> We now add these in the Lagrangian equation. As you might imagine, this leads to a really complicated expression due to the squares. Thankfully, we can use some trigonometry to delete some terms before we even write them. For one, $\cos ^{2}\theta+\sin ^{2}\theta=1$ merges several terms and $\cos ^{2}\theta-\sin ^{2}\theta=$; you can see these stacked on top of each other in $\dot{x}$ and $\dot{y}$. In the end, we get > $$L(\dot{x},\dot{y},\dot{z})=\frac{m}{2}(\dot{q}^{2}_{1}+\dot{q}^{2}_{2}+\dot{q}^{2}_{3})+ \frac{m}{2}\omega ^{2}(q_{1}^{2}+q_{2}^{2})-m \dot{q}_{1}q_{2}\omega+m \dot{q}_{2}q_{1}\omegaThe Lagrangian is dependent only on the derivatives, so we find those
\dot{x}&=\dot{q}_{1}\cos \omega t-\dot{q}_{2}\sin \omega t-q_{1}\omega \sin \omega t-q_{2}\omega \cos \omega t \\ \dot{y}&=\dot{q}_{1}\sin \omega t+\dot{q}_{2}\cos \omega t+q_{1}\omega \cos \omega t-q_{2}\omega \sin \omega t \\ \dot{z}&=\dot{q}_{3} \end{align}
> The final result is > $$L(\dot{x},\dot{y},\dot{z})=\frac{m}{2}(\dot{q}^{2}_{1}+\dot{q}^{2}_{2}+\dot{q}^{2}_{3})+ \frac{m}{2}\omega ^{2}(q_{1}^{2}+q_{2}^{2})-m\omega(\mathbf{q}\times \dot{\mathbf{q}}) > for a charge $e$ (we're not using $q$ to avoid overwriting the generalized coordinate). The [[electric field]] is in general > $$\mathbf{E}=-\left( \nabla \phi+\frac{ \partial \mathbf{A} }{ \partial t } \right)The last two terms can be rewritten to be more meaningful using a cross product:
> where $\phi$ is the [[electric potential]] (not to be confused with $V$ the potential *energy*) and $\mathbf{A}$ is the [[magnetic vector potential]]. > > The potential energy is given byand the magnetic field is
V(q,\dot{q})=e\phi-e \dot{\mathbf{q}}\cdot \mathbf{A}
> Now we have everything we need to find the force: > $$\begin{align} > F_{n}&=\frac{d}{dt} \frac{ \partial V }{ \partial \dot{q}_{n} } -\frac{ \partial V }{ \partial q_{n} } \\ > &=\frac{d}{dt} (-eA_{n}(q,t))-e\frac{ \partial \phi }{ \partial q_{n} } +e \dot{\mathbf{q}}\cdot \frac{ \partial \mathbf{A} }{ \partial q_{n} } \\ > &=-e\frac{ \partial A_{n} }{ \partial t } -e\sum_{k=1}^{3} \frac{ \partial A_{n} }{ \partial q_{k} } \dot{q}_{k}-e\frac{ \partial \phi }{ \partial q_{n} } +e\sum_{l=1}^{3} \dot{q}_{l} \frac{ \partial A_{l} }{ \partial q_{n} } \\ > &=-e\left( \frac{ \partial \phi }{ \partial q_{n} } +\frac{ \partial A_{n} }{ \partial t } \right)+e\sum_{l=1}^{3} \dot{q}_{l}\frac{ \partial A_{l} }{ \partial q_{n} } -e\sum_{k=1}^{3} \dot{q}_{k}\frac{ \partial A_{n} }{ \partial q_{k} } > \end{align}> Here we use the Kronecker deltas to delete some indexes. $i$ and $j$ vanish, leaving only $n$ and $m$. The last step is > $$\ldots=\sum_{m=1}^{3} \dot{q}_{m}\frac{ \partial A_{n} }{ \partial q_{m} } -\dot{q}_{n}\frac{ \partial A_{m} }{ \partial q_{n} }This is kind of a mess: ideally there's some vector operations to compress this into. In fact, if this is to be equal to the Lorentz force, then the last two terms must end up being . Using the shorthand , we find that
-[(\nabla\times \mathbf{A})\times \dot{\mathbf{q}}]_{n}&=-\sum_{l,m=1}^{3} \left( \sum_{i,j=1}^{3} \epsilon_{lij} \partial_{i}A_{j} \right)\dot{q}_{m}\epsilon_{nlm} \\ &=\sum_{m,i,j=1}^{3} \partial_{i}A_{j}\dot{q}_{m}\sum_{l=1}^{3} \underbrace{ \epsilon_{lij}\epsilon_{lnm} }_{ \delta_{in}\delta_{jm}-\delta_{im}\delta_{jn} } \\ &=\sum_{m,i,j=1}^{3} \partial_{i}A_{j}\dot{q}_{m}\delta_{in}\delta_{jm}-\sum_{m,i,j=1}^{3} \partial_{i}A_{j}\dot{q}_{m}\delta_{im}\delta_{jn} \\ &=\ldots \end{align}
> which is a [[Lagrange equation]] of the form $m \ddot{q}=\mathbf{F}$. > > If $\mathbf{B}=0$, then $\nabla\times \mathbf{A}=0$ and $\mathbf{E}=-\nabla \phi$. Since the vector potential is now irrotational, it can also be expressed by a potential, say $\chi$, as $\mathbf{A}=\nabla \chi$. (TODO: Finish this, end of lesson 26/03/2025; gauge transformation). > > If $\mathbf{B}$ is constant, then we want to find what kind of $\mathbf{A}$ leads to a constant $\nabla\times \mathbf{A}$. If $\mathbf{B}$ is entirely on the $z$ axis, we have > $$\mathbf{B}=\begin{pmatrix} > 0 \\ > 0 \\ > B > \end{pmatrix},\qquad \mathbf{A}=\frac{1}{2}\begin{pmatrix} > -B_{y} \\ > B_{x} \\ > 0 > \end{pmatrix}which are the terms above.
The Lagrangian can then be written in general as
> The Lagrangian is > $$L=\frac{m}{2}(\dot{x}^{2}+\dot{y}^{2}+\dot{z}^{2})+ \frac{e}{2}B(x \dot{y}-y \dot{x})=\frac{m}{2}(\dot{r}^{2}+r^{2}\dot{\varphi}^{2}+\zeta ^{2})+ \frac{e}{2}B^{2}r^{2}\dot{\varphi}In fact, the curl of is
\mathbf{e}_{1} & \partial_{x} & - \frac{B_{y}}{2} \\ \mathbf{e}_{2} & \partial_{y} & \frac{B_{x}}{2} \\ \mathbf{e}_{3} & \partial_{z} & 0 \end{pmatrix}=\left( \frac{B}{2}+ \frac{B}{2} \right)\mathbf{e}_{3}=\begin{pmatrix} 0 \\ 0 \\ B \end{pmatrix}
> The velocity vector $\mathbf{v}=(\dot{x},\dot{y},\dot{z})$ is also easy to find: > $$\dot{x}=R\cos \theta \cos \phi \dot{\theta}-R\sin \theta \sin \phi \dot{\phi},\quad y=R\cos \theta \sin \phi \dot{\theta}+R\sin \theta \cos \phi \dot{\phi},\quad z=-R\sin \theta \dot{\theta}where we also switched to cylindrical coordinates.
> where we used $\sin ^{2}x+\cos ^{2}x=1$. Remember that this quantity needs to be equal to > $$T=\frac{1}{2}\sum_{j,k=1}^{n} a_{jk}\dot{q}_{j}\dot{q}_{k}This is enough to find the kinetic energy
T&=\frac{1}{2}m(\dot{x}^{2}+\dot{y}^{2}+\dot{z}^{2}) \\ &=\frac{1}{2}m[(R^{2}\cos ^{2}\theta \cos ^{2}\phi \dot{\theta}^{2}-\cancel{ 2R^{2}\dot{\theta}\dot{\phi}\cos \theta \cos \phi \sin \theta \sin \phi }+R^{2}\sin ^{2}\theta \sin ^{2}\phi \dot{\phi} ^{2}) \\ &\qquad \quad+(R^{2}\cos ^{2}\theta \sin ^{2}\phi \dot{\theta}^{2}+\cancel{ 2R^{2}\dot{\theta}\dot{\phi}\cos \theta \sin \phi \sin \theta \cos \phi }+R^{2}\sin ^{2} \theta \cos ^{2}\phi \dot{\phi}^{2}) \\ &\qquad \quad+(R^{2}\sin ^{2}\theta \dot{\theta}) ] \\ &=\frac{1}{2}m[R^{2}\sin ^{2}\theta \dot{\phi}^{2}+R^{2}\dot{\theta }^{2}] \end{align}
> The two off-diagonal mixed terms must evidently be null, whereas the diagonal terms must be $mR^{2}\sin ^{2}\theta$ and $mR^{2}$ respectively. The kinetic matrix then is > $$\mathrm{a}=\begin{pmatrix} > mR^{2}\sin ^{2}\theta & 0 \\ > 0 & mR^{2} > \end{pmatrix}In our case, and and , so
> Through this, we get to the two Lagrange equation we need (one in $\theta$ and one in $\phi$). Firstly, let's differentiate $L$. > $$\frac{ \partial L }{ \partial \theta }=mR^{2}\sin \theta \cos \theta \phi ^{2}+mgR\sin \theta,\quad\frac{ \partial L }{ \partial \dot{\theta} } =mR^{2}\dot{\theta},\quad \frac{d}{dt} \frac{ \partial L }{ \partial \dot{\theta} } =mR^{2}\ddot{\theta}This is a function of , since it depends on .
We now need the potential energy. For a pendulum, it's just gravity, so . With both kinds of energies determined, we are ready to write the Lagrangian:
> Dividing through by $mR^{2}$ we get > $$\boxed{\ddot{\theta}=\sin \theta \cos \theta \phi ^{2}+ \frac{g}{R}\sin \theta}which leads to
> and so > $$mR^{2}\sin ^{2}\theta \ddot{\phi}=-2mR^{2}\sin \theta \cos \theta \dot{\theta}\dot{\phi}Doing the same thing for gives
> When solved, these two equations provide the motion in both coordinates. We can then use the coordinate transformation to convert to $x,y,z$. Note how these equations depend on each other, since $\phi$ appears in the $\ddot{\theta}$ equation and $\theta$ appears in $\ddot{\phi}$. These are so-called *coupled* equations and they are generally very difficult, if possible, to solve by hand. A [[Numerical integration]] method is often needed. > [!example]- Pendulum with a spring joint > In this example, we'll analyze how a spring interacts with gravity. Consider a point mass attached to the $x$ axis by a spring of some elastic constant that always remains exactly vertical. Gravity pulls the mass down. Crucially, the spring is allowed to slide over the $x$ axis: thing of it like a coat hanger on a metal pipe of sorts. > > ![[Diagram Spring pendulum.svg]] > > We'll use [[polar coordinates]], with a distance $l$ and an angle $q$. The coordinate transformation back to $x$ and $y$ is $x=l\sin q$ and $y=-l\cos q$. Their derivatives are $\dot{x}=l\cos q\dot{q}$ and $\dot{y}=l\sin q\dot{q}$, which leads to kinetic energy > $$T=\frac{1}{2}m(\dot{x}^{2}+\dot{y}^{2})=\frac{1}{2}m(l^{2}\cos ^{2}q \dot{q}^{2}+l^{2}\sin ^{2}q \dot{q}^{2})=\frac{1}{2}ml^{2}\dot{q}^{2}Dividing through by gives
> The Lagrangian is the usual $L=T-V$, but here it's more interesting to look at [[equilibrium point|equilibrium points]]. To find them, we need to find [[Punto critico|stationary points]] of the potential: > $$V'(q)=mgl\sin q-kl^{2}\cos q\sin q=kl^{2}\sin q\left[ \frac{mg}{kl}-\cos q \right]The potential energy is a mix of gravitational and elastic potential:
> For our guess in $q=0$ we see > $$V''(0)=mgl-kl^{2}=\left( \frac{mg}{kl}-1 \right)kl^{2}This nullifies at , which means . Alternatively, it nullifies for , which means . Well, sort of. The arccosine is only defined in , so we can't allow to have any value. Such an equilibrium point only exists if (it's because are all ). To find which of these are minima, we need the second derivative:
V''(q)&=mgl\cos q-kl^{2}\cos ^{2}q+kl^{2}\sin ^{2}q \\ &=mgl\cos q-2kl^{2}\cos q+kl^{2} \end{align}
> This is because if these points exist, then $mg/kl<1$, which means $mg<kl$ and so $kl-mg>0$. So if the points exists, they are always stable. In summary: > > $$\begin{array}{c|c} > & \frac{mg}{kl}<1 & \frac{mg}{kl}>1 \\ > q=0 & \text{unstable} & \text{stable} \\ > q=\pi & \text{unstable} & \text{unstable} \\ > q^{*} & \text{stable} & - \\ > -q^{*} & \text{stable} & - > \end{array}, the and the point is stable. Else it is unstable. If , , which gives us no information on the point. We'd need the third derivative, or some other information about the point, which is beyond the interest of this example.
The guess leads to which is everywhere, so it's never stable.
Now, as for the arccosine point, we can qualitatively analyze . Since doesn't change and is not part of the construction, we'll look at and . If the spring constant is very small (, and thus the string "pulls" very little), this value is very large, and so never . This tells us that this equilibrium point is reliant on a strong enough spring, or alternatively a very large pendulum (). In fact, if we look at the actual contraption, you'll see that the gravitational force applied to the point mass is going downwards (since is also going downwards), but the spring response is going in the exact opposite direction, upwards. If the spring response is strong enough (read: is big), then it can fully cancel out and leave no force left, thus leaving the system at rest. But again, this can only happen if the spring is strong enough to counteract gravity; anything weaker and it'll be overcome.
Quantitatively, we'll check the potential. Call the two possible equilibrium points and :
V''(\pm q^{*})&=mgl \frac{mg}{kl}-2kl^{2} \left( \frac{mg}{kl} \right)^{2}+kl^{2} \\ &=\frac{(mg)^{2}}{k}- 2 \frac{(mg)^{2}}{k}+kl^{2} \\ &=\frac{(kl)^{2}- (mg)^{2}}{k} \\ &=\frac{(kl-mg)(kl+mg)}{k}> 0 \end{align}
When plotted, they look like this:
The two points split in the middle as the parameter goes lower. This shape is called a bifurcation and this graph allows us to get an idea of how the potential looks like by tracing a vertical line anywhere in the graph to fix any one . Since stable points are potential minima and unstable ones are potential maxima, our potential has two behaviors. When , it's a rather typical parabola, with maxima at and minima at ; about what you'd expect from the usual pendulum. But when the spring gets rigid enough, and we start to see the characteristic behavior of this pendulum. The vertical is no longer a stable equilibrium point, so the two new "oblique" equilibrium points come in as the "replacement" minima. This gives the potential two valleys with an additional central peak at .