Simple Chain Rule for Partials This seems like a simple chain-rule question, but I'm getting stumped. I've searched and searched, but apologies if this question was covered somewhere else.
$\frac{d}{dt}\left(\frac{\partial}{\partial \dot{x}}f\left(x(t),\dot{x}(t)\right)\right)$
With some handwaving and "brute intuition," I'm pretty sure the result is
$\frac{\partial}{\partial\dot{x}} \dot{f} - \frac{\partial}{\partial x} f$,
(where obviously the dot indicates the time derivative of the function), but I cannot get there rigorously. I can provide more context if needed, but I believe these are the essentials. I think it's safe to assume the derivatives commute.
Thanks in advance!
 A: By the chain rule, you have 
$$
\frac{d}{dt}\left(\frac{\partial}{\partial \dot{x}}f\left(x(t),\dot{x}(t)\right)\right)=\dot x\left(\frac{\partial}{\partial x}\frac{\partial}{\partial \dot{x}}f(x(t),\dot x(t))\right)+\ddot x\left(\frac{\partial}{\partial \dot x}\frac{\partial}{\partial \dot{x}}f(x(t),\dot x(t))\right)
$$
and
$$
\frac{\partial}{\partial\dot{x}} \dot{f} - \frac{\partial}{\partial x} f=
\frac{\partial}{\partial\dot{x}} \frac{d}{dt}f\left(x(t),\dot{x}(t)\right) - \frac{\partial}{\partial x} f\left(x(t),\dot{x}(t)\right)=\\
\frac{\partial}{\partial\dot{x}}\left(\ddot x\frac{\partial}{\partial \dot{x}}f\left(x(t),\dot{x}(t)\right)+\dot x\frac{\partial}{\partial x}f\left(x(t),\dot{x}(t)\right)\right)-\frac{\partial}{\partial x} f\left(x(t),\dot{x}(t)\right)=\\
\dot x\left(\frac{\partial}{\partial \dot x}\frac{\partial}{\partial x}f(x(t),\dot x(t))\right)+\ddot x\left(\frac{\partial}{\partial \dot x}\frac{\partial}{\partial \dot{x}}f(x(t),\dot x(t))\right)
$$
The only difference is the order of the partial derivations in $\dot x$ and $x$, that can be changed only for $C^2$ functions
A: It is the standard chain rule . In details $$
\frac{d}{dt}(\frac{\partial}{\partial\dot x} f )
= 
\frac{\partial^2f}{\partial\dot x\partial x } \dot x + \frac{\partial^2f}{\partial\dot x^2} \ddot x.
$$
Your intuition :
$$
\frac{\partial}{\partial\dot x}\dot f - \frac{\partial}{\partial x} f
=
\frac{\partial}{\partial\dot x}[\frac{\partial f}{\partial\dot x}\ddot x+ \frac{\partial f}{\partial x} \dot x]-\frac{\partial}{\partial x} f.
$$
Both expressions are identical due to $\frac{\partial\ddot x}{\partial \dot x} =0$.
