# What is the difference of pressure of a gas in a closed container at a given distance from the Earth?

If I have a closed container of a given height $$(h)$$, located at a given distance from the centre of the Earth $$(r_o)$$, what would the pressure difference be at the top of the container vs the bottom?

I was looking at this video, and it was explaining that the pressure of a fluid is $$P = \rho h g$$, where $$\rho$$ is the density of the fluid, $$h$$ is the height of the liquid on top and $$g$$ is the gravitational force.

However, I think that refers to an open container and also as my height may be as little as $$1$$ m and as big as $$10^7$$ m, I'm not entirely certain that I can use this formula as $$g$$ can very significantly, which would appear to invalidate the mass calculation that was used to arrive at that formula $$F = m g \rightarrow F = (\rho V) g \rightarrow F = (\rho A h) g$$ , since density can very over height. Also, $$\rho$$ would depend on temperature, pressure and volume, so that makes this even more complex, so I don't even know where to start.

The equation governing hydrostatic (air not moving) pressure is $$\frac{dp} {dz} = - \rho g$$ so if you know your density and gravity as a function of $$z$$ then you can figure out the pressure. Alternatively, you can assume the air is an ideal gas, and make some other additional assumptions about how the air behaves as you go up through the atmosphere, and calculate that way.