# How do you calculate density if you also account for gravity?

Consider this. I have an Earth-sized quantity of water that I throw into space. Naturally, it will assume the shape of a ball.

Now hear me out. Density's definition generally assumes that it will tend towards equalizing accross the whole material. However, a strong force of gravity to me would indicate that it actually becomes denser the closer you are to the center of mass in this case. It certainly seems to be in the case of Earth's crust and core.

So is there some sort of simple formula that ties these two properties together? Have I made a wrongful assumption somewhere?

• So really, you are wondering how density of a material changes as a function of pressure? Because that's the result of gravity; there's increased pressure at lower depths – Jim Mar 2 '15 at 19:35
• Density can and does vary within a sample of material. Introductory presentations on the topic take the density of small samples to be uniform. This simplifies the introduction of the concept. – garyp Mar 2 '15 at 19:36
• Density's definition generally assumes that it will tend towards equalizing accross the whole material What a fancy way to say is usually assumed constant :-) – Steeven Mar 2 '15 at 20:20

$$\frac{dP}{dr} = - \rho(r) g(r),$$ where $dP/dr$ is the local pressure gradient, $\rho(r)$ is the local density and $g(r)$ is the local gravitational field. This is the version appropriate for Newtonian gravity and it says that the the weight of a slab of material in dynamical equilibrium is supported by the difference in pressure between the top and bottom of the slab. The negative sign is because the pressure must be bigger below the slab.