What happens to the temperature of a gas when it is compressed?
According to the ideal gas law the pressure P, volume V, amount of substance n and temperature of a gas are related as P*V = n*R*T, where R is a universal constant.
As a gas is compressed, work is being done on the gas. The result of the work is first a decrease in its volume with the temperature not being affected. Once the gas has reached a volume where it cannot be compressed further into a smaller volume, we have the parameters V, n and R in the equation taking on constant values. This reduces the equation to P = k*T. Now temperature is directly proportional to the pressure.
As the gas is compressed, the work put into the system goes to increasing the temperature of the gas.
Richard Feynman described it nicely. Put your finger over the hole at the end of a bike pump and push the handle in. This forces a piston (the sliding disc inside that traps the air and squashes it) to compress the air. Air particles are constantly moving and when they bounce off a stationary wall they have the same speed as before. If the wall is moving towards the particles (like when the piston is pushed in) they bounce off with a slightly greater speed than they had before. If you make particles move faster you have increased their temperature.
the temperature rises
To solve we must examine the ideal gas law, PV=NRT where P is pressure, V is volume, N is the number of moles in the gas, R is your boltzman constant, and T is your temperature.
N and R are automatically assumed constant. We are going to fix volume as a constant. Then all that is left to change is pressure and temperatue. Due to the constants, we can ignore V, N, and R hence P is in an equal relationship with T.
This yields that as pressure increases, so does temperature for an ideal gas.