The virial theorem is a description of the dynamical state of multi-body systems (for example stars in elliptical galaxies, or galaxies in clusters). The theorem consists of a tensor theorem and a simpler, scalar theorem.

The tensor virial theorem can be derived from the collisionless Boltzmann equation - a description of point masses interacting with and contributing to a gravitational field. It relates the changing moment of inertia tensor of a system to the potential and kinetic energy tensors:

1/2 d2/dt2 (Ijk) = 2Tjk + Pjk + Wjk = 2Kjk + Wjk

The term on the left is the second time derivative of the inertia tensor, which measures how the shape of the system is changing over time. 2T + P are the ordered and chaotic motion components of the kinetic energy tensor Kjk (actually, twice K), and Wjk is the potential energy tensor, the shape of the gravitational field.

When we say a system is virialized, the moment of inertia does not change with time, which makes the derivative on the left-hand side equal to zero. We're then left with the equation

0 = 2Tjk + Pjk + Wjk = 2Kjk + Wjk

The scalar virial theorem is simply the trace of the kinetic and potential energy tensors, yielding

2K + W = 0

where K and W are now just the scalar kinetic and potential energies of the system. The scalar part of the theorem was derived first, in 1870 by Rudolf Clausius, the Prussian mathematician and physicist.

The scalar virial theorem pops up in discussions of the astronomical objects mentioned above. For example, it's a nice way to determine the mass (and mass to light ratio) of a system, based just on the observed velocities of the objects within the system. If we assume the kinetic energy of a system goes as the square of the velocity dispersion, σ, we wind up with the relation

σ2 = GM/R

where G is the gravitational constant, M is the mass of the system, and R is essentially radius of the system (specifically it is the gravitational radius). If you can measure σ (perhaps by measuring the Doppler broadening of prominent stellar absorption lines), and can estimate the gravitational radius (not too hard), you can determine the mass. Along those lines, the virial theorem also leads to another important result in extragalactic astronomy, namely the existence of the fundamental plane of elliptical galaxies, and the related Faber-Jackson and Dn-sigma relations, which allow us to derive the luminosity of an elliptical galaxy, and hence, its distance.

Sources: Galactic Dynamics by J. Binney and S. Tremaine, Princeton University Press, 3rd ed (1994), and Faber, Dressler, Davies, Burstein, and Lynden-Bell in Nearly Normal Galaxies, Springer-Verlag (1987).