Why does the density of air decrease with height?

The density of air decreases with height mainly due to changes in pressure and temperature. As you move higher up in the atmosphere, the pressure exerted by the air decreases. This decrease in pressure means that there are fewer air molecules per unit volume, resulting in a lower density.

Additionally, the temperature of the atmosphere also decreases with height. This decrease in temperature causes the air molecules to move more slowly, which leads to a decrease in their average kinetic energy. As a result, the molecules are closer together, leading to an increase in density.

Overall, the combined effect of decreasing pressure and temperature with height leads to a decrease in the density of air.