[Physics] If pressure is proportional to temperature, why aren’t compressed gases always hot

ideal-gaspressuretemperaturethermodynamics

When you compress a gas, say within a deodorant can, it temporarily heats up, but then cools to room temperature whilst in the can. It will then cool down to below room temperature once decompressed.

It seems like the gas equation doesn't apply when the gas is cooling down within the can and the pressure remains the same. Does the equation only apply at the instant of compression? It does not apply to liquids, but exactly why does it apply to gases? Also, I have learnt that gases are harder to increase in temperature (require more heat) at high pressures. I can't fully understand why.

Also, can't this concept be used to create a perfect stirling engine? I mean if the gas within the can cools back down to exactly room temperature?

So the question in summary:

1) when and where does this gas law apply and show a proof explaining why

2) why are gases harder to increase in temperature at high pressure, does the same work vice versa?

3) could this in principal make a 100% efficient engine?

Best Answer

When you compress a gas into a deodorant can it does indeed heat up. Then if you let the can cool the pressure falls again. The pressure and temperature will remain related by (approximately) the ideal gas law:

$$ P = \frac{nR}{V}\,T $$

You say in your question:

It seems like the gas equation doesn't apply when the gas is cooling down within the can and the pressure remains the same. (my emphasis)

But the pressure doesn't remain the same while the can is cooling.

For completeness we should note that in real deodorant cans the gas used liquifies under pressure so the behaviour is more complicated than a simple ideal gas.