Derivation of the Euler-Lagrange Equation and the Principle of Least Action .
Hello, everyone
I have some trouble with the calculus in the derivation of the Euler-Lagrange equation for the principle of least action. Specifically:
$\newcommand{\lagr}{\mathcal{L}}$
$\delta S = \delta \int_{t_1}^{t_2}\lagr(q,\dot{q},t)dt=0 $ 
$\delta S = \int_{t_1}^{t_2} (\frac{\partial{\lagr}}{\partial{q}}\delta q + \frac{\partial{\lagr}}{\partial{\dot{q}}} \delta \dot{q})dt=0$ (Eq. 2)
$\delta \dot{q}= \frac{d}{dt} \delta q $
Integrating the second term by parts we get
$ I_2 = \int_{t_1}^{t_2} (\frac{\partial{\lagr}}{\partial{\dot{q}}} \cdot \frac{d}{dt} \delta q) dt = [\frac {\partial{\lagr}} {\partial{\dot{q}}} \delta q]_{t_1}^{t_2} - \int_{t_1}^{t_2} \delta q \cdot \frac{d}{dt}(\frac{\partial{\lagr}}{\partial{\dot{q}}})dt $
Substituting this into eq. 2 
$\delta S = [\frac{\partial{\lagr}}{\partial{\dot{q}}}\delta q]_{t_1}^{t_2} + \int_{t_1}^{t_2} (\frac{\partial{\lagr}}{\partial{q}} - \frac{d}{dt} \frac{\partial{\lagr}}{\partial{\dot{q}}}) \delta q dt=0$ 
The parts I am having trouble with are:


*

*During the integration by parts (at $I_2$) why can't we just take the $\frac{d}{dt}$ term outside the integral and end up with  $ \frac{\partial{\lagr}}{\partial{\dot{q}}}\delta q $ for the whole integral ? Is it because d/dt only applies to delta q?

*If the boundary conditions dictate $\delta q$ must be equal to zero for $t_1$ and $t_2$, why do we say $\delta q$ can take on any value, and therefore the integrand $(\frac{\partial{\lagr}}{\partial{q}} - \frac{d}{dt} \frac{\partial{\lagr}}{\partial{\dot{q}}})$ must equal to zero to satisfy the equation?

*What does $\delta $ actually describe? Is it kind of a total derivative?
Thank you for your help
 A: More or less formally, what happens when deriving the Euler-Lagrange equations is what follows.
We consider the "space" of all the smooth paths $q:[0,1]\to\mathbb{R}^3$ (I take [0,1] for simplicity) and look at the Lagrangian as a functional on this space. Given a path $q$, we "deform it" by a path
$$\delta q:[0,1]\to\mathbb{R}^3$$
with $q(0)=q(1)=0$ (so that the endpoints don't change; you can do this in greater generality but I won't do it here), i.e. we consider the path $q+\epsilon\delta q$ with small $\epsilon\in\mathbb{R}$. Now we find the extrema of the action by "differentiating in direction $\delta q$"
\begin{align}
0={}&\left.\frac{d}{d\epsilon}\right|_{\epsilon=0}\int_0^1L(q+\epsilon\delta q,\dot q+\epsilon\delta\dot q)dt\\
={}&\int_0^1\left.\frac{d}{d\epsilon}\right|_{\epsilon=0}L(q+\epsilon\delta q,\dot q+\epsilon\delta\dot q)dt\\
={}&\int_0^1\left(\frac{\partial L}{\partial q}\delta q + \frac{\partial L}{\partial\dot q}\delta\dot q\right) dt\\
={}&\int_0^1\left(\frac{\partial L}{\partial q}\delta q - \frac{d}{dt}\frac{\partial L}{\partial\dot q}\delta q\right) dt\\
={}&\int_0^1\left(\frac{\partial L}{\partial q} - \frac{d}{dt}\frac{\partial L}{\partial\dot q}\right)\delta q\,dt\ ,
\end{align}
where in the second to last line we used integration by parts. This is true if, and only if (and I'll leave it to you to prove)
$$\frac{\partial L}{\partial q} - \frac{d}{dt}\frac{\partial L}{\partial\dot q} = 0\ .$$
I hope this helps to clarify the derivation of the Euler-Lagrange equations!
