When do total and partial derivatives commute? In Classical Mechanics, the Lagrangian is a function of a generalized coordinate $q$, the corresponding generalized velocity $\dot{q}$, and time $t$.
For the Lagrangian, $$\dfrac{d}{dt}\frac{\partial L}{\partial \dot{q}} \neq \frac{\partial \dot{L}}{\partial \dot{q}},$$ that is, the two derivatives do not commute. However, what if $L$ were a function only of $q$ and $t$? Then would the total derivative in $t$ and the partial derivative in $q$ always commute?
Also, for $L(q, t)$,  is $\frac{\partial \dot{L}}{\partial \dot{q}}$ always equal to $\frac{\partial L}{\partial q}$?
 A: Take into account that, for a function $f$ of $q,\dot{q},t,$ the total derivative is given by
$$
\frac{d}{dt}=\sum_{h=1}^n\left(\dot{q}_h\frac{\partial}{\partial{q_h}}+\ddot{q}_h\frac{\partial}{\partial{\dot{q}_h}}\right)+\frac{\partial}{\partial{t}}
$$
If $f$ only depends on $q,t$ then
\begin{align}
\require{cancel}
\frac{\partial}{\partial{q_k}}\frac{df}{dt}
  &=\frac{\partial}{\partial{q_k}}\left[\sum_{h=1}^n\left(\dot{q}_h\frac{\partial{f}}{\partial{q_h}}+\cancel{\ddot{q}_h\frac{\partial{f}}{\partial{\dot{q}_h}}}\right)+\frac{\partial{f}}{\partial{t}}\right]=\\
  &=\sum_{h=1}^n\left(\dot{q}_h\frac{\partial}{\partial{q_h}}\frac{\partial{f}}{\partial{q_k}}+\right)+\frac{\partial}{\partial{t}}\frac{\partial{f}}{\partial{q_k}}=\frac{d}{dt}\frac{\partial{f}}{\partial{q_k}}
\end{align}
Note that the two derivatives commute also if $f$ depends on $\dot{q}.$
Also, for $\partial\dot{L}/\partial\dot{q}$ and $\partial{L}/\partial{q}$ when $L$ does not depend on $\dot{q},$ while the former is zero, the latter in general is not.
