# Virial theorem

In mechanics, the virial theorem provides a general equation that relates the average over time of the total kinetic energy of a stable system of discrete particles, bound by a conservative force (where the work done is independent of path), with that of the total potential energy of the system. Mathematically, the theorem states that $\langle T\rangle =-{\frac {1}{2}}\,\sum _{k=1}^{N}\langle \mathbf {F} _{k}\cdot \mathbf {r} _{k}\rangle ,$ where T is the total kinetic energy of the N particles, F$_k$ represents the force on the kth particle, which is located at position r$_k$, and angle brackets represent the average over time of the enclosed quantity. The word virial for the right-hand side of the equation derives from vis, the Latin word for "force" or "energy", and was given its technical definition by Rudolf Clausius in 1870.
The significance of the virial theorem is that it allows the average total kinetic energy to be calculated even for very complicated systems that defy an exact solution, such as those considered in statistical mechanics; this average total kinetic energy is related to the temperature of the system by the equipartition theorem. However, the virial theorem does not depend on the notion of temperature and holds even for systems that are not in thermal equilibrium. The virial theorem has been generalized in various ways, most notably to a tensor form.
If the force between any two particles of the system results from a potential energy V(r) = αr$^n$ that is proportional to some power n of the interparticle distance r, the virial theorem takes the simple form $2\langle T\rangle =n\langle V_{\text{TOT}}\rangle .$
Thus, twice the average total kinetic energy ⟨T⟩ equals n times the average total potential energy ⟨V$_{TOT}$⟩. Whereas V(r) represents the potential energy between two particles of distance r, V$_{TOT}$ represents the total potential energy of the system, i.e., the sum of the potential energy V(r) over all pairs of particles in the system. A common example of such a system is a star held together by its own gravity, where n = −1.

## History

In 1870, Rudolf Clausius delivered the lecture "On a Mechanical Theorem Applicable to Heat" to the Association for Natural and Medical Sciences of the Lower Rhine, following a 20-year study of thermodynamics. The lecture stated that the mean vis viva of the system is equal to its virial, or that the average kinetic energy is one half of the average potential energy. The virial theorem can be obtained directly from Lagrange's identity as applied in classical gravitational dynamics, the original form of which was included in Lagrange's "Essay on the Problem of Three Bodies" published in 1772. Carl Jacobi's generalization of the identity to N bodies and to the present form of Laplace's identity closely resembles the classical virial theorem. However, the interpretations leading to the development of the equations were very different, since at the time of development, statistical dynamics had not yet unified the separate studies of thermodynamics and classical dynamics. The theorem was later utilized, popularized, generalized and further developed by James Clerk Maxwell, Lord Rayleigh, Henri Poincaré, Subrahmanyan Chandrasekhar, Enrico Fermi, Paul Ledoux, Richard Bader and Eugene Parker. Fritz Zwicky was the first to use the virial theorem to deduce the existence of unseen matter, which is now called dark matter. Richard Bader showed that the charge distribution of a total system can be partitioned into its kinetic and potential energies that obey the virial theorem. As another example of its many applications, the virial theorem has been used to derive the Chandrasekhar limit for the stability of white dwarf stars.

## Illustrative special case

Consider N = 2 particles with equal mass m, acted upon by mutually attractive forces. Suppose the particles are at diametrically opposite points of a circular orbit with radius r. The velocities are v$_1$(t) and v$_2$(t) = −v$_1$(t), which are normal to forces F$_1$(t) and F$_2$(t) = −F$_1$(t). The respective magnitudes are fixed at v and F. The average kinetic energy of the system in an interval of time from t$_1$ to t$_2$ is $\langle T\rangle ={\frac {1}{t_{2}-t_{1}}}\int _{t_{1}}^{t_{2}}\sum _{k=1}^{N}{\frac {1}{2}}m_{k}|\mathbf {v} _{k}(t)|^{2}\,dt={\frac {1}{t_{2}-t_{1}}}\int _{t_{1}}^{t_{2}}\left({\frac {1}{2}}m|\mathbf {v} _{1}(t)|^{2}+{\frac {1}{2}}m|\mathbf {v} _{2}(t)|^{2}\right)\,dt=mv^{2}.$ Taking center of mass as the origin, the particles have positions r$_1$(t) and r$_2$(t) = −r$_1$(t) with fixed magnitude r. The attractive forces act in opposite directions as positions, so F$_1$(t) ⋅ r$_1$(t) = F$_2$(t) ⋅ r$_2$(t) = −Fr. Applying the centripetal force formula F = mv$^2$/r results in $-{\frac {1}{2}}\sum _{k=1}^{N}\langle \mathbf {F} _{k}\cdot \mathbf {r} _{k}\rangle =-{\frac {1}{2}}(-Fr-Fr)=Fr={\frac {mv^{2}}{r}}\cdot r=mv^{2}=\langle T\rangle ,$ as required. Note: If the origin is displaced, then we'd obtain the same result. This is because the dot product of the displacement with equal and opposite forces F$_1$(t), F$_2$(t) results in net cancellation.

## Statement and derivation

Although the virial theorem depends on averaging the total kinetic and potential energies, the presentation here postpones the averaging to the last step.
For a collection of N point particles, the scalar moment of inertia I about the origin is $I=\sum _{k=1}^{N}m_{k}|\mathbf {r} _{k}|^{2}=\sum _{k=1}^{N}m_{k}r_{k}^{2},$ where m$_k$ and r$_k$ represent the mass and position of the kth particle. r$_k$ = |r$_k$| is the position vector magnitude. Consider the scalar $G=\sum _{k=1}^{N}\mathbf {p} _{k}\cdot \mathbf {r} _{k},$ where p$_k$ is the momentum vector of the kth particle. Assuming that the masses are constant, G is one-half the time derivative of this moment of inertia: ${\begin{aligned}{\frac {1}{2}}{\frac {dI}{dt}}&={\frac {1}{2}}{\frac {d}{dt}}\sum _{k=1}^{N}m_{k}\mathbf {r} _{k}\cdot \mathbf {r} _{k}\\&=\sum _{k=1}^{N}m_{k}\,{\frac {d\mathbf {r} _{k}}{dt}}\cdot \mathbf {r} _{k}\\&=\sum _{k=1}^{N}\mathbf {p} _{k}\cdot \mathbf {r} _{k}=G.\end{aligned}}$ In turn, the time derivative of G is ${\begin{aligned}{\frac {dG}{dt}}&=\sum _{k=1}^{N}\mathbf {p} _{k}\cdot {\frac {d\mathbf {r} _{k}}{dt}}+\sum _{k=1}^{N}{\frac {d\mathbf {p} _{k}}{dt}}\cdot \mathbf {r} _{k}\\&=\sum _{k=1}^{N}m_{k}{\frac {d\mathbf {r} _{k}}{dt}}\cdot {\frac {d\mathbf {r} _{k}}{dt}}+\sum _{k=1}^{N}\mathbf {F} _{k}\cdot \mathbf {r} _{k}\\&=2T+\sum _{k=1}^{N}\mathbf {F} _{k}\cdot \mathbf {r} _{k},\end{aligned}}$ where m$_k$ is the mass of the kth particle, F$_k$ = ⁠dp$_k$/dt⁠ is the net force on that particle, and T is the total kinetic energy of the system according to the v$_k$ = ⁠dr$_k$/dt⁠ velocity of each particle, $T={\frac {1}{2}}\sum _{k=1}^{N}m_{k}v_{k}^{2}={\frac {1}{2}}\sum _{k=1}^{N}m_{k}{\frac {d\mathbf {r} _{k}}{dt}}\cdot {\frac {d\mathbf {r} _{k}}{dt}}.$

### Connection with the potential energy between particles

The total force F$_k$ on particle k is the sum of all the forces from the other particles j in the system: $\mathbf {F} _{k}=\sum _{j=1}^{N}\mathbf {F} _{jk},$ where F$_{jk}$ is the force applied by particle j on particle k. Hence, the virial can be written as $-{\frac {1}{2}}\,\sum _{k=1}^{N}\mathbf {F} _{k}\cdot \mathbf {r} _{k}=-{\frac {1}{2}}\,\sum _{k=1}^{N}\sum _{j=1}^{N}\mathbf {F} _{jk}\cdot \mathbf {r} _{k}.$
Since no particle acts on itself (i.e., F$_{jj}$ = 0 for 1 ≤ j ≤ N), we split the sum in terms below and above this diagonal and add them together in pairs: ${\begin{aligned}\sum _{k=1}^{N}\mathbf {F} _{k}\cdot \mathbf {r} _{k}&=\sum _{k=1}^{N}\sum _{j=1}^{N}\mathbf {F} _{jk}\cdot \mathbf {r} _{k}=\sum _{k=2}^{N}\sum _{j=1}^{k-1}\mathbf {F} _{jk}\cdot \mathbf {r} _{k}+\sum _{k=1}^{N-1}\sum _{j=k+1}^{N}\mathbf {F} _{jk}\cdot \mathbf {r} _{k}\\&=\sum _{k=2}^{N}\sum _{j=1}^{k-1}\mathbf {F} _{jk}\cdot \mathbf {r} _{k}+\sum _{j=2}^{N}\sum _{k=1}^{j-1}\mathbf {F} _{jk}\cdot \mathbf {r} _{k}=\sum _{k=2}^{N}\sum _{j=1}^{k-1}(\mathbf {F} _{jk}\cdot \mathbf {r} _{k}+\mathbf {F} _{kj}\cdot \mathbf {r} _{j})\\&=\sum _{k=2}^{N}\sum _{j=1}^{k-1}(\mathbf {F} _{jk}\cdot \mathbf {r} _{k}-\mathbf {F} _{jk}\cdot \mathbf {r} _{j})=\sum _{k=2}^{N}\sum _{j=1}^{k-1}\mathbf {F} _{jk}\cdot (\mathbf {r} _{k}-\mathbf {r} _{j}),\end{aligned}}$ where we have used Newton's third law of motion, i.e., F$_{jk}$ = −F$_{kj}$ (equal and opposite reaction).
It often happens that the forces can be derived from a potential energy V$_{jk}$ that is a function only of the distance r$_{jk}$ between the point particles j and k. Since the force is the negative gradient of the potential energy, we have in this case $\mathbf {F} _{jk}=-\nabla _{\mathbf {r} _{k}}V_{jk}=-{\frac {dV_{jk}}{dr_{jk}}}\left({\frac {\mathbf {r} _{k}-\mathbf {r} _{j}}{r_{jk}}}\right),$ which is equal and opposite to F$_{kj}$ = −∇$_{rj}$V$_{kj}$ = −∇$_{rj}$V$_{jk}$, the force applied by particle k on particle j, as may be confirmed by explicit calculation. Hence, ${\begin{aligned}\sum _{k=1}^{N}\mathbf {F} _{k}\cdot \mathbf {r} _{k}&=\sum _{k=2}^{N}\sum _{j=1}^{k-1}\mathbf {F} _{jk}\cdot (\mathbf {r} _{k}-\mathbf {r} _{j})\\&=-\sum _{k=2}^{N}\sum _{j=1}^{k-1}{\frac {dV_{jk}}{dr_{jk}}}{\frac {|\mathbf {r} _{k}-\mathbf {r} _{j}|^{2}}{r_{jk}}}\\&=-\sum _{k=2}^{N}\sum _{j=1}^{k-1}{\frac {dV_{jk}}{dr_{jk}}}r_{jk}.\end{aligned}}$
Thus ${\frac {dG}{dt}}=2T+\sum _{k=1}^{N}\mathbf {F} _{k}\cdot \mathbf {r} _{k}=2T-\sum _{k=2}^{N}\sum _{j=1}^{k-1}{\frac {dV_{jk}}{dr_{jk}}}r_{jk}.$

### Special case of power-law forces

In a common special case, the potential energy V between two particles is proportional to a power n of their distance r$_{ij}$: $V_{jk}=\alpha r_{jk}^{n},$ where the coefficient α and the exponent n are constants. In such cases, the virial is ${\begin{aligned}-{\frac {1}{2}}\,\sum _{k=1}^{N}\mathbf {F} _{k}\cdot \mathbf {r} _{k}&={\frac {1}{2}}\,\sum _{k=1}^{N}\sum _{j<k}{\frac {dV_{jk}}{dr_{jk}}}r_{jk}\\&={\frac {1}{2}}\,\sum _{k=1}^{N}\sum _{j<k}n\alpha r_{jk}^{n-1}r_{jk}\\&={\frac {1}{2}}\,\sum _{k=1}^{N}\sum _{j<k}nV_{jk}={\frac {n}{2}}\,V_{\text{TOT}},\end{aligned}}$ where $V_{\text{TOT}}=\sum _{k=1}^{N}\sum _{j<k}V_{jk}$ is the total potential energy of the system.
Thus ${\frac {dG}{dt}}=2T+\sum _{k=1}^{N}\mathbf {F} _{k}\cdot \mathbf {r} _{k}=2T-nV_{\text{TOT}}.$
For gravitating systems the exponent n equals −1, giving Lagrange's identity ${\frac {dG}{dt}}={\frac {1}{2}}{\frac {d^{2}I}{dt^{2}}}=2T+V_{\text{TOT}},$ which was derived by Joseph-Louis Lagrange and extended by Carl Jacobi.

### Time averaging

The average of this derivative over a duration τ is defined as $\left\langle {\frac {dG}{dt}}\right\rangle _{\tau }={\frac {1}{\tau }}\int _{0}^{\tau }{\frac {dG}{dt}}\,dt={\frac {1}{\tau }}\int _{G(0)}^{G(\tau )}\,dG={\frac {G(\tau )-G(0)}{\tau }},$ from which we obtain the exact equation $\left\langle {\frac {dG}{dt}}\right\rangle _{\tau }=2\langle T\rangle _{\tau }+\sum _{k=1}^{N}\langle \mathbf {F} _{k}\cdot \mathbf {r} _{k}\rangle _{\tau }.$
The virial theorem states that if ⟨dG/dt⟩$_τ$ = 0, then $2\langle T\rangle _{\tau }=-\sum _{k=1}^{N}\langle \mathbf {F} _{k}\cdot \mathbf {r} _{k}\rangle _{\tau }.$
There are many reasons why the average of the time derivative might vanish. One often-cited reason applies to stably bound systems, that is, to systems that hang together forever and whose parameters are finite. In this case, velocities and coordinates of the particles of the system have upper and lower limits, so that G$^{bound}$ is bounded between two extremes, G$_{min}$ and G$_{max}$, and the average goes to zero in the limit of infinite τ: $\lim _{\tau \to \infty }\left|\left\langle {\frac {dG^{\text{bound}}}{dt}}\right\rangle _{\tau }\right|=\lim _{\tau \to \infty }\left|{\frac {G(\tau )-G(0)}{\tau }}\right|\leq \lim _{\tau \to \infty }{\frac {G_{\max }-G_{\min }}{\tau }}=0.$
Even if the average of the time derivative of G is only approximately zero, the virial theorem holds to the same degree of approximation.
For power-law forces with an exponent n, the general equation holds: $\langle T\rangle _{\tau }=-{\frac {1}{2}}\sum _{k=1}^{N}\langle \mathbf {F} _{k}\cdot \mathbf {r} _{k}\rangle _{\tau }={\frac {n}{2}}\langle V_{\text{TOT}}\rangle _{\tau }.$
For gravitational attraction, n = −1, and the average kinetic energy equals half of the average negative potential energy: $\langle T\rangle _{\tau }=-{\frac {1}{2}}\langle V_{\text{TOT}}\rangle _{\tau }.$
This general result is useful for complex gravitating systems such as planetary systems or galaxies.
A simple application of the virial theorem concerns galaxy clusters. If a region of space is unusually full of galaxies, it is safe to assume that they have been together for a long time, and the virial theorem can be applied. Doppler effect measurements give lower bounds for their relative velocities, and the virial theorem gives a lower bound for the total mass of the cluster, including any dark matter.
If the ergodic hypothesis holds for the system under consideration, the averaging need not be taken over time; an ensemble average can also be taken, with equivalent results.

## In quantum mechanics

Although originally derived for classical mechanics, the virial theorem also holds for quantum mechanics, as first shown by Vladimir Fock using the Ehrenfest theorem.
Evaluate the commutator of the Hamiltonian $H=V{\bigl\{X_{i}\}{\bigr )}+\sum _{n}{\frac {P_{n}^{2}}{2m_{n}}}$ with the position operator X$_n$ and the momentum operator $P_{n}=-i\hbar {\frac {d}{dX_{n}}}$ of particle n, $[H,X_{n}P_{n}]=X_{n}[H,P_{n}]+[H,X_{n}]P_{n}=i\hbar X_{n}{\frac {dV}{dX_{n}}}-i\hbar {\frac {P_{n}^{2}}{m_{n}}}.$
Summing over all particles, one finds that for $Q=\sum _{n}X_{n}P_{n}$ the commutator is ${\frac {i}{\hbar }}[H,Q]=2T-\sum _{n}X_{n}{\frac {dV}{dX_{n}}},$ where T=∑$_n$P$_n$$^2$/2m$_n${\textstyle T=\sum _{n}P_{n}^{2}/2m_{n}} is the kinetic energy. The left-hand side of this equation is just dQ/dt, according to the Heisenberg equation of motion. The expectation value ⟨dQ/dt⟩ of this time derivative vanishes in a stationary state, leading to the quantum virial theorem: $2\langle T\rangle =\sum _{n}\left\langle X_{n}{\frac {dV}{dX_{n}}}\right\rangle .$

### Pokhozhaev's identity

In the field of quantum mechanics, there exists another form of the virial theorem, applicable to localized solutions to the stationary nonlinear Schrödinger equation or Klein–Gordon equation, is Pokhozhaev's identity, also known as Derrick's theorem. Let $g(s)$ be continuous and real-valued, with $g(0)=0$.
Denote G(s)=∫$_0$$^s$g(t)dt{\textstyle G(s)=\int _{0}^{s}g(t)\, dt}. Let $u\in L_{\text{loc}}^{\infty }(\mathbb {R} ^{n}),\quad \nabla u\in L^{2}(\mathbb {R} ^{n}),\quad G(u(\cdot ))\in L^{1}(\mathbb {R} ^{n}),\quad n\in \mathbb {N}$ be a solution to the equation $-\nabla ^{2}u=g(u),$ in the sense of distributions. Then $u$ satisfies the relation $\left({\frac {n-2}{2}}\right)\int _{\mathbb {R} ^{n}}|\nabla u(x)|^{2}\,dx=n\int _{\mathbb {R} ^{n}}G{\bigu(x){\big )}\,dx.$

## In special relativity

For a single particle in special relativity, it is not the case that T = ⁠1/2⁠p · v. Instead, it is true that T = (γ − 1) mc$^2$, where γ is the Lorentz factor
$\gamma ={\frac {1}{\sqrt {1-{\frac {v^{2}}{c^{2}}}}}},$ and β = ⁠v/c⁠. We have ${\begin{aligned}{\frac {1}{2}}\mathbf {p} \cdot \mathbf {v} &={\frac {1}{2}}{\boldsymbol {\beta }}\gamma mc\cdot {\boldsymbol {\beta }}c\\&={\frac {1}{2}}\gamma \beta ^{2}mc^{2}\\[5pt]&=\left({\frac {\gamma \beta ^{2}}{2(\gamma -1)}}\right)T.\end{aligned}}$ The last expression can be simplified to $\left({\frac {1+{\sqrt {1-\beta ^{2}}}}{2}}\right)T=\left({\frac {\gamma +1}{2\gamma }}\right)T.$ Thus, under the conditions described in earlier sections (including Newton's third law of motion, F$_{jk}$ = −F$_{kj}$, despite relativity), the time average for N particles with a power law potential is ${\frac {n}{2}}\left\langle V_{\text{TOT}}\right\rangle _{\tau }=\left\langle \sum _{k=1}^{N}\left({\tfrac {1+{\sqrt {1-\beta _{k}^{2}}}}{2}}\right)T_{k}\right\rangle _{\tau }=\left\langle \sum _{k=1}^{N}\left({\frac {\gamma _{k}+1}{2\gamma _{k}}}\right)T_{k}\right\rangle _{\tau }.$ In particular, the ratio of kinetic energy to potential energy is no longer fixed, but necessarily falls into an interval: ${\frac {2\langle T_{\text{TOT}}\rangle }{n\langle V_{\text{TOT}}\rangle }}\in [1,2],$ where the more relativistic systems exhibit the larger ratios.

## Examples

The virial theorem has a particularly simple form for periodic motion. It can be used to perform perturbative calculation for nonlinear oscillators.
It can also be used to study motion in a central potential. If the central potential is of the form $U\propto r^{n}$, the virial theorem simplifies to $\langle T\rangle ={\frac {n}{2}}\langle U\rangle$. In particular, for gravitational or electrostatic (Coulomb) attraction, $\langle T\rangle =-{\frac {1}{2}}\langle U\rangle$.

### Driven damped harmonic oscillator

Analysis based on Sivardiere, 1986. For a one-dimensional oscillator with mass $m$, position $x$, driving force $F\cos(\omega t)$, spring constant $k$, and damping coefficient $\gamma$, the equation of motion is $m\underbrace {\frac {d^{2}x}{dt^{2}}} _{\text{acceleration}}=\underbrace {-kx{\vphantom {\frac {d}{d}}}} _{\text{spring}}\ \underbrace {-\ \gamma {\frac {dx}{dt}}} _{\text{friction}}\ \underbrace {+\ F\cos(\omega t){\vphantom {\frac {d}{d}}}} _{\text{external driving}}.$
When the oscillator has reached a steady state, it performs a stable oscillation $x=X\cos(\omega t+\varphi )$, where $X$ is the amplitude, and $\varphi$ is the phase angle.
Applying the virial theorem, we have $m\langle {\dot {x}}{\dot {x}}\rangle =k\langle xx\rangle +\gamma \langle x{\dot {x}}\rangle -F\langle \cos(\omega t)x\rangle$, which simplifies to $F\cos(\varphi )=m(\omega _{0}^{2}-\omega ^{2})X$, where $\omega _{0}={\sqrt {k/m}}$ is the natural frequency of the oscillator.
To solve the two unknowns, we need another equation. In steady state, the power lost per cycle is equal to the power gained per cycle: $\underbrace {\langle {\dot {x}}\,\gamma {\dot {x}}\rangle } _{\text{power dissipated}}=\underbrace {\langle {\dot {x}}\,F\cos \omega t\rangle } _{\text{power input}},$ which simplifies to $\sin \varphi =-{\frac {\gamma X\omega }{F}}$.
Now we have two equations that yield the solution ${\begin{cases}X={\sqrt {\dfrac {F^{2}}{\gamma ^{2}\omega ^{2}+m^{2}(\omega _{0}^{2}-\omega ^{2})^{2}}}},\\\tan \varphi =-{\dfrac {\gamma \omega }{m(\omega _{0}^{2}-\omega ^{2})}}.\end{cases}}$

### Ideal-gas law

Consider a container filled with an ideal gas consisting of point masses. The only forces applied to the point masses are due to the container walls. In this case, the expression in the virial theorem equals ${\Big \langle }\sum _{i}\mathbf {F} _{i}\cdot \mathbf {r} _{i}{\Big \rangle }=-P\oint {\hat {\mathbf {n} }}\cdot \mathbf {r} \,dA,$ since, by definition, the pressure P is the average force per area exerted by the gas upon the walls, which is normal to the wall. There is a minus sign because ${\hat {\mathbf {n} }}$ is the unit normal vector pointing outwards, and the force to be used is the one upon the particles by the wall.
Then the virial theorem states that $\langle T\rangle ={\frac {P}{2}}\oint {\hat {\mathbf {n} }}\cdot \mathbf {r} \,dA.$ By the divergence theorem, ∮n$^^$⋅rdA=∫∇⋅rdV=3∫dV=3V{\textstyle \oint {\hat {\mathbf {n} }}\cdot \mathbf {r} \, dA=\int \nabla \cdot \mathbf {r} \, dV=3\int dV=3V}.
From equipartition, the average total kinetic energy ⟨T⟩=N⟨ 1/2 mv$^2$⟩=N⋅ 3/2 kT{\textstyle \langle T\rangle =N{\big \langle }{\frac {1}{2}}mv^{2}{\big \rangle }=N\cdot {\frac {3}{2}}kT}. Hence, $PV=NkT$, the ideal gas law.

### Dark matter

In 1933, Fritz Zwicky applied the virial theorem to estimate the mass of Coma Cluster, and discovered a discrepancy of mass of about 450, which he explained as due to "dark matter". He refined the analysis in 1937, finding a discrepancy of about 500.

#### Theoretical analysis

He approximated the Coma cluster as a spherical "gas" of $N$ stars of roughly equal mass $m$, which gives ⟨T⟩=1/2 Nm⟨v$^2$⟩{\textstyle \langle T\rangle ={\frac {1}{2}}Nm\langle v^{2}\rangle }. The total gravitational potential energy of the cluster is $U=-\sum _{i<j}{\frac {Gm^{2}}{r_{i,j}}}$, giving ⟨U⟩=−Gm$^2$∑$_{i<j}$⟨1/r$_{i, j}$⟩{\textstyle \langle U\rangle =-Gm^{2}\sum _{i<j}\langle {1}/{r_{i, j}}\rangle }. Assuming the motion of the stars are all the same over a long enough time (ergodicity), ⟨U⟩=−1/2 N$^2$Gm$^2$⟨1/r⟩{\textstyle \langle U\rangle =-{\frac {1}{2}}N^{2}Gm^{2}\langle {1}/{r}\rangle }.
Zwicky estimated $\langle U\rangle$ as the gravitational potential of a uniform ball of constant density, giving ⟨U⟩=−3/5 GN$^2$m$^2$/R {\textstyle \langle U\rangle =-{\frac {3}{5}}{\frac {GN^{2}m^{2}}{R}}}.
So by the virial theorem, the total mass of the cluster is$Nm={\frac {5\langle v^{2}\rangle }{3G\langle {\frac {1}{r}}\rangle }}$

#### Data

Zwicky$_{1933}$ estimated that there are $N=800$ galaxies in the cluster, each having observed stellar mass $m=10^{9}M_{\odot }$ (suggested by Hubble), and the cluster has radius $R=10^{6}{\text{ly}}$. He also measured the radial velocities of the galaxies by doppler shifts in galactic spectra to be $\langle v_{r}^{2}\rangle =(1000{\text{km/s}})^{2}$. Assuming equipartition of kinetic energy, $\langle v^{2}\rangle =3\langle v_{r}^{2}\rangle$.
By the virial theorem, the total mass of the cluster should be ${\frac {5R\langle v_{r}^{2}\rangle }{G}}\approx 3.6\times 10^{14}M_{\odot }$. However, the observed mass is $Nm=8\times 10^{11}M_{\odot }$, meaning the total mass is 450 times that of observed mass.

## Generalizations

Lord Rayleigh published a generalization of the virial theorem in 1900, which was partially reprinted in 1903. Henri Poincaré proved and applied a form of the virial theorem in 1911 to the problem of formation of the Solar System from a proto-stellar cloud (then known as cosmogony). A variational form of the virial theorem was developed in 1945 by Ledoux. A tensor form of the virial theorem was developed by Parker, Chandrasekhar and Fermi. The following generalization of the virial theorem has been established by Pollard in 1964 for the case of the inverse square law: $2\lim _{\tau \to +\infty }\langle T\rangle _{\tau }=\lim _{\tau \to +\infty }\langle U\rangle _{\tau }\quad {\text{if and only if}}\quad \lim _{\tau \to +\infty }{\tau }^{-2}I(\tau )=0.$ A boundary term otherwise must be added.

## Inclusion of electromagnetic fields

The virial theorem can be extended to include electric and magnetic fields. The result is
${\frac {1}{2}}{\frac {d^{2}I}{dt^{2}}}+\int _{V}x_{k}{\frac {\partial G_{k}}{\partial t}}\,d^{3}r=2(T+U)+W^{\mathrm {E} }+W^{\mathrm {M} }-\int x_{k}(p_{ik}+T_{ik})\,dS_{i},$
where I is the moment of inertia, G is the momentum density of the electromagnetic field, T is the kinetic energy of the "fluid", U is the random "thermal" energy of the particles, W$^E$ and W$^M$ are the electric and magnetic energy content of the volume considered. Finally, p$_{ik}$ is the fluid-pressure tensor expressed in the local moving coordinate system
$p_{ik}=\Sigma n^{\sigma }m^{\sigma }\langle v_{i}v_{k}\rangle ^{\sigma }-V_{i}V_{k}\Sigma m^{\sigma }n^{\sigma },$
and T$_{ik}$ is the electromagnetic stress tensor,
$T_{ik}=\left({\frac {\varepsilon _{0}E^{2}}{2}}+{\frac {B^{2}}{2\mu _{0}}}\right)\delta _{ik}-\left(\varepsilon _{0}E_{i}E_{k}+{\frac {B_{i}B_{k}}{\mu _{0}}}\right).$
A plasmoid is a finite configuration of magnetic fields and plasma. With the virial theorem it is easy to see that any such configuration will expand if not contained by external forces. In a finite configuration without pressure-bearing walls or magnetic coils, the surface integral will vanish. Since all the other terms on the right hand side are positive, the acceleration of the moment of inertia will also be positive. It is also easy to estimate the expansion time τ. If a total mass M is confined within a radius R, then the moment of inertia is roughly MR$^2$, and the left hand side of the virial theorem is ⁠MR$^2$/τ$^2$⁠. The terms on the right hand side add up to about pR$^3$, where p is the larger of the plasma pressure or the magnetic pressure. Equating these two terms and solving for τ, we find
$\tau \,\sim {\frac {R}{c_{\mathrm {s} }}},$
where c$_s$ is the speed of the ion acoustic wave (or the Alfvén wave, if the magnetic pressure is higher than the plasma pressure). Thus the lifetime of a plasmoid is expected to be on the order of the acoustic (or Alfvén) transit time.

## Relativistic uniform system

In case when in the physical system the pressure field, the electromagnetic and gravitational fields are taken into account, as well as the field of particles’ acceleration, the virial theorem is written in the relativistic form as follows:
$\left\langle W_{k}\right\rangle \approx -0.6\sum _{k=1}^{N}\langle \mathbf {F} _{k}\cdot \mathbf {r} _{k}\rangle ,$
where the value W$_k$ ≈ γ$_c$T exceeds the kinetic energy of the particles T by a factor equal to the Lorentz factor γ$_c$ of the particles at the center of the system. Under normal conditions we can assume that γ$_c$ ≈ 1, then we can see that in the virial theorem the kinetic energy is related to the potential energy not by the coefficient ⁠1/2⁠, but rather by the coefficient close to 0.6. The difference from the classical case arises due to considering the pressure field and the field of particles’ acceleration inside the system, while the derivative of the scalar G is not equal to zero and should be considered as the material derivative.
An analysis of the integral theorem of generalized virial makes it possible to find, on the basis of field theory, a formula for the root-mean-square speed of typical particles of a system without using the notion of temperature:
$v_{\mathrm {rms} }=c{\sqrt {1-{\frac {4\pi \eta \rho _{0}r^{2}}{c^{2}\gamma _{c}^{2}\sin ^{2}\left({\frac {r}{c}}{\sqrt {4\pi \eta \rho _{0}}}\right)}}}},$
where $~c$ is the speed of light, $~\eta$ is the acceleration field constant, $~\rho _{0}$ is the mass density of particles, $~r$ is the current radius.
Unlike the virial theorem for particles, for the electromagnetic field the virial theorem is written as follows: $~E_{kf}+2W_{f}=0,$ where the energy E$_{kf}$=∫A$_α$j$^α$√(−g)dx$^1$dx$^2$dx$^3${\textstyle ~E_{kf}=\int A_{\alpha }j^{\alpha }{\sqrt {-g}}\, dx^{1}\, dx^{2}\, dx^{3}} considered as the kinetic field energy associated with four-current $j^{\alpha }$, and $~W_{f}={\frac {1}{4\mu _{0}}}\int F_{\alpha \beta }F^{\alpha \beta }{\sqrt {-g}}\,dx^{1}\,dx^{2}\,dx^{3}$ sets the potential field energy found through the components of the electromagnetic tensor.

## In astrophysics

The virial theorem is frequently applied in astrophysics, especially relating the gravitational potential energy of a system to its kinetic or thermal energy. Some common virial relations are ${\frac {3}{5}}{\frac {GM}{R}}={\frac {3}{2}}{\frac {k_{\mathrm {B} }T}{m_{\mathrm {p} }}}={\frac {1}{2}}v^{2}$ for a mass M, radius R, velocity v, and temperature T. The constants are Newton's constant G, the Boltzmann constant k$_B$, and proton mass m$_p$. Note that these relations are only approximate, and often the leading numerical factors (e.g. ⁠3/5⁠ or ⁠1/2⁠) are neglected entirely.

### Galaxies and cosmology (virial mass and radius)

In astronomy, the mass and size of a galaxy (or general overdensity) is often defined in terms of the "virial mass" and "virial radius" respectively. Because galaxies and overdensities in continuous fluids can be highly extended (even to infinity in some models, such as an isothermal sphere), it can be hard to define specific, finite measures of their mass and size. The virial theorem, and related concepts, provide an often convenient means by which to quantify these properties.
In galaxy dynamics, the mass of a galaxy is often inferred by measuring the rotation velocity of its gas and stars, assuming circular Keplerian orbits. Using the virial theorem, the velocity dispersion σ can be used in a similar way. Taking the kinetic energy (per particle) of the system as T = ⁠1/2⁠v$^2$ ~ ⁠3/2⁠σ$^2$, and the potential energy (per particle) as U ~ ⁠3/5⁠ ⁠GM/R⁠ we can write
${\frac {GM}{R}}\approx \sigma ^{2}.$
Here $R$ is the radius at which the velocity dispersion is being measured, and M is the mass within that radius. The virial mass and radius are generally defined for the radius at which the velocity dispersion is a maximum, i.e.
${\frac {GM_{\text{vir}}}{R_{\text{vir}}}}\approx \sigma _{\max }^{2}.$
As numerous approximations have been made, in addition to the approximate nature of these definitions, order-unity proportionality constants are often omitted (as in the above equations). These relations are thus only accurate in an order of magnitude sense, or when used self-consistently.
An alternate definition of the virial mass and radius is often used in cosmology where it is used to refer to the radius of a sphere, centered on a galaxy or a galaxy cluster, within which virial equilibrium holds. Since this radius is difficult to determine observationally, it is often approximated as the radius within which the average density is greater, by a specified factor, than the critical density $\rho _{\text{crit}}={\frac {3H^{2}}{8\pi G}}$ where H is the Hubble parameter and G is the gravitational constant. A common choice for the factor is 200, which corresponds roughly to the typical over-density in spherical top-hat collapse (see Virial mass), in which case the virial radius is approximated as $r_{\text{vir}}\approx r_{200}=r,\qquad \rho =200\cdot \rho _{\text{crit}}.$ The virial mass is then defined relative to this radius as $M_{\text{vir}}\approx M_{200}={\frac {4}{3}}\pi r_{200}^{3}\cdot 200\rho _{\text{crit}}.$

### Stars

The virial theorem is applicable to the cores of stars, by establishing a relation between gravitational potential energy and thermal kinetic energy (i.e. temperature). As stars on the main sequence convert hydrogen into helium in their cores, the mean molecular weight of the core increases and it must contract to maintain enough pressure to support its own weight. This contraction decreases its potential energy and, the virial theorem states, increases its thermal energy. The core temperature increases even as energy is lost, effectively a negative specific heat. This continues beyond the main sequence, unless the core becomes degenerate since that causes the pressure to become independent of temperature and the virial relation with n equals −1 no longer holds.