# What is the relationship between air pressure and temperature?

I'm trying to reconcile a paradox regarding air pressure and temperature.

On the one hand, compressing air heats it up, while expanding it cools it. So density and temperature are proportional.

On the other hand, warm air in the atmosphere is a low pressure system and cold air is a high pressure system. So density and temperature are inversely proportional.

What am I missing in order to reconcile the two?

• Hi @Steven ! Take the two cases' conditions, i.e. closed container and open atmosphere. In the former, heating will increase gas pressure on the container's wall. In the latter, heating air will result in atmospheric instability> moving wind and less dense air> lighter atmospheric column weight> low air pressure on the surface. " > "means leading to. I hope this helps :) Nov 19, 2021 at 15:37
• Thank you @ahmathelte, the open vs. closed container metaphor really helped! If you'd like to put that in an answer, I can accept it Nov 20, 2021 at 5:11
• @Steven You can accept that answer, but it's just wrong. Nov 20, 2021 at 12:57
• @AtmosphericPrisonEscape honestly I don't see their answer being fundamentally wrong, just a bit off tangent (the question wasn't about heating... but does seem right that confinement in a closed container results in p ↑, while without confinement it is heavily a ρ ↓. I admit the explanation of the ρ decrease does go awry in mentioning instability, as the T change itself causes expansion and ρ ↓, but that seems fixable and perhaps some terminology trouble... Nov 21, 2021 at 22:12
• @JeopardyTempest: Thanks for the input, I'll add a TLDR; Nov 22, 2021 at 21:17

Or if the math of the other answers is a bit complex, in a broad sense, the balancing relationship is: $$\frac{\mathrm{density} \cdot \mathrm{temperature}}{\mathrm{pressure}} = \mathrm{constant}$$

For compression, that's pretty straightforward: higher pressure forces higher density and temperature.

In the atmosphere, that balance still endures. But there can be warm highs, warm lows, cold highs, and cold lows, depending upon density distribution.

The formation of such areas of pressure extreme is intimately connected to the three-dimensional structure of the atmosphere ... atmospheric pressure is [basically] the weight of air above ... vertical motion is heavily driven by buoyancy [air's density compared to air around it] ... and forces at a distance induce air motion [wind is related to the gradient of pressure and other forces].

All of which is to say there are a lot of interactions which allow for a rich variety of pressure-temperature-density balances, the 3-dimensional structures of those systems, and the resulting wind, precipitation, etc. There's a whole focus of thermodynamics that looks at the variety of controls in processes which can lead to different results.

But in the end, that balance between ρ, P, and T in gases is what matters, and the factor you overlooked is that density and pressure are not the same thing. It may seem like how much pressure is exerted by\upon a gas is the same as how compressed the mass of air actually is... but it's not... how fast the molecules in the gas move (which is its temperature) is the third factor, and there are ways that any two can change, or all three change at the same time, but the overall balance remains.

• It may be best to think of volume as the third variable (as density = mass\volume, and unless gas is being added\lost from the area you are considering, density and volume are inverses of each other). Though either work. Nov 20, 2021 at 7:17

Compression and expansion of an ideal gas is an adiabatic process, i.e. the entropy $$\rm (P\rho^{-\gamma}) = const$$, where $$\gamma$$ is the adiabatic constant.
You can rearrange this using the ideal gas closure relation $$\rm P=\rho kT/\mu$$ to find $$\rm (T\rho^{1-\gamma}) = const.$$, which is essentially the statement you gave prior, that compressed gases are hotter (becasue $$\gamma>1$$ for realistic gases) if their entropy remains constant.

The air in the atmosphere however does not have constant entropy, and thus its $$T(\rho)$$-behaviour is different from the adiabatic one. Instead, it follows a force-balance, i.e. the hydrostatic law $$\partial P/\partial r = -g(r) \rho(r)$$ and $$g(r) = -GM/r^2$$. The resulting density structure from this is $$\rho(r) = \rho_0 \times \exp(-H(\frac{1}{r}-\frac{1}{r_0}))$$ with the atmospheric density scale height $$H=kT/GM \mu$$ and 0-index quantities denote density and radius on the surface.
Now we just have to relate $$\rho_0$$ to other, known quantities, which we can do when assuming that the entirety of the atmospheric mass $$\rm M_{atmo}$$ is contained in one scale height of the atmosphere, then we get $$\rm M_{atmo} = 4\pi \rho_0 H R_0^2$$.
One immediately sees that $$\rm \rho_0 \sim 1/H \sim 1/T$$. This shows that for a colder atmosphere (smaller H), the density on the ground must be larger, when following the force balance instead of entropy conservation.

Short, less-mathy summary:

Compressed gas naturally heats up. If no exchange of heat with the environment occurs, then after some time we can expand the gas, to cool it back to its exact same initial temperature.
This is called an adiabatic process, kind of a central vocabulary from thermodynamics.

Now if we allow for a process to be diabatic, i.e. we allow for the gas to exchange energy with the environment, then it's temperature cannot be set by the adiabatic condition. Instead, we must look to what else is acting on the gas.
A planet's atmosphere is kept by its gravity, and it is the gravitational energy which sets a different behaviour: In a gravitational field, a cold gas volume must be a compressed compressed one, because it does not have enough pressure to resist gravity. Hot gas can expand far up the gravity well of a planet.

This is a bit simplified, as one can of course also have an adiabatic gas in a gravitational field, but I would only go there in this answer, if there is interest.