**Density** is the amount of mass per unit volume of a substance or the inverse of specific volume. Density is, therefore, a scalar quantity. The symbol used to represent density in equations is ρ with SI units of kilograms per cubic meter. This term is the reciprocal of the specific volume.

For gases, the density can vary over a wide range because the particles are free to move closer together when constrained by pressure or volume. This variation of density is referred to as compressibility. Like pressure and temperature, density is a state variable of gas, and the change in density during any process is governed by the laws of thermodynamics. For a static gas, the density is the same throughout the entire container.

Like pressure and temperature, density is a variable state of gas, and the change in density during any process is governed by the laws of thermodynamics. For a static gas, the density is the same throughout the entire container. It can be shown by the kinetic theory that the density is inversely proportional to the size of the container in which a fixed mass of gas is confined. In this case of a fixed mass, the density decreases as the volume increases.

The density of a substance is dependent on temperature and pressure; in gases, the density is directly proportional to the pressure and inversely proportional to the temperature, while in solids and liquids, being incompressible substances, the variation of their density when the pressure varies is negligible. The density of a liquid is usually close to that of a solid, and much higher than in a gas.

## Density of a mixture

To calculate the density of a mixture consisting of several substances (components), the following relation can be used:

where: m_{i} is the mass of component *i* in the mixture; V is the volume of the mixture; ρ_{i} is the mass concentration of component *i* in the mixture.

## Relative density (specific gravity)

The density of a substance referred to the density of another known substance, is called relative density *RD*, defined as the ratio between the density of the substance being studied (sample) and the density of a known reference substance at a given temperature (typically used water at 4 °C). Specific gravity *SG* usually means relative density with respect to water. It is a dimensionless quantity.

The choice of the reference substance is arbitrary: it is also possible to define the specific gravity with reference to other substances, but specifying the conditions of temperature and pressure since the density of the material varies with temperature and pressure. This physical quantity is of fundamental importance in the context of fluid statics and in particular in the formulation of Archimedes’ law, which explains the floating of bodies in a fluid.

## Density in astronomy

The term density appears in astronomy in many different contexts.

- In its most generic use the density is the mass per unit volume of an object or region and might have units like kg/m
^{3}or Mo/pc^{3}. - The
**Number density**is the number of a particular object or species per unit volume and might be used when describing the number of electrons per cubic centimetre in a plasma or the number of stars in the core of a globular cluster. **Density profile**is the density as a function of some variable like distance from the centre of a star.- The
**mean**or**average density**is the total mass of a region divided by the total volume of that region.

Since the behaviour of matter is often a function of density it is a very important quantity to determine when trying to explain the underlying physics of an object.