We can estimate how density varies inside the Earth by using seismic data, particularly the speeds of P-waves and S-waves. These waves travel through the Earth’s interior during earthquakes and carry information about its internal structure.
The velocities of seismic waves depend on the elastic properties and density of the material.
$$ v_p^2 = \frac{K + \frac{4}{3} \mu}{\rho} $$
$$ v_s^2 = \frac{\mu}{\rho} $$
Here:
By eliminating $\mu$, we can express the bulk modulus per unit density as:
$$ \frac{K}{\rho} = v_p^2 - \frac{4}{3} v_s^2 $$
The pressure at a given depth in the Earth must balance the weight of overlying layers. The pressure difference between the top and bottom of a spherical shell is given by:
$$ \frac{\Delta P}{\Delta r} \simeq -\frac{G \rho M(<r)}{r^2} $$
where:
The bulk modulus is also defined as:
$$ K = \frac{\Delta P}{\Delta \rho} $$
Combining the two equations, we get the density gradient equation:
$$ \Delta \rho = - \frac{\rho^2 G M(<r)}{K r^2} \Delta r $$
This tells us how density changes with depth, provided we know seismic wave speeds (to get $K/\rho$) and mass distribution.
To compute the density profile from the surface to the center of the Earth: