How do total time derivatives of partial derivatives of functions work? Say im trying to prove $\frac{\partial \dot{T}}{\partial \dot{q}^i} - 2\frac{\partial {T}}{\partial {q^i}} = - \frac{\partial {V}}{\partial {q^i}}$ from the Lagrangian equation: $L = T - V$, and the euler-langrange equation, where $T$ is the kenetic energy and $V$ is the potential energy.
Below I have attached what I call my almost proof. I can't get past the last line.
I'm pretty sure I have done my math correct up until the last line.

My question is a conceptual one: how do total time derivatives of partial derivatives of functions work?
Taking $\frac{d}{dt}$$\frac{\partial T}{\partial \dot{q}^i}$ should give me $\frac{\partial \dot{T}}{\partial \dot{q}^i} - \frac{\partial {T}}{\partial {q^i}}$ but I'm not sure how to take the total time derivative of a partial derivative. How does this work?
 A: This will be another entry in my long-running rant series which is (barely) hyperbolically titled "There's no such thing as a total derivative."
If you have a well-behaved function of two variables $f:\mathbb R\times \mathbb R\rightarrow \mathbb R$, then you can define the derivatives with respect to its first and second slots to be
$$\partial_1 f : (x,y) \mapsto \lim_{h\rightarrow 0}\frac{f(x+h,y)-f(x,y)}{h}$$
$$\partial_2f : (x,y) \mapsto \lim_{h\rightarrow 0}\frac{f(x,y+h)-f(x,y)}{h}$$
We call these functions the partial derivatives of $f$.  In an abuse of notation, we often write them as $\frac{\partial f}{\partial x}$ and $\frac{\partial f}{\partial y}$, where we are supposed to implicitly realize that $x$ and $y$ are the quantities we intend to plug into the first and second slots, respectively.  However, this tradition can be ...  problematic.

Now consider a function $\gamma:\mathbb R\rightarrow \mathbb R\times \mathbb R$  which eats some number $t$ and spits out the pair $\big(a(t),b(t)\big)$, where $a$ and $b$ are functions from $\mathbb R$ to $\mathbb R$.  We can compose $f$ with $\gamma$ to obtain a single function from $\mathbb R$ to $\mathbb R$ as follows:
$$(f\circ \gamma) : \mathbb R\rightarrow \mathbb R$$
$$ t\mapsto f\bigg(a(t),b(t)\bigg)$$
Being a function from $\mathbb R$ to $\mathbb R$, we can take its regular, calculus 101 derivative:
$$(f\circ \gamma)'(t) = (\partial_1f)\bigg(a(t),b(t)\bigg) \cdot a'(t) + (\partial_2 f)\bigg(a(t),b(t)\bigg)\cdot b'(t)$$
which is usually written (in another abuse of notation) as
$$(f\circ \gamma)'(t) = \frac{\partial f}{\partial a} a'(t) + \frac{\partial f}{\partial b}b'(t) \equiv \frac{df}{dt}$$
It is this object which is called the "total derivative" of $f$, but that is a questionable description of it because it drops $\gamma$ completely out of the notation/phrasing.  I would accept "the total derivative of $f$ along the path $\gamma$," but the president of calculus has stopped taking my calls on this matter.

With those preliminaries out of the way, the kinetic energy $T$ is a function of two variables, so we can define $\partial_1 T$ and $\partial_2T$ without issue.  Given some function $q$, we can define $\gamma(t) = \bigg(q(t),\dot q(t)\bigg)$ and define the composite function $(T\circ \gamma)(t) = T\bigg(q(t),\dot q(t)\bigg)$.  What you call $\dot T(t)$ is really $(T\circ \gamma)'(t)$.
At this point, you would be rightly confused as to how to take a partial derivative of $\dot T$.  After all, $\dot T$ is a function from $\mathbb R$ to $\mathbb R$!  The secret comes in two parts.  First, you can specialize to $T$ which is quadratic in its second argument (the velocity); something of the form $T(x,v)=\frac{1}{2}g(x)v^2$ would do.
If you do this, you can massage the expression for $\dot T$ into the form
$$\dot T = \dot q\left[ (\ldots) \dot q^2 + (\ldots) \ddot q\right]$$
The problem with this is that there's no way to interpret $\dot T$ as a function of $q$ and $\dot q$, because there's a $\ddot q$ sitting there.  We now come to the second subtlety: if you use the Euler-Lagrange equations, you can show that when the equations of motion are satisfied, the term in square brackets above depends only on $q$.  As a result, there exists some function $\mathcal{\dot \tau}(a,b)$ such that when the equations of motion are satisfied,
$$\mathcal{\dot \tau}\bigg(q(t),\dot q(t)\bigg) = \dot T(t) = \bigg[ \text{terms depending only on }q(t),\dot q(t) \bigg]$$
$$\implies (\partial_2\mathcal{\dot \tau})\bigg(q(t),\dot q(t)\bigg) \equiv \frac{\partial \mathcal{\dot \tau}}{\partial \dot q} = \bigg[ \text{other terms depending only on }q(t),\dot q(t) \bigg]$$
and furthermore, you will find that on-shell,
$$\frac{d}{dt}\bigg[(\partial_2 T)\bigg(q(t),\dot q(t)\bigg)\bigg] = \frac{\partial \mathcal{\dot \tau}}{\partial \dot q} - (\partial_1 T)\bigg(q(t),\dot q(t)\bigg)$$
which would typically be written
$$\frac{d}{dt} \frac{\partial T}{\partial \dot q} = \frac{\partial \dot T}{\partial \dot q} - \frac{\partial T}{\partial q}$$
To recap, the notation $\frac{\partial \dot T}{\partial \dot q}$ belies quite a bit of subtlety.  The "total derivative" $\dot T \equiv \frac{d}{dt}T\big(q(t),\dot q(t)\big)$ has a $\ddot q$ in it, so it's not at all clear how to interpret it as a function of $q$ and $\dot q$, which would be necessary to find the partial derivative.
However, if you enforce the equations of motion, you can find a function $\mathcal{\dot \tau}\bigg(q(t),\dot q(t)\bigg)$ which will agree with the function $\dot T(t)$ (on-shell), and it is this object which you can differentiate with respect to its second argument ($\dot q$).  Note that despite the notation, $\dot\tau$ is not actually the time derivative of some other function $\tau$; I added the dot to suggest that you should interpret $\dot \tau$ as a function of $q$ and $\dot q$ whose value is the rate of change of the kinetic energy along a physical trajectory.

As a concrete example in more compact notation (and in 2D), consider $T = \frac{1}{2} (\dot r^2 + r^2\dot \theta^2)$ and $V=0$.  The equations of motion are
$$\ddot r = r\dot \theta^2$$
$$\ddot \theta = 0$$
Differentiating with respect to time,
$$\dot T = \dot r\ddot r + r\dot r \dot \theta^2 + r^2\dot \theta \ddot \theta$$
We now need to use the equations of motion to get rid of the second derivatives, and we find
$$\dot T = r\dot r \dot \theta^2 + r\dot r\dot \theta^2 = 2r\dot r\dot \theta^2$$
therefore, we define the function
$$\mathcal{\dot \tau}(r,\dot r,\theta,\dot \theta) = 2r\dot r \dot\theta^2$$
and note that
$$\frac{\partial \mathcal{\dot \tau}}{\partial \dot r} = 2r\dot \theta^2$$
$$\frac{\partial T}{\partial r} = r\dot \theta^2$$
$$\frac{d}{dt}\frac{\partial T}{\partial \dot r}=\underbrace{\ddot r = r\dot \theta^2}_{\text{Only on-shell!}} = \frac{\partial \mathcal{\dot \tau}}{\partial \dot r} - \frac{\partial T}{\partial r}$$
