# PlanetPhysics/Virial Theorem

We start with the moment of inertia about the origin for the system of particles, which is defined as
   $(1)I=\sum _{i}m_{i}{r_{i}}^{2}$
Differentiate using the chain rule. Note that a vector dotted into itself yields its magnitude square.
   ${\vec {r_{i}}}\cdot {\vec {r_{i}}}=r_{i}^{2}$
This lets us make the connection that
   $I=\sum _{i}m_{i}{r_{i}}^{2}=\sum _{i}m_{i}({\vec {r_{i}}}\cdot {\vec {r_{i}}})$
So after differentiating we get
   ${\frac {dI}{dt}}=\sum _{i}m_{i}{\frac {\vec {dr_{i}}}{dt}}\cdot {\vec {r_{i}}}+{\vec {r_{i}}}\cdot {\frac {\vec {dr_{i}}}{dt}}$
Differentiating again yields
   ${\frac {d^{2}I}{dt^{2}}}=\sum _{i}m_{i}{\frac {d^{2}{\vec {r_{i}}}}{dt^{2}}}\cdot {\vec {r_{i}}}+{\frac {\vec {dr_{i}}}{dt}}\cdot {\frac {\vec {dr_{i}}}{dt}}+{\frac {\vec {dr_{i}}}{dt}}\cdot {\frac {\vec {dr_{i}}}{dt}}+{\vec {r_{i}}}\cdot {\frac {d^{2}{\vec {r_{i}}}}{dt^{2}}}$
In short form
   ${\frac {d^{2}I}{dt^{2}}}=2\,\sum _{i}(m_{i}{\dot {\vec {r_{i}}}}\cdot {\dot {\vec {r_{i}}}}+m_{i}{\vec {r_{i}}}\cdot {\ddot {\vec {r_{i}}}})$
When dealing with a system of particles we found that the kinetic energy associated with a system of particles was
   $T={\frac {1}{2}}\sum _{i}m_{i}{\dot {\vec {r_{i}}}}\cdot {\dot {\vec {r_{i}}}}$
Plugging in T into (6) gives us
   ${\frac {d^{2}I}{dt^{2}}}=4T+2\,\sum _{i}m_{i}{\vec {r_{i}}}\cdot {\ddot {\vec {r_{i}}}}$
Next we need to tackle the $2\,\sum _{i}m_{i}{\vec {r_{i}}}\cdot {\ddot {\vec {r_{i}}}}$ term. We first bring in the potential energy through its connection with force. This part is named the Virial of Claussius.
   ${\vec {f_{i}}}=m_{i}{\ddot {\vec {r_{i}}}}=\nabla _{i}U$
This gives us the equality
   $2\,\sum _{i}m_{i}{\vec {r_{i}}}\cdot {\ddot {\vec {r_{i}}}}=\sum _{i}{\vec {r_{i}}}\cdot \nabla _{i}U$
Now due to Newton's 3rd law that states for every action there is an opposite and equal reaction we have the forces on the ith particle in our system given by
   ${\vec {f_{i}}}=\sum _{j}{\vec {F_{i}j}}$
where $i\neq j$.
So when we go to sum up all the forces we notice 'force pairing' such that
   $\sum _{i}{\vec {f_{i}}}=\sum _{i}\sum _{j>i}{\vec {F_{ij}}}+{\vec {F_{ji}}}$
Plugging this into the virial of Claussius yields
   $\sum _{i}{\vec {f_{i}}}\cdot {\vec {r_{i}}}=\sum _{i}\sum _{j>i}({\vec {F_{ij}}}\cdot {\vec {r_{i}}}+{\vec {F_{ji}}}\cdot {\vec {r_{j}}})$
Now we need to take the gradient of the potential energy to get the force. This is a tedious calculation which can be found here (insert link)
   ${\vec {F_{ij}}}=-\nabla _{i}{\frac {Gm_{i}m_{j}}{r_{ij}}}=-{\frac {Gm_{i}m_{j}({\vec {r_{i}}}-{\vec {r_{j}}})}{r_{ij}^{3}}}$
Inserting this into (13) gives
   $\sum _{i}{\vec {f_{i}}}\cdot {\vec {r_{i}}}=\sum _{i}\sum _{j>i}(-{\frac {Gm_{i}m_{j}({\vec {r_{i}}}-{\vec {r_{j}}})\cdot {\vec {r_{i}}}}{r_{ij}^{3}}}-{\frac {Gm_{i}m_{j}({\vec {r_{j}}}-{\vec {r_{i}}})\cdot {\vec {r_{j}}}}{r_{ij}^{3}}}$
The two keys in understanding the above equation is to note that
   $r_{ij}=\vert {\vec {r_{i}}}-{\vec {r_{j}}}\vert$
and that
   $\vert {\vec {r_{i}}}-{\vec {r_{j}}}\vert ^{2}=({\vec {r_{i}}}-{\vec {r_{j}}})\cdot ({\vec {r_{i}}}-{\vec {r_{j}}})$
So now we add the numerators of (15) to get
   $({\vec {r_{i}}}-{\vec {r_{j}}})\cdot {\vec {r_{i}}}-({\vec {r_{j}}}-{\vec {r_{i}}})\cdot {\vec {r_{j}}}=({\vec {r_{i}}}\cdot {\vec {r_{i}}}-{\vec {r_{i}}}\cdot {\vec {r_{j}}}+{\vec {r_{j}}}\cdot {\vec {r_{j}}}-{\vec {r_{i}}}\cdot {\vec {r_{j}}})$
Next we expand (17) to see that it is equal to (18) and this cancels a power of 2 in the denominator of (15) to finally yeild the expression for potential energy
   $\sum _{i}\sum _{j>i}-{\frac {Gm_{i}m_{j}}{r_{ij}}}=-U$
So going back to (8) we see
   ${\frac {d^{2}I}{dt^{2}}}=4T-2U$
From the energy equation of the system, E = T - U and the key to finish up the virial theorem is to note that the momemt of inertia does not change on average with time ("After one dynamical timescale, the time derivative of I is constant so the second derivative is zero
   ${\frac {d^{2}I}{dt^{2}}}=0$
This leads to
   $T={\frac {1}{2}}U$
plugging this into the energy equation gives us the result of the virial theorem which states that the total energy of a stationary system (no significant dynamical evolution) is one-half the potential energy of the system.
   $E={\frac {1}{2}}U-U=-{\frac {1}{2}}U$