Lagrangian mechanics
The Lagrangian \(\mathcal L\) is a function which summarizes the entire state of a classical mechanical system. In simple systems of \(N\) particles \(m_k\) with position \(\vec r_k\), we have the following non-relativisitc Lagrangian where \(\mathcal U \) is the potential energy.
\[ \mathcal L = \mathcal T - \mathcal U \hspace{6mm} \text{ where } \hspace{6mm} \mathcal T = \frac 1 2 \sum_{k=1}^ N m_k\dot r_k^2 \]From the Lagrangian arises the notion of Action \(\mathcal S\), which is defined as the time integral of the Lagrangian between two points in time, representing an integral over some trajectory or path between two configurations of the system.
\[ \mathcal S = \int_{t_1}^{t_2} L\,dt \]The Principle of Least Action states that out of all possible paths, a system will take the one for which this quantity is stationary to the first order, in other words, \(\delta \mathcal S = 0\).
Lagrange's equations of the first kind
Out of the principle of least action arises the Lagrange equations, which fully describe a system of \(N\) particles and \(C\) constraint functions, which are basically restrictions to the configuration of the system.
\[ \frac{\partial \mathcal L}{\partial \vec r_k} - \frac{d}{dt} \frac{\partial \mathcal L}{\partial \dot{\vec r}_k} + \sum_{i=1}^C \lambda_i \frac{\partial f_i}{\partial \vec r_k} = 0 \]For example, a constraint for a pendulum of length \(\ell\) is \(f(x,y) = x^2 + y^2 = \ell^2\).
Euler-Lagrange equations (second kind)
A much more useful method for Lagrangian mechanics comes from the Euler-Lagrange equations, whereby, if you can describe a system with generalized coordinates \(\vec q_j\), which describe a configuration space embodying the constraints on the system, we no longer need to worry about Lagrange multipliers, and have a simpler relation:
\[ \frac d {dt} \left(\frac{\partial\mathcal L}{\partial \dot q_j}\right) = \frac {\partial \mathcal L}{\partial q_j} \]For example, the pendulum above can instead be described by a generalized coordinate \(\varphi\) where \(x = \ell\sin\varphi,\, y=\ell\cos\varphi\). This completely contains the information from the restriction of \(f(x,y)\) to \(\ell^2\).
Example: 2 dim'l pendulum
Continuing on with our pendulum, let's use Lagrangian mechanics to find the equations of motion. First, we need our Lagrangian \(\mathcal L(\vec q, \dot {\vec q}, t)\) in terms of our generalized coordinate \(\varphi(t)\):
\[ \vec r = \ell\hat\varphi, \,\, \dot r = \ell\dot\varphi\] \[ \mathcal L = \mathcal T - \mathcal U = \frac 1 2 m\dot r^2 + mgy = \frac 1 2 m \ell^2 \dot \varphi^2 + mg\ell\cos\varphi \]Now, we can apply the Euler-Lagrange equations for \(\varphi\),
\[ \left[ \frac d {dt} \left(\frac{\partial\mathcal L}{\partial \dot \varphi}\right) = \frac d {dt} \left( m\ell^2\dot\varphi \right) = m\ell^2\ddot\varphi \right] = \left[ \frac {\partial \mathcal L}{\partial \varphi} = -mg\ell \sin\varphi \right] \] \[ \implies \ddot \varphi + \frac g \ell \sin\varphi = 0 \]Which, of course, is the equation of motion for a simple pendulum, and we can even apply our small angle approximation:
\[ \varphi \ll 1 \implies \sin\varphi\approx\varphi \implies \ddot\varphi + \frac g \ell \varphi = 0 \]