Petr Matas said:
We have already derived the density
$$ \rho(z) \propto \int_{-\infty}^{+\infty} \rho(z, v_{\rm z}) \, dv_{\rm z} \propto \exp(-\beta m g z)
$$ using the laws of motion, so we can start from there.
Let us have a vertical column of ideal gas.
##\rho(z)## is the density of particles at altitude ##z##,
##\beta = \frac {1} {k_{\rm B} T}## is the thermodynamic beta,
##k_{\rm B}## is the Boltzmann constant,
##T## is the thermodynamic temperature,
##m## is the particle mass,
##h## is the column height,
##g## is the gravitational acceleration.
The average altitude of particles above the column floor (i.e. the altitude of the column's center of mass) can be written as
$$
\begin{align}
\left< z \right> &= \frac {\int_0^h z \, \rho(z) \, dz} {\int_0^h \rho(z) \, dz} \nonumber \\
\nonumber \\
&= \frac {\int_0^h z \, e^{-\beta m g z} \, dz} {\int_0^h e^{-\beta m g z} \, dz} \nonumber \\
\nonumber \\
&= \frac {1} {β m g} - \frac {h} {e^{β m g h} - 1} \nonumber
\end{align}
$$ (
calculation).
Some interesting values:
$$
\begin{align}
& \lim_{h \to \infty} \left< z \right> = \frac {1} {β m g} \nonumber \\
\nonumber \\
& \lim_{T \to 0} \left< z \right> = 0 \nonumber \\
\nonumber \\
& \lim_{T \to \infty} \left< z \right> = \frac{h}{2} \nonumber
\end{align}
$$