Hydrostatic equilibrium is one of the most important fundamental principles
in atmospheric physics and astrophysics. It defines the properties of stable
gaseous systems confined within a gravitational field, and can be used to
estimate the properties of Earth's atmosphere, Jovian planets, stars,
and even clusters of galaxies. In its simplest form, it
states that the inward force of gravity on an infinitesimal parcel of
gas is balanced by the outward force of pressure by the gas underneath
it.

The simplest physical case of an isothermal (uniform temperature),
ideal gas is the most physically enlightening.

Take a cube of gas, with sides *dx=dy=dz* and density ρ,
bounded top and bottom by gas pressures P_{1} and P_{0} at
a height *z* in a (nearly) constant gravitational field.

P(1)
__________
/ /|
/ / |
/ / |dz gravity (g)
|---------| | |
| | | V
| | /
| | / dy
|_________|/
dx
P(0)

The sides of the cube have area *dA = dxdy*. We assume that gravity
is only acting in the downwards direction, and there are no lateral
accelerations, so we ignore motions of the cube in the X and Y directions.
For the cube to be static, all vertical forces on the cube must sum to
zero. The net downwards force is the force of gravity on the cube plus
the downwards pressure from gas above the cube, or

F_{down} = - M_{cube} g - P_{1} dA (eq. 1)

Note the minus signs, indicating that the force is acting in the
*negative* (downwards) direction along the *z*-axis.
The net upwards force is just the pressure of the gas below the cube,
P_{0} dA. The sum of the forces is then

F_{down} + F_{up} = -M_{cube} g +
(P_{0} - P_{1}) dA = 0 (eq. 2)

Since *M*_{cube} is just *ρ dx dy dz = ρ dz dA*,
the equation reduces to

-ρg dz = P_{1} - P_{0} = dP (eq. 3)

Now, since we're talking about an ideal gas, *P = ρ k T / μ*,
where *k* is Boltzmann's constant, *T* is the temperature, and
μ is the mean molecular weight. We can substitute this into
equation (3) and get

P (-μg)/(kT) dz = dP (eq. 4)

Integration of this equation yields

ln(P) + const = -(μg)/(kT) z (eq. 5)

where *ln* is the natural logarithm, resulting from the integration of
*dP/P*. This is then usually written in exponential form, as

P = P(z_{0}) exp(-μgz/(kT)) (eq. 6)

where P(z_{0}) is the pressure at the (arbitrary) point
*z*_{0} (on Earth, this would be the equivalent of sea level).
The quantity (kT/μg) is usually rewritten as *H*, the scale height,
leading to the simple equation

P = P(z_{0}) exp (-z/H) (eq. 7)

On Earth, the value of the scale height is about 8 km, meaning
that the air pressure drops by a factor of e (about 36 percent) when you
increase your altitude by one scale height.

Obviously, there are some caveats to using the above formulation.
First, the local acceleration due to gravity, *g*, is not a constant,
so to be precise, it should be replaced with Newton's Law of Gravitation:

g = GM/R^{2} (eq. 8)

Second, the gas you deal with will be neither isothermal nor ideal, so they
introduce a further difficulty into the equation. However, as written,
equation (7) provides a good, first-order approximation to the behavior of
gaseous atmospheres. If you happen to be an astronomy or atmospheric physics
grad student, it will almost certainly appear on an exam at some point so
this derivation is worth knowing.