The law of atmospheres, also known as barometric law, states that the pressure p(y) varies as a functtion of height y.
Pressure p(y) at a height y is given by
p(y) = p0 exp[ - m×g×y /(kB×T) ] ...............(1)
where m is the mean moleculer weight of molecules present in air and kB is boltzman constant and T is temperature.
According to ideal gas law, a gas of N molecules in thermal equilibrium obeys the relationship
p×V = N×kB×T .....................(2)
if we consider number density n as number of molecules per unit volume, then we have n = N/V .
We can rewrite eqn.(2) using number density n as
p = n×kB×T ...........................(3)
To determine the variation in pressure with altitude, let us consider an atmospheric layer of thickness dy and cross section area A.
Because the air is in static equilibrium, the upward force p×A on the bottom layer must exceed the downward force (p+dp)×A
by an amount equal to weight of the gas in this thin layer. Hence we can write
p×A - (p + dp)×A = n×A×dy×m×g
dp = - n×m×g×dy ........................(4)
from eqn.(3), we get dp = kB × T×dn .......................(5)
from (4) and (5), we write, dn/n = - [ m×g/(kB × T) ] dy .................(6)
by integrating eqn.(6), we get , n(y) = n0×exp[ -m×g×y / (kB × T) ] ...............(7)
since pressure is related to number density as given in eqn.(3), we get, p(y) = p0×exp[ -m×g×y / (kB × T) ]
n0 and p0 are the values at y=0, i.e. on earth's surface