# Advanced Classical Mechanics/Constraints and Lagrange's Equations

There is more to classical mechanics than $F=ma$. Often the motion of a system is constrained in some way.

## What are constraints?

* The particles could be restricted to travel along a curve or surface. Specifically one could have some function of the coordinates of each particle and time vanish. These restrictions are either kinematical or geometrical in nature.
$f\left({\vec {r}}_{1},{\vec {r}}_{2},{\vec {r}}_{3},\cdots ,t\right)=0$
This is called a holonomic constraint. For example we could have
$\left({\vec {r}}_{i}-{\vec {r}}_{j}\right)^{2}-c_{ij}^{2}=0$
which expresses that the distances between two particles that make up a rigid body are fixed.
* There are non-holonomic constraints. For example, one could have
$r^{2}-a^{2}\geq 0$ for a particle travelling outside the surface of a sphere or constraints that depend on velocities as well,
$f\left({\vec {r}}_{1},{\vec {r}}_{2},{\vec {r}}_{3},\cdots ,{\vec {v}}_{1},{\vec {v}}_{2},{\vec {v}}_{3},\cdots ,t\right)=0.$
A familar example of the latter is a ball rolling on a surface.
We will be dealing exclusively with holonomic constraints in this course.

## What are the consequences?

* The coordinates are no longer independent. They are related through the equations of constraint.
* The force of constraint are not given so they must be determined from the solution (if you actually want them at all).
* If the constraints are holonomic, the equations of constraint can be used to eliminate some of the coordinates to get a set of generalized independent coordinates.
These generalized coordinates usually will not fall into pairs or triples that transform as vectors, e.g. the natural coordinates for motion restricted to a sphere are spherical coordinates ($\theta ,\phi$).

## D'Alembert's Principle

D'Alembert's principle relies on the concept of virtual displacements. The idea is that you can imagine freezing the system in time and jiggling each of the particles in a way consistent with the various constraints at that particular time and determine the work (virtual work) needed to perform these virtual displacements.
We will denote the virtual displacement of a particle as $\delta {\vec {r}}_{i}$. The virtual displacement must be consistent with the constraints.
For each particle we have
${\vec {F}}_{i}={\dot {\vec {p}}}_{i}~{\rm {{so}~{\vec {F}}-{\dot {\vec {p}}}_{i}=0}}$
and summing over the particles we have
$\sum _{i}\left({\vec {F}}_{i}-{\dot {\vec {p}}}_{i}\right)\cdot \delta {\vec {r}}_{i}=0.$
Let's divide the force on each particle into applied forces and constraints
${\vec {F}}_{i}={\vec {F}}_{i}^{(a)}+{\vec {f}}_{i}$
so we have
$\sum _{i}\left({\vec {F}}_{i}-{\dot {\vec {p}}}_{i}\right)\cdot \delta {\vec {r}}_{i}=\sum _{i}\left({\vec {F}}_{i}^{(a)}-{\dot {\vec {p}}}_{i}\right)\cdot \delta {\vec {r}}_{i}+\sum _{i}{\vec {f}}_{i}\cdot \delta {\vec {r}}_{i}=0.$
If we assume that the forces of constraint do no virtual work, then the last term vanishes. This is a reasonable assumption because the force of constraint to restrict a particle to a surface is normal to that surface but a displacement consistent with the constraints is tangent to the surface so the dot product will vanish and the force of constraint performs no virtual work. If the constraints are a function of time, the forces of constraint can perform work on the particles but the whole idea of D'Alembert's principle is that we have frozen time.
This leaves us with
$\sum _{i}\left({\vec {F}}_{i}^{(a)}-{\dot {\vec {p}}}_{i}\right)\cdot \delta {\vec {r}}_{i}=0,$
D'Alembert's principle. The forces of constraints are gone! However, the coordinates are not independent, so the equation is only a statement about the sum of the various forces, momenta and virtual displacements.

## Generalized Coordinates

We can try to find a set of independent coordinates given the constraints. Let's write
${\vec {r}}_{i}={\vec {r}}_{i}\left(q_{1},q_{2},q_{3},\cdots ,t\right)$
and so
${\vec {v}}_{i}={\frac {d{\vec {r}}_{i}}{dt}}=\sum _{k}{\frac {\partial {\vec {r}}_{i}}{\partial q_{k}}}{\dot {q}}_{k}+{\frac {\partial {\vec {r}}_{i}}{\partial t}}$
and a virtual displacement is
$\delta {\vec {r}}_{i}=\sum _{j}{\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}\delta q_{j}.$
Notice that there is no $dt$ in the virtual displacement because time is held fixed. Now let's look at the first term in D'Alembert's equation
$\sum _{i}{\vec {F}}_{i}\cdot \delta {\vec {r}}_{i}=\sum _{i}{\vec {F}}_{i}\cdot \left(\sum _{j}{\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}\delta q_{j}\right)=\sum _{j}\left(\sum _{i}{\vec {F}}_{i}\cdot {\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}\right)\delta q_{j}=\sum _{j}Q_{j}\delta q_{j}$
where $Q_{j}$ is called a generalized force.
The second term takes a bit more work. We have
$\sum _{i}{\dot {\vec {p}}}_{i}\cdot \delta {\vec {r}}_{i}=\sum _{i}m_{i}{\ddot {\vec {r}}}_{i}\cdot \delta {\vec {r}}_{i}=\sum _{i}m_{i}{\ddot {\vec {r}}}_{i}\left(\sum _{j}{\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}\delta q_{j}\right).$
Let's focus on a particular one of the generalized coordinates j. We have
$\sum _{i}m_{i}{\ddot {\vec {r}}}_{i}\cdot {\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}=\sum _{i}\left[{\frac {d}{dt}}\left(m_{i}{\dot {\vec {r}}}_{i}\cdot {\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}\right)-m_{i}{\dot {\vec {r}}}_{i}\cdot {\frac {d}{dt}}\left({\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}\right)\right]$
$=\sum _{i}\left[{\frac {d}{dt}}\left(m_{i}{\vec {v}}_{i}\cdot {\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}\right)-m_{i}{\dot {\vec {r}}}_{i}\cdot {\frac {\partial {\vec {v}}_{i}}{\partial q_{j}}}\right]$
We can use the fact that
${\frac {\partial {\vec {v}}_{i}}{\partial {\dot {q}}_{j}}}={\frac {\partial {\vec {r}}_{i}}{\partial q_{k}}}$
from the defintion of ${\vec {v}}_{i}$ to get
$=\sum _{i}\left[{\frac {d}{dt}}\left(m_{i}{\vec {v}}_{i}\cdot {\frac {\partial {\vec {v}}_{i}}{\partial {\dot {q}}_{j}}}\right)-m_{i}{\dot {\vec {r}}}_{i}\cdot {\frac {\partial {\vec {v}}_{i}}{\partial q_{j}}}\right]$
$={\frac {d}{dt}}\left[{\frac {\partial }{\partial {\dot {q}}_{j}}}\sum _{i}\left({\frac {1}{2}}m_{i}v_{i}^{2}\right)\right]-{\frac {\partial }{\partial q_{j}}}\left[\sum _{i}\left({\frac {1}{2}}m_{i}v_{i}^{2}\right)\right].$
Notice that the quantity in the innermost parenthesis is just the total kinetic energy of the system $T$ so we have
$\sum _{j}\left\{\left[{\frac {d}{dt}}\left({\frac {\partial T}{\partial {\dot {q}}_{j}}}\right)-{\frac {\partial T}{\partial q_{j}}}\right]-Q_{j}\right\}\delta q_{j}=0.$

## Lagrange's Equations

If the constraints are holonomic, we can pick the $q_{j}$ to be independent so the various $\delta q_{j}$ are completely arbitrary and the quantity in braces must vanish to yield
$\left[{\frac {d}{dt}}\left({\frac {\partial T}{\partial {\dot {q}}_{j}}}\right)-{\frac {\partial T}{\partial q_{j}}}\right]=Q_{j}.$
These expressions are sometimes called Lagrange's equations, but the term Lagrange's equations is often reserved for the case of a conservative force. In this case we have
${\vec {F}}_{i}=-{\vec {\nabla }}_{i}V$ so
$Q_{j}=\sum _{i}{\vec {F}}_{i}\cdot {\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}=-\sum _{i}{\vec {\nabla }}_{i}V\cdot {\frac {\partial {\vec {r}}_{i}}{\partial q_{j}}}=-{\frac {\partial V}{\partial q_{j}}}$
In this case we can rearrange the equation to give
$\left[{\frac {d}{dt}}\left({\frac {\partial T}{\partial {\dot {q}}_{j}}}\right)-{\frac {\partial (T-V)}{\partial q_{j}}}\right]=0.$
Furthermore, if the forces do not depend explicitly on the velocities we can define, the Lagrangian to be $L=T-V$
and write Lagrange's equations in their traditional form
$\left[{\frac {d}{dt}}\left({\frac {\partial L}{\partial {\dot {q}}_{j}}}\right)-{\frac {\partial L}{\partial q_{j}}}\right]=0.$

## Conserved Quantities

For each coordinate we can define a conjugate momentum to be
$p_{i}={\frac {\partial L}{\partial {\dot {q}}_{i}}}.$
This is called the generalized momentum conjugate to the coordinate $q_{i}$. Let's look at Lagrange's equations with this definition
${\frac {dp_{i}}{dt}}={\frac {\partial L}{\partial q_{i}}}$
so if the Lagrangian does not depend on a particular coordinate $q_{i}$, then the momentum conjugate to the coordinate does not change with time; it is conserved. This conserved momentum is called a first integral. The coordinate that doesn't affect the Lagrangian is called a cyclic coordinate.
In general the Lagrangian will depend on the coordinates, velocities and time; what happens if $\partial L/\partial t$ vanishes? Is there a conserved quantity similar to the momenta?
Let calculate the total derivative of the Lagrangian with respect to time,
${\frac {dL}{dt}}=\sum _{i}\left[{\frac {\partial L}{\partial q_{i}}}{\dot {q}}_{i}+{\frac {\partial L}{\partial {\dot {q}}_{i}}}{\ddot {q}}_{i}\right]+{\frac {\partial L}{\partial t}}.$
Now let's use the definition of the momenta and the Lagrange's equation to simplify things a bit,
${\frac {dL}{dt}}=\sum _{i}\left[{\frac {dp_{i}}{dt}}{\dot {q}}_{i}+p_{i}{\ddot {q}}_{i}\right]+{\frac {\partial L}{\partial t}}=\sum _{i}{\frac {d(p_{i}{\dot {q}}_{i})}{dt}}+{\frac {\partial L}{\partial t}}$
and rearranging
${\frac {\partial L}{\partial t}}={\frac {d}{dt}}\left(L-\sum _{i}p_{i}{\dot {q}}_{i}\right).$
So if
$\partial L/\partial t=0$
then the Hamiltonian,
$H=L-\sum _{i}p_{i}{\dot {q}}_{i},$
is conserved.

## Lagrangians with Non-Conservative Forces

From the analysis so far it would appear that one can only construct a Lagrangian when the forces that act on a particle are conservative (they can be derived from a potential $V$). It is indeed the case that truly dissipative forces such as friction cannot be directly included in a Lagrangian formulation, but forces that can be written in the form $d/dt(\partial L/\partial {\dot {q}})$ may be included in the Lagrangian. Although this seems very restrictive, an important force of this class is the magnetic force on a charged particle.
${\vec {F}}=q\left({\vec {E}}+{\vec {v}}\times {\vec {B}}\right).$
In electrostatics the electric field is simply the gradient of the electrostatic potential, but for more general fields we have
${\vec {E}}=-{\vec {\nabla }}\phi -{\frac {\partial {\vec {A}}}{\partial t}}$
where ${\vec {A}}$ is the vector potential. The magnetic field may be written as
${\vec {B}}={\vec {\nabla }}\times {\vec {A}}.$
Let's consider the function
$V=q\phi \left({\vec {r}},t\right)-q{\dot {\vec {r}}}\cdot {\vec {A}}\left({\vec {r}},t\right)$
and calculate
${\frac {d}{dt}}\left({\frac {\partial V}{\partial {\dot {x}}}}\right)-{\frac {\partial V}{\partial x}}=-q{\frac {dA_{x}}{dt}}-q{\frac {\partial \phi }{\partial x}}+q\left({\dot {x}}{\frac {\partial A_{x}}{\partial x}}+{\dot {y}}{\frac {\partial A_{y}}{\partial x}}+{\dot {z}}{\frac {\partial A_{z}}{\partial x}}\right).$
The total time derivative of the vector potential generates several terms (due to the chain rule) to yield
${\frac {d}{dt}}\left({\frac {\partial V}{\partial {\dot {x}}}}\right)-{\frac {\partial V}{\partial x}}=-q\left({\frac {\partial A_{x}}{\partial t}}+{\dot {x}}{\frac {\partial A_{x}}{\partial x}}+{\dot {y}}{\frac {\partial A_{x}}{\partial y}}+{\dot {z}}{\frac {\partial A_{x}}{\partial z}}\right)-q{\frac {\partial \phi }{\partial x}}+q\left({\dot {x}}{\frac {\partial A_{x}}{\partial x}}+{\dot {y}}{\frac {\partial A_{y}}{\partial x}}+{\dot {z}}{\frac {\partial A_{z}}{\partial x}}\right).$
Notice that the terms proportional to ${\dot {x}}$ cancel leaving
${\frac {d}{dt}}\left({\frac {\partial V}{\partial {\dot {x}}}}\right)-{\frac {\partial V}{\partial x}}=-q\left({\frac {\partial \phi }{\partial x}}+{\frac {\partial A_{x}}{\partial t}}\right)+q\left[{\dot {y}}\left({\frac {\partial A_{x}}{\partial y}}-{\frac {\partial A_{y}}{\partial x}}\right)+{\dot {z}}\left({\frac {\partial A_{x}}{\partial z}}-{\frac {\partial A_{z}}{\partial x}}\right)\right].$
The first term is simply the charge of the particle times the x-component of the electric field. The second term is the charge of the particles times the x-component of ${\vec {v}}\times {\vec {B}}$, so the following Lagrangian will yield the equations of motion
$L={\frac {1}{2}}m{\dot {r}}^{2}+q{\vec {\dot {r}}}\cdot {\vec {A}}\left({\vec {r}},t\right)-q\phi \left({\vec {r}},t\right).$
If the vector potential and the scalar potential do not depend on time, then $\partial L/\partial t=0$ and
$H={\frac {\partial L}{\partial {\dot {\vec {r}}}}}\cdot {\dot {\vec {r}}}-L={\frac {1}{2}}m{\dot {r}}^{2}+q\phi \left({\vec {r}},t\right)$
is conserved. The force is not conservative but the system is.