B.2. The calculus of variations and the Euler-Lagrange equation

\label{sec-math-calcvar}

The Euler-Lagrange equation from the calculus of variations is crucial to the Lagrangian formulation of Newtonian dynamics, so we introduce and derive it here. The Euler-Lagrange equation provides a way to solve problems that involve the optimization of an action functional, such as the action integral from Equation (3.17) in the Lagrangian formulation, which we repeat here \begin{equation}\label{eq-math-calcvar-actionintegral} S = \int_{t_1}^{t_2}\mathrm{d}t \,\mathcal{L}(\vec{x},\dot{\vec{x}},t)\,, \end{equation} where \(\mathcal{L}(\vec{x},\dot{\vec{x}},t)\) is the Lagrangian. The Euler-Lagrange equation is then a way to find paths \((\vec{x}[t],\dot{\vec{x}}[t])\) for which this action functional is extremized (i.e., has a minimum or a maximum).

To derive the Euler-Lagrange equation, we consider a small perturbation \(\varepsilon\,\boldsymbol{\eta}(t)\) to the path \(\vec{x}(t)\) that vanishes at the end-points of the integration range (so \(\boldsymbol{\eta}(t_1) = \boldsymbol{\eta}(t_2) = 0\)), such that \(\vec{x}(t) \rightarrow \vec{x}(t) +\varepsilon\,\boldsymbol{\eta}(t)\) and \(\dot{\vec{x}}(t) \rightarrow \dot{\vec{x}}(t) +\varepsilon\,\dot{\boldsymbol{\eta}}(t)\). We then solve for the path for which the action integral has an extremum with respect to \(\varepsilon\) for any \(\boldsymbol{\eta}\). To do this, we assume that the Lagrangian is twice differentiable, which it always is in the context of galactic dynamics. Under a perturbation \(\varepsilon\,\boldsymbol{\eta}(t)\), the action integral becomes \begin{equation} S(\varepsilon) = \int_{t_1}^{t_2}\mathrm{d}t \,\mathcal{L}(\vec{x}+\varepsilon\,\boldsymbol{\eta},\dot{\vec{x}}+\varepsilon\,\dot{\boldsymbol{\eta}},t)\,, \end{equation} and this has an extremum when the derivative with respect to \(\varepsilon\) is zero: \begin{equation} {\mathrm{d} S(\varepsilon) \over \mathrm{d} \varepsilon} = \int_{t_1}^{t_2}\mathrm{d}t \,\left(\boldsymbol{\eta}\,{\partial \mathcal{L} \over \partial \vec{x}}+\dot{\boldsymbol{\eta}}\,{\partial \mathcal{L} \over \partial \dot{\vec{x}}}\right) = 0\,. \end{equation} Using integration by parts, we can re-write the second term in the integral and derive \begin{equation} \int_{t_1}^{t_2}\mathrm{d}t \,\boldsymbol{\eta}\,\left({\partial \mathcal{L} \over \partial \vec{x}}-{\mathrm{d} \over \mathrm{d}t}\left[{\partial \mathcal{L} \over \partial \dot{\vec{x}}}\right]\right) = 0\,, \end{equation} because the perturbation vanishes at the end-points. Because this equation must hold for any \(\boldsymbol{\eta}\), the integrand itself must vanish everywhere, so we arrive at the Euler-Lagrange equation \begin{equation}\label{eq-math-calcvar-eulerlagrange} {\mathrm{d} \over \mathrm{d}t}\left({\partial \mathcal{L} \over \partial \dot{\vec{x}}}\right) - {\partial \mathcal{L} \over \partial \vec{x}}= 0\,. \end{equation}