$$\require{cancel}$$
Let us imagine a column of air of cross-sectional area A in an isothermal atmosphere – that is to say the temperature T is uniform throughout. Consider the equilibrium of the portion of the air between heights z and z + dz. The weight of this portion is ρgAdz. Let P be the pressure at height z and P + dP be the pressure at height z + dz. (Note that dP is negative.) The net upward force on the portion dz of the air is −AdP. Therefore dP = − ρgdz. But if we regard air as an ideal gas, it obeys the equation of state for an ideal gas, equation 6.1.7: P = ρRT/µ where ρ and µ are respectively the density and the “molecular weight” (molar mass) of the gas. Therefore $$\frac{R T}{\mu} d \rho=-\rho g d z$$, or $$\frac{d \rho}{\rho}=-\frac{\mu g}{R T} d z$$. Integrate to obtain
$\rho=\rho e^{-z / H}$
where $$H=\frac{R T}{\mu g}$$ is the scale height. It is large if the temperature is high, the gas light and the planet’s gravity feeble. It is the height at which the density is reduced to a fraction 1/e, or 36.8%. of its ground value. What would it be, in kilometres, for an atmosphere consisting of 80% N2 and 20% O2, at a temperature of 20 ºC, where the gravitational acceleration is 9.8 m s−2? What fraction is this of the radius of Earth? If you made a model of Earth one metre in diameter (radius = 50 cm), how thick would be the atmosphere? You’d better look after it - our atmosphere is a very thin skin clinging to the surface!