# Temperature of gases

I can't find any law that states this (maybe the combined gas law does and I'm misinterpreting it?), but Feynman said that if you compress a gas, the temperature increases. This makes sense, for example, a diesel engine (or gas engine with insufficient octane or too high a compression ratio). Also, must thinking about a piston "hitting" particles as it is compressed makes sense that energy is imparted.

But he goes on to say that when the gas expands, there is a decrease in temperature. This used to make more sense to me, but the more I think about it, it doesn't at all. Why would the particles lose energy if the container expands?

-
You should have a look at the ideal gas law: $pV=NRT$. If you decrease the volume $V$ but pressure $p$ and number of particles $N$ stay constant, the temperature $T$ must increase. And vice versa. – DaP Mar 21 '14 at 8:14
@DaPhil although this comment is reasonable, it does not answer the question in the sense that it provides an intuition. – Danu Mar 21 '14 at 8:21
@Danu You're right. I just wanted to give a hint into the right direction. That's why I just commented, and did not answered. – DaP Mar 21 '14 at 8:50

Just for completeness, when a gas expands its temperature does not necessarily change. The temperature of the gas only changes if it does work on something, for example its container as discussed in Danu's answer. If a gas is expanding into a vacuum it does no work and (to a first approximation) its temperature does not change. This type of expansion is known as a Joule expansion.

I used the qualifier to a first approximation above because the temperature is only guaranteed not to change if the gas is ideal. In real gases there are forces acting between the gas molecules and even in a Joule expansion the gas may do work against these forces and the kinetic energy of the gas molecules and therefore the temperature may change. This is known as the Joule-Thomson effect.

-

Consider a gas in a container. When the container expands, the gas cools down. The crux is in thinking about why the container expands. The reason the container expands is because there are gas particles hitting the walls, pushing them outward: they do work on the walls!

This work on the walls costs them some energy, so that they now have less kinetic energy. The average kinetic energy is proportional to the temperature, so when the kinetic energy goes down, so does the temperature. This, and much more, is all neatly summarized in the ideal gas law: $$PV=nRT$$ where $R$ is the universal gas constant, $n$ the number moles of particles, and $P$, $V$ and $T$ are the pressure, volume and temperature (in SI units).

-
thank you for the explanation and i can see with the equation why that is true. but in terms of the visualization, wouldn't a gas inside an expanded container hit walls less frequently than one in a smaller container because each particle would have a longer distance to travel before hitting anything else? – tau Mar 21 '14 at 15:28
Sure, but that doesn't change the fact that each collision that moves the walls costs the particle some energy. – Danu Mar 21 '14 at 16:06
okay, so the temperature change only applies if the gas is the thing expanding the container. but lets say you have a piston that you push up and down. when pushing it down, youre imparting extra energy onto the gas and that will raise the temperature. if you pull the piston back up though, the gas wont get any cooler than it would otherwise be in the ambient temperature. if you were to wait, however, and allow the gas to push the piston upwards, then the temperature would lower because some of that energy is used in pushing the piston up.thank you for taking the time to help me with this! – tau Mar 21 '14 at 17:57