# Time derivative of the Lagrangian

I have the time derivative of the lagrangian:

$$\frac{\mathrm d \mathcal L}{\mathrm d t}=\sum_i\left(\frac{\partial \mathcal L}{\partial q_i}\frac{\mathrm d q_i}{\mathrm d t}+\frac{\partial \mathcal L}{\partial \dot{q_i}}\frac{\mathrm d \dot{q_i}}{\mathrm d t}\right)+\frac{\partial \mathcal L}{\partial t}$$

Can someone explain how I can obtain that expression?

• It's the multivariable chain rule. – Javier Oct 24 '19 at 15:24
• This post in the Math Stack Exchange deals with your question. The first answer explains the concept of "total derivative" which is exactly what you need to undestand the formula in your question. – S V Oct 24 '19 at 15:42

That's just the regular chain rule from multivariable calculus, recall that the Lagrangian is a function of positions, velocities and time $$\mathcal{L}\left(q,\dot{q},t\right)$$

The first two terms of your equation come from the derivatives of $$\mathcal{L}$$ respect to $$q$$ and $$\dot{q}$$ while the third term comes from the derivative of $$\mathcal{L}$$ respect to time.

This is just the Chain Rule (from multivariable calculus).

You have then the function (the lagrangian): $$L(q_{i},\dot{q}_{i},t)$$. Then applying the differentiation (total derivative) with respect to time you have:

$$\frac{\mathrm{d}}{\mathrm{d}t}\Big[L(q_{i},\dot{q}_{i},t)\Big] = \frac{\partial L}{\partial q_{i}}\frac{dq_{i}}{dt}+\frac{\partial L }{\partial \dot{q}_{i}}\frac{d\dot{q}_{i}}{dt}+\frac{\partial L}{\partial t}\frac{dt}{dt} = \frac{\partial L}{\partial q_{i}}\frac{dq_{i}}{dt}+\frac{\partial L }{\partial \dot{q}_{i}}\frac{d\dot{q}_{i}}{dt}+\frac{\partial L}{\partial t}(1) \implies$$

$$\frac{\mathrm{d}}{\mathrm{d}t}\Big[L (q_{i},\dot{q}_{i},t)\Big] = \frac{\partial L}{\partial q_{i}}\frac{dq_{i}}{dt}+\frac{\partial L }{\partial \dot{q}_{i}}\frac{d\dot{q}_{i}}{dt}+\frac{\partial L}{\partial t} \tag{1}$$

But, note that we have a sum under the $$i's$$, then:

$$\frac{\mathrm{d}}{\mathrm{d}t}\Big[L (q_{i},\dot{q}_{i},t)\Big] = \sum_{i=1}^{n}\Bigg(\frac{\partial L}{\partial q_{i}}\frac{dq_{i}}{dt}+\frac{\partial L }{\partial \dot{q}_{i}}\frac{d\dot{q}_{i}}{dt}\Bigg)+\frac{\partial L}{\partial t} \tag{2}$$

This is called Einstein Summation convention: the notation that tells you that it's possible to supress an summation symbol when you identify a pair of indexes occuring. Just like:

$$a_{i}b^{i} \equiv \sum_{i} a_{i}b^{i} \tag{3}$$

You can more or less obtain it from the definition of the expression.

It is really easy to get confused here so I would encourage you to take this whole thing one big conceptual step backwards. There are two things to emphasize.

# The realm of mathematical purity in multivariate calculus

The first is about functions. In the realm of pure mathematics, a function $$f: \mathbb R^n \to \mathbb R$$ has $$n$$ arguments which are all real numbers, and the world of mathematics does not care what you call them. You can take a partial derivative with respect to any one of them while holding the other ones constant, which if you wrote it in the purest and most correct way possible, you would write with something like an operator for the index of the one that we are deriving, so for example $$\big\{\partial^{3}f\big\}(x_1,\dots x_n) = \lim_{h\to 0} \frac{f(x_1, x_2, x_3 + h, x_4, \dots x_n) - f(x_1, x_2, x_3, x_4, \dots x_n)}{h}.$$

I have to stress that at some level this is the only notion of partial derivative that exists in the realm of pure mathematics and everything else is us physicists trying to write things with nicer symbols, ignoring the distinctions between different functions.

Now the central claim of ordinary differential calculus is “there is this nice set of functions which have curves where if you zoom in enough, it looks like a straight line.” The central claim of multivariable calculus is the same but replace “line” with “plane” and so on for higher orders: the idea is that this big surface looks like some sort of flat hyperplane at higher dimensions. Like with ordinary calculus, the assertion is not always true for every function, but it is true for lots of nice functions that we can use. We can write this linearity formally as, for example in a function $$\mathbb R^3\to \mathbb R,$$ that $$f(x + \delta x, y + \delta y, z + \delta z) \approx f(x,y,z) + \frac{\partial f}{\partial x}~\delta x + \frac{\partial f}{\partial y}~\delta y + \frac{\partial f}{\partial z}~\delta z,$$ for small $$\delta x,\delta y, \delta z.$$ Or in the more general case, $$f(\mathbf x + \delta \mathbf x) \approx f(\mathbf x) + \sum_{k=1}^n (\partial^k f)\cdot \delta x_k.$$

# The application of that math to physics

Now unfortunately in the expression you have there is a sort of lie called an equivocation, the same symbol $$L$$ is being used to mean two completely different things. There is the actual Lagrangian function, which has shape $$L: \mathbb R^{2n+1}\to\mathbb R$$ and therefore has partial derivatives for each of its arguments $$t, ~q_{1,2,\dots n},~\dot q_{1,2,\dots n}$$, and then there is its application to a path, which we might call $$L_{\mathbf Q}(t),$$ which has shape $$L_{\mathbf Q}: \mathbb R \to \mathbb R$$ once it has accepted this “path” argument $$\mathbf Q : \mathbb R \to \mathbb R^n.$$

Note that the arguments for $$L$$ that I am calling $$q_i, \dot q_i$$ are just numeric parameters, the same as any function. The dot here does not mean a time derivative formally, it is just a different symbol from $$q_i$$. But then this path $$\mathbf Q(t)$$ is actually $$n$$ component functions of time $$Q_i: \mathbb R \to \mathbb R$$ and then we use that to get $$n$$ more functions $$\dot Q_i$$ when we take their time derivatives. So the connection between the two is that $$L_\mathbf Q(t) = L\big(t;~Q_1(t), \dots Q_n(t);~\dot Q_1(t), \dots \dot Q_n(t)\big).$$But there is a mental distinction to be made, when we are looking at $$L$$ by itself it does not know that any of its parameters are related by being time derivatives of each other or whatever; it is just a function $$\mathbb R^{2n+1}\to\mathbb R.$$ Any choice we make to name its parameters in suggestive ways is just us physicists abusing notation; the function does not care what its parameters are named. We physicists make the connection of all of the $$q_i$$ together, and the connection of the $$\dot q_i$$ to the $$q_i$$, and we do this only when we substitute in this real path $$\mathbf Q(t)$$ to the abstract function.

When you take a derivative of $$L_\mathbf Q$$ you are then substituting in these terms $$Q_1(t + \delta t) \approx Q_1(t) + \dot Q_1~\delta t$$ (from normal calculus) into the above expression and then this multilinear approximation simplifies those to say that $$\frac{L_\mathbf Q(t+\delta t) - L_\mathbf Q(t)}{\delta t} \approx \frac{\partial L}{\partial t} + \frac{\partial L}{\partial q_1} \dot Q_1 +\dots \frac{\partial L}{\partial q_n}\dot Q_n + \frac{\partial L}{\partial \dot q_1} \ddot Q_1 +\dots \frac{\partial L}{\partial \dot q_n}\ddot Q_n.$$

The reason that we use this notation (and that we abuse it even more by making no distinction between $$L_\mathbf Q$$ and $$L$$ and no distinction between $$Q_i$$ and $$q_i$$) is because this is easier to write. Technically the correct expression otherwise would say that $$L_\mathbf Q = s_\mathbf Q(L)$$ with $$s$$ being a sort of “substitute in the path” function, and then we would say that $$[s_\mathbf Q(L)]' = s_\mathbf Q(\partial^1L) + \sum_{k=1}^n s_\mathbf Q(\partial^{k+1}L)\cdot Q_i' + \sum_{k=1}^n s_\mathbf Q(\partial^{k+n+1}L)\cdot Q_i''.$$ So the improvement we are making is that if we only use pure numbers, $$\partial^n$$ starts to become very confusing when we have three categories of parameters that are fundamentally different (time, position, velocity) — and we don’t like to have to keep walking back and forth between the notion of “the Lagrangian function” (and its derivatives) and “the Lagrangian function evaluated on the path $$\mathbf Q(t)$$” (and its derivatives evaluated on that same path). We are erasing the action of this $$s_\mathbf Q$$ function and trusting you as a competent physicist to see that it needs to be there to make the resulting expression make sense; and we are labeling the different numeric indices to the abstract mathematical functions with symbols which identify the parts of the path that we will later substitute into the function.