# Derivation of the Euler-Lagrange-Equation

We would like to find a condition for the Lagrange function $L$, so that its integral, the action $S$, becomes maximal or minimal.

For that, we change the coordinate $q(t)$ by a little variation $\eta(t)$, although infinitesimal. Additionally, $\eta(t_1) = \eta(t_2) = 0$ has to hold. The integral of the Lagrange function becomes:

$$S = \int_{t_1}^{t_2} L\left(q(t) + \epsilon \eta(t), \dot q(t) + \epsilon \dot \eta(t), t \right) \, \mathrm dt$$

This should be extremal with respect to $\epsilon$. So we need to differentiate with respect to that and set equal to `0`:

$$\frac{\mathrm d}{\mathrm d \epsilon} \int_{t_1}^{t_2} L\left(q(t) + \epsilon \eta(t), \dot q(t) + \epsilon \dot \eta(t), t \right) \, \mathrm dt = 0$$

For this total derivative, the partial derivatives of $L$ and $q(t) + \epsilon \eta(t)$ and $\dot q(t) + \epsilon \dot \eta(t)$ have to be found.

$$\int_{t_1}^{t_2} \left( \frac{\partial L}{\partial q} \eta + \frac{\partial L}{\partial \dot q} \dot \eta \right) \, \mathrm dt = 0$$

For the second summand, we use partial integration:

$$\int_{t_1}^{t_2} \frac{\partial L}{\partial \dot q} \dot \eta(t) \, \mathrm
dt = \underbrace{\left[ \frac{\partial L}{\partial \dot q}
\eta\right]*{t_1}^{t_2}}* - \int_{t_1}^{t_2} \frac{\mathrm d}{\mathrm
dt} \frac{\partial L}{\partial \dot q} \eta(t) \, \mathrm dt$$

The middle term is equal to $0$ since $\eta(0)$ vanished on the boundary points. Therefore, the last term remains.

$$\int_{t_1}^{t_2} \left( \frac{\partial L}{\partial q} \eta(t) - \frac{\mathrm d}{\mathrm d t} \frac{\partial L}{\partial \dot q} \eta(t) \right) \, \mathrm dt = 0$$

Now we can factor out that $\eta(t)$. The integral vanished for all variations $\eta(t)$ iff the parentheses vanishes.

$$\int_{t_1}^{t_2} \left( \frac{\partial L}{\partial q} - \frac{\mathrm d}{\mathrm d t} \frac{\partial L}{\partial \dot q} \right) \eta(t) \, \mathrm dt = 0$$

We yield the Euler-Lagrange-Equation:

$$\frac{\partial L}{\partial q} - \frac{\mathrm d}{\mathrm d t} \frac{\partial L}{\partial \dot q} = 0$$