# $\frac{\partial \dot{\vec r}(\vec q(t))}{\partial q_j}=\frac{d}{dt}\frac{\partial \vec r}{\partial q_j}$, why can the derivative-orden be changed?

$$\vec r (\vec q(t) )$$ describes the trajectory of a particle, $$\vec q =(q_1,...,q_n)^T$$ is the vector of the generalized coordinates $$q_1,...,q_n$$. Now my question:

Why can one change the order of derivatives $$\frac{\partial \dot{\vec r}(\vec q(t))}{\partial q_j}=\frac{d}{dt}\frac{\partial \vec r}{\partial q_j}$$ ? with $$j\in\{1,...,n\}$$

My notes:

$$\frac{\partial \dot{\vec r}(\vec q(t))}{\partial q_j}=\frac{\partial }{\partial q_j}\frac{d}{dt} \vec {r}(\vec q(t))$$

The claim is not true without further structure to your generalized coordinates or trajectory.

Before I begin, a point of notation. Partial derivatives act on functions; one should read your LHS as $$\left(\frac{\partial}{\partial q_j}\frac{\partial}{\partial t}\vec{r}\right)(\vec{q}(t))$$ Total derivatives, however, act on expressions; the right-hand side is $$\frac{d}{dt}\left(\frac{\partial\vec{r}}{\partial q_j}(\vec{q}(t))\right)$$ Of course, you didn't do anything wrong in omitting these parentheses; I just want to make sure nobody's confused.

Now, expand the total derivative using the chain rule: the variation caused by $$t$$ is the direct/explicit variation in $$\vec{r}$$, as well as the induced variation caused by change of generalized coordinates: $$\frac{d}{dt}\left(\frac{\partial\vec{r}}{\partial q_j}(\vec{q}(t))\right)=\left(\frac{\partial}{\partial t}\frac{\partial\vec{r}}{\partial q_j}\right)(\vec{q}(t))+\sum_k{\left(\frac{\partial}{\partial q_k}\frac{\partial\vec{r}}{\partial q_j}\right)(\vec{q}(t))}\frac{\partial q_k}{\partial t}(t)$$

The first term appearing on my RHS is your LHS. Thus the two terms can only be equal if the sum vanishes.

The term $$\vec{q}(t)$$ clearly varies in $$t$$, so $$\frac{\partial q_k}{\partial t}$$ is not (in general) $$0$$. The claim would be true if $$\vec{r}$$ depends only linearly on $$\vec{q}$$ (because then the second derivatives vanish) or $$r$$ is constant along an orbit (in the sense of "time-evolution of generalized coordinates"), because that's the physical meaning of "the sum vanishes".