  Starting with the relativistic Boltzmann equation for a system of particles
defined by a distribution function, we have derived the virial relation for a
spherical structure within an expanding background in the context of general
relativity. This generalized form of the virial relation is then applied to the
static case of a spherically symmetric structure to see the difference in the
simplest case to the Newtonian relation. A relativistic Mass-Temperature
relation for this simple case is also derived which can be applied to compact
objects in astrophysics. Our general virial relation is then applied to the
non-static case of a structure within an expanding universe where an extra
term, usually missed in studies of structures in the presence of the dark
energy, appears.
