Kinetic energy of a mass rotating about two axes I'm working on a question where I have to find an equation for the kinetic energy of a mass being rotated by a fold-able arm. The equation for $m_1$ is obvious, however, the equation I derived for $m_2$ is not entirely consistent with the solutions.

To derive the equation I figured that I could use the resultant instantaneous velocity acting on $m_2$ to find its kinetic energy. If I say $v_1$ to be the instantaneous velocity due to $\dot \theta_1$ and $v_2$ to be the instantaneous velocity due to $\dot \theta_2$ then the resultant instantaneous velocity can be found using the cosine rule:
$V_{r}^2 = V_1^2+V_2^2-2V_1V_2 \cos(\theta_d)$
$V_r$ is the resultant velocity, $\theta_d$ is the angle difference between the two velocity vectors and can be substituted with $\theta_1 - \theta_2$.
And hence the kinetic energy for $m_2$ can be said to be:
$K_2 = \frac{m_2}{2}\left(l_1^2\dot\theta_1^2+l_2^2\dot\theta_2^2-2l_1\dot\theta_1l_2\dot\theta_2 \cos(\theta_1-\theta_2)\right)$
However, the solution suggests a slightly different answer:
$K_2 = \frac{m_2}{2}\left(l_1^2\dot\theta_1^2+l_2^2\dot\theta_2^2+2l_1\dot\theta_1l_2\dot\theta_2 \cos(\theta_1-\theta_2)\right)$
I can't think of any reason why the sign on the last term should be positive, would appreciate any help.
 A: Let  $\vec{e}_x$ be the left-right oriented horizontal unit vector and $\vec{e}_y$ the vertical one, bottom-top oriented.   Take the origin $O$ as the fixed point of $l_1$ and let $P$ be the position of $m_2$. This way
$$\vec{OP}= (l_1 \sin \theta_1 + l_2 \sin \theta_2) \vec{e}_x - (l_1 \cos \theta_1 +l_2 \cos \theta_2) \vec{e}_y\:.$$
Therefore, the velocity of $P$ is
$$\vec{v}_2 =\frac{d\vec{PO}}{dt}= (l_1 \dot{\theta}_1\cos \theta_1 + l_2\dot{\theta}_2\cos \theta_2) \vec{e}_x + (l_1 \dot{\theta}_1\sin \theta_1 +l_2 \dot{\theta}_2\sin  \theta_2) \vec{e}_y\:.$$
Consequently, as $\vec{e}_x \perp \vec{e}_y$ and $\vec{e}_i\cdot \vec{e}_i=1$ for $i=x,y$, we have
$$\vec{v}^2_2 = (l_1 \dot{\theta}_1\cos \theta_1 + l_2\dot{\theta}_2\cos \theta_2)^2+ (l_1 \dot{\theta}_1\sin \theta_1 +l_2 \dot{\theta}_2\sin  \theta_2)^2 $$
$$= l^2_1 \dot{\theta}^2_1+ l^2_2 \dot{\theta}^2_2 + 2l_1l_2 \dot{\theta}_1\dot{\theta}_2 (\cos \theta_1 \cos \theta_2 + \sin \theta_1\sin \theta_2)$$
$$= l^2_1 \dot{\theta}^2_1+ l^2_2 \dot{\theta}^2_2 + 2l_1l_2 \dot{\theta}_1\dot{\theta}_2 \cos(\theta_1-\theta_2)\:.$$
Hence
$$K_2 = \frac{m_2}{2}\left[l^2_1 \dot{\theta}^2_1+ l^2_2 \dot{\theta}^2_2 + 2l_1l_2 \dot{\theta}_1\dot{\theta}_2 \cos(\theta_1-\theta_2)\right]\:.$$
A: All you have to do is track the centers of mass, and use total derivatives.
$$ \vec{r}_1 = ( \ell_1 \sin (\theta_1), -\ell_1 \cos(\theta_1), 0) $$
$$ \vec{r}_2 - \vec{r}_1 = ( \ell_2 \sin (\theta_2), -\ell_2 \cos(\theta_2), 0) $$
$$ \vec{v}_1 = \frac{{\rm d}\vec{r}_1}{{\rm d}t}  = \frac{{\rm d}\vec{r}_1}{{\rm d}\theta_1} \dot\theta_1  = ( \ell_1 \dot\theta_1 \cos(\theta_1), \ell_1 \dot\theta_1 \sin( \theta_1),0)$$
$$ \vec{v}_2 = \frac{{\rm d}\vec{r}_2}{{\rm d}t} = \vec{v}_1 + \frac{{\rm d}(\vec{r}_2-\vec{r}_1)}{{\rm d}\theta_2} \dot\theta_2 = \vec{v}_1 + ( \ell_2 \dot\theta_2 \cos(\theta_2), \ell_2 \dot\theta_2 \sin( \theta_2),0) $$
Not the kinetic energy of $m_2$ is 
$$ KE_2 = \frac{1}{2} m_2 |\vec{v}_2|^2 $$
$$ KE_2 = \frac{1}{2} m_2 \left( \ell_1^2 \dot{\theta}_1^2 + \ell_2^2 \dot{\theta}_2^2\right) + m_2 \ell_1 \ell_2 \dot{\theta_1}\dot{\theta_2} \cos(\theta_2-\theta_1)  $$
$$ KE_2 = \frac{1}{2} m_2 \left( \ell_1^2 \dot{\theta}_1^2 + \ell_2^2 \dot{\theta}_2^2 + 2 \ell_1 \ell_2 \dot{\theta_1}\dot{\theta_2} \cos(\theta_2-\theta_1) \right)  $$
Which is the well known answer to this problem
