# A calculus of variations equation

Let $L$ be as smooth as needed a function of the arguments $(q_1,\dots,q_n,\dot q_1,\dots,\dot q_n,t)$, where the dot denotes the derivetive with respect to $t$. Let $\delta$ denote the variation of any function due to a small variation of its arguments.

Then $$\delta L=\sum_{r=1}^n\frac{\partial L}{\partial q_r}\delta q_r+\frac{\partial L}{\partial\dot q_r}\delta\dot q_r$$

Would anyone give the derivation of the equation $$\delta L=\delta\sum_{r=1}^n\frac{\partial L}{\partial\dot q_r}\dot q_r+\sum_{r=1}^n(\frac{\partial L}{\partial q_r}\delta q_r-\dot q_r\delta \frac{\partial L}{\partial\dot q_r})$$

$$\delta \sum_r \frac{\partial L}{\partial \dot q_r} \dot q_r = \sum_r \delta \left(\frac{\partial L}{\partial \dot q_r} \dot q_r \right) = \sum_r \left( \frac{\partial L}{\partial \dot q_r} \delta\dot q_r + \dot q_r \delta \frac{\partial L}{\partial \dot q_r}\right).$$
The second term will cancel the last term on your desired equation, giving your original expression for $\delta L$.