Relating generalized momentum, generalized velocity, and kinetic energy: $2T~=~\sum_i p_{i}\dot{q}^{i}$ According to equation (6) on the first page of some lecture notes online, the above equation is used to prove the virial theorem. For rectangular coordinates, the relation
$$
2T~=~\sum_i p_{i}\dot{q}^{i}
$$
is obvious. How would I show it holds for  generalized coordinates $q^{i}$?
 A: Ok so the answer is more straightforward and tedious than I expected.
In rectangular coordinates, the kinetic energy $T$ of $n$ particles is:
$$
T=\frac{1}{2}\sum_{\alpha=1}^{n}\sum_{i=1}^{3}m_{\alpha}\dot{x}_{\alpha,i}^{2}
$$
where $x_{\alpha,i}$ is a function of generalized coordinates:
$$
\begin{eqnarray}
x_{\alpha,i} &=& x_{\alpha,i}(q_{j},t),\hspace{12pt}j=1,2,...,s\\
\dot{x}_{\alpha,i} &=& \sum_{j=1}^{s}\frac{\partial x_{\alpha,i}}{\partial q_{j}}\dot{q}_{j}+\frac{\partial x_{\alpha,i}}{\partial t}
\end{eqnarray}
$$
So $\dot{x}_{\alpha,i}^{2}$ becomes
$$
\dot{x}_{\alpha,i}^{2}=\sum_{j,k}\frac{\partial x_{\alpha,i}}{\partial q_{j}}\frac{\partial x_{\alpha,i}}{\partial q_{k}}\dot{q}_{j}\dot{q}_{k}
+ 2\sum_{j}\frac{\partial x_{\alpha,i}}{\partial q_{j}}\frac{\partial x_{\alpha,i}}{\partial t}\dot{q}_{j}
+ \left(\frac{\partial x_{\alpha,i}}{\partial t}\right)^{2}
$$
The total kinetic energy is:
$$
T=\sum_{\alpha}\sum_{i,j,k}\frac{1}{2}m_{\alpha}\frac{\partial x_{\alpha,i}}{\partial q_{j}}\frac{\partial x_{\alpha,i}}{\partial q_{k}}\dot{q}_{j}\dot{q}_{k}
+ \sum_{\alpha}\sum_{i,j}m_{\alpha}\frac{\partial x_{\alpha,i}}{\partial q_{j}}\frac{\partial x_{\alpha,i}}{\partial t}\dot{q}_{j}
+ \sum_{\alpha}\sum_{i}\frac{1}{2}m_{\alpha}\left(\frac{\partial x_{\alpha,i}}{\partial t}\right)^{2}
$$
If $x_{\alpha, i}$ has no explicit time dependence (as is the case if the system is scleronomic), then $\frac{\partial x_{\alpha ,i}}{\partial t}=0$, so the total kinetic energy becomes:
$$
\begin{eqnarray}
T &=& \sum_{\alpha}\sum_{i,j,k}\frac{1}{2}m_{\alpha}\frac{\partial x_{\alpha,i}}{\partial q_{j}}\frac{\partial x_{\alpha,i}}{\partial q_{k}}\dot{q}_{j}\dot{q}_{k}\\
&=& \sum_{j,k}\left(\sum_{\alpha}^{n}\sum_{i}^{3}\frac{1}{2}m_{\alpha}\frac{\partial x_{\alpha,i}}{\partial q_{j}}\frac{\partial x_{\alpha,i}}{\partial q_{k}}\right)\dot{q}_{j}\dot{q}_{k}\\
T &=& \sum_{j,k}a_{jk}\dot{q}_{j}\dot{q}_{k} \hspace{12pt} \square
\end{eqnarray}
$$
Taking the partial derivative of $T$ with respect to $\dot{q}_{l}$ gives us: 
$$
\begin{eqnarray}
\frac{\partial T}{\partial \dot{q}_{l}} &=& \sum_{k}a_{lk}\dot{q}_{k} + \sum_{j}a_{jl}\dot{q}_{j}\\
\dot{q}_l\frac{\partial T}{\partial \dot{q}_{l}} &=& \sum_{k}a_{lk}\dot{q}_{k}\dot{q}_{l} + \sum_{j}a_{jl}\dot{q}_{j}\dot{q}_{l}\\
\end{eqnarray}
$$
Summing over all $l$ gives us:
$$
\sum_{l}\dot{q}_l\frac{\partial T}{\partial \dot{q}_{l}} = \sum_{k,l}a_{lk}\dot{q}_{k}\dot{q}_{l} + \sum_{j,l}a_{jl}\dot{q}_{j}\dot{q}_{l}
$$
All indices are dummy indices so:
$$
\sum_{l}\dot{q}_l\frac{\partial T}{\partial \dot{q}_{l}} = 2\sum_{j,k}a_{jk}\dot{q}_{j}\dot{q}_{k} = 2T  \hspace{12pt} \square
$$
If the potential doesn't depend on the generalized velocities, then:
$$
\begin{eqnarray}
\sum_{l}\dot{q}_l p_{l} = \sum_{l}\dot{q}_l\frac{\partial L}{\partial \dot{q}_{l}}
&=& \sum_{l}\dot{q}_l\frac{\partial (T-U)}{\partial \dot{q}_{l}}\\
&=& \sum_{l}\dot{q}_l\frac{\partial T}{\partial \dot{q}_{l}}\\
\sum_{l}\dot{q}_l p_{l} &=& 2T \hspace{12pt} \blacksquare 
\end{eqnarray}
$$
So I guess the equation I originally asked does hold in general, given the two assumptions:


*

*No explicit time dependence in the coordinate transformation

*No explicit velocity dependence in the potential term of the Lagrangian

A: Your answer looks complicated and I feel it misses the point. The fact that $2T=\sum_l p_l \dot{q}_l$ is fundamentally due to Euler's homogeneous function theorem. This states that
$$
\text{if }f(\alpha \mathbf{x})=\alpha^k f( \mathbf{x})\text{, then } \mathbf{x}\cdot\nabla f(\mathbf{x})=kf(\mathbf{x}).
$$
When stated like that, I would even hesitate to add a proof - simply differentiate with respect to $\alpha$ and set it to $1$.
The theorem holds for Lagrangians that depend quadratically and homogeneously in the velocities. This means specifically that $L(q_l,\dot q_l)=T(\dot q_l;q_l)-V(q_l)$, and $T(\alpha \dot q_l;q_l)=\alpha^2 T(\dot q_l;q_l)$. (I use the notation $T(\dot q_l;q_l)$ to emphasize that the $q_l$ dependence is as parameters, with $T$ being fundamentally a homogeneous quadratic function of the $\dot q_l$.) The homogeneous function theorem then states that 
$$2T(\dot q_l;q_l)=\sum_l\dot q_l \frac{\partial T}{\partial \dot q_l}.$$
Since $V$ is independent of the $\dot q_l$, each partial derivative equals the corresponding momentum $p_l=\frac{\partial L}{\partial \dot q_l}$.
Note in particular that your first assumption (that the functional dependence of $T$ on the $\dot q_l$ be time-independent) is not necessary.
A: The equation $2T=\sum_{i=1}^n p_i\dot{q}^i$ holds both in Lagrangian and Hamiltonian formalism for large classes of systems.


*

*In Lagrangian formalism, it holds for Lagrangians of the form $L(q,\dot{q},t)=T(q,\dot{q},t)-V(q,t)$, where the kinetic energy is of the form $T=\frac{1}{2}\sum_{i,j=1}^n \dot{q}^i m_{ij}(q,t)\dot{q}^j$. Now use the Lagrangian definition of momentum $p_i = \frac{\partial L}{\partial \dot{q}^i}$.

*In Hamiltonian formalism, it holds for Hamiltonians of the form $H(q,p,t)=T(q,p,t)+V(q,t)$, where the kinetic energy is of the form $T=\frac{1}{2}\sum_{i,j=1}^n p_i m^{ij}(q,t)p_j$. Now use Hamilton's equations $\dot{q}^i = \frac{\partial H}{\partial p_i}$.
In both cases, we are secretly using the Euler homogeneous vector field $\sum_{i=1}^n\dot{q}^i\frac{\partial}{\partial \dot{q}^i}$, which counts the number of $\dot{q}$s, as Emilio Pisanty also points out in his answer.
