pressure in earth's atmosphere as a function of height above sea level While I was studying the measurements of pressure at earth's atmosphere,I found the barometric formula which is more complex equation ($P'=Pe^{-mgh/kT}$) than what I used so far ($p=h\rho g$).
So I want to know how this complex formula build up? I could reach at the point of
$${dP \over dh}=-{mgP \over kT}$$
 From this how can I obtain that equation. Please give me a Mathematical explanation.
 A: If 
$\frac{dP}{dh} = (-\frac{mgP}{kT})$,
then
$\frac{1}{P} \frac{dP}{dh} = (-\frac{mg}{kT})$,
or
$\frac{d(ln P)}{dh} = (-\frac{mg}{kT})$.
Integrating with respect to $h$ over the interval $[h_0, h]$ yields
$ln(P(h)) - ln(P(h_0)) = (-\frac{mg}{kT})(h - h_0)$,
or
$ln(\frac{P(h)}{P(h_0)}) = (-\frac{mg}{kT})(h - h_0)$,
or
$\frac{P(h)}{P(h_0)} = exp(-\frac{mg}{kT}(h - h_0))$,
or
$P(h) = P(h_0)exp(-\frac{mg}{kT}(h - h_0))$.
If we now take $h_0 = 0$, and set $P = P(0)$, $P' = P(h)$, the desired formula is had.
A: This type of problem is known as a differential equation. In this particular case the solution can be guessed, since you have that the derivative of the function $P$ is just a constant times $P$. The only function satisfying this condition is the exponent, since:
$${d(A e^{a x}) \over dx} = a A e^x$$
Thus, if $${dP\over dh} = \left( \frac {-mg}{kT}\right) P$$
Then $P$ must be:
$$P(h) = A\exp\left(\frac {-mg}{kT} \cdot h\right)$$
Where $A$ is a constant. In particular, if the pressure $P_0$ at $h=0$ is known, then by substitution, We have:
$$P(h) = P_0\exp\left(\frac {-mg}{kT} \cdot h\right)$$
