*This article takes the knowledge of **Partial Differential Equations** as a prerequisite.* [[Partial Derivatives (Maths)|This link]] *will take you to another article detailing partial derivatives up to PDEs.*
# Intro to Lagrangians
Lagrangians are, VERY, VERY SIMPLIFIED:
$L = T - U \tag{1}$
Where $L$ is the **Lagrangian "Operator"**, $T$ is the Kinetic Energy, and $U$ is the potential energy.
# Proving the Euler-Lagrange Equation
*Good luck! See the multivariable parts in* [[Calc NavPage]] *if you haven't already.*
Consider a path $y(x)$. The integral:
$F(y) = \int_{a}^b f(x,y(x), y'(x)) \, dx \tag{2}$
Provides a minimum value for $F(y)$. Now, let's define another arbitrary function $w(x)$, with conditions $w(a) = w(b) = 0$. We can now assume, that with a small difference variable $\epsilon$, this function can be written as:
$y_{\epsilon} (x) := y(x) + \epsilon w(x) \tag{3}$
Where $:=$ is a logic statement for "is assigned the value of". If we use this function, we can rewrite the above integral as:
$g(\epsilon) = F[y_{\epsilon}] = \int_{a}^b f(x, y_{\epsilon}, y'_{\epsilon}) \, dx \tag{4}$
Where $g(\epsilon)$ is another arbitrary function. Now, we differentiate $g(\epsilon)$ and $\int_{a}^b f(x, y_{\epsilon}, y'_{\epsilon}) \, dx$, replacing $y_{\epsilon}$ with equation (3) to get:
$\frac{dg}{d \epsilon} = \frac{d}{d\epsilon} \int _{a}^b f(x, y_{\epsilon}, y'_{\epsilon}) \, dx \tag{5}$
$\frac{dg}{d \epsilon} = \frac{d}{d\epsilon} \int _{a}^b f(x, y(x) + \epsilon w(x), y'(x) + \epsilon w'(x)) \, dx \tag{6} $
As $x$ does not depend on $\epsilon$, we only have to differentiate with respect to $y$ and $y'$, as shown. Remember - take the part in each that varies with $\epsilon$ !
$\frac{dg}{d \epsilon} = \int _{a}^b w(x)\frac{\delta f}{\delta y} (x, y(x) + \epsilon w(x), y'(x) + \epsilon w'(x)) +w'(x)\frac{\delta f}{\delta y'}(x, y(x) + \epsilon w(x), y'(x) + \epsilon w'(x)) \, dx \tag{7}$
All of which we can rewrite as:
$\frac{dg}{d \epsilon} = \int_{a}^b \left( w(x) \ \frac{\delta f}{\delta y} + \frac{\delta f}{\delta y'} w'(x)\right) \, dx \tag{8}$
We've established in equation (2) that when $\epsilon = 0$, the function is most optimised. At that point, looking back at equation (4), $g(\epsilon)$ imost optimised and is therefore at a **minimum.** Equation (5) also tells us that $\frac{dg}{d\epsilon}_{|\epsilon = 0} = 0$ when $\epsilon = 0$, so:
$0 = \int_{a}^b \left( w(x) \ \frac{\delta f}{\delta y} + \frac{\delta f}{\delta y'} w'(x)\right) \, dx \tag{9}$
We can now integrate the $w'(x)$ term by parts in order to get a more familiar version of the equation (tip: let w'(x) be the thing we're integrating!):
$0 = \int_{a}^b w(x) \left[ \frac{\delta f}{\delta y} + \frac{d}{dx} \frac{\delta f}{\delta y'} \right] \, dx \tag{10}$
...which we can let the rightmost bit of this function equal to $u(x)$, a now defined function.
$0 = \int_{a}^b w(x) u(x) \, dx \tag{11}$
Now, it's back to the boundary conditions for $w(x)$, where the bounds are 0 and 0 respectively. So regardless of what $u(x)$ is, the integral will be equal to 0! That means we get the final, standard form of the *Euler-Lagrange Equation*, which is:
$ \frac{\delta f}{\delta y} + \frac{d}{dx} \frac{\delta f}{\delta y'} = 0 \tag{12}$
# Modelling a Double Pendulum - Example