It took me a while to get my head around the whole "If P*V is constant, how does compressing it add energy?". Thing is, it doesn't add energy to the air. The air still has the same amount of energy in it, but the thing is, you've created a "pressure gradient" for it to flow across, and when you talk about the "energy in the chamber", you talk about the amount of energy that can flow across that gradient.
Arg, it does add energy to the air. Energy is the capacity to do work. The gas in that piston cylinder arrangement has the capacity to do (approximately) the same amount of work that you put into it when you are compressing it. After you push in the cylinder it can apply a force over a distance and get back to its original state, so it MUST have more energy in its compressed state because it can do work and return to its original state.
Ragnarok wrote:The distance the piston needs to move will be the initial gas volume / piston area, and the force the piston needs to exert will be the integral of the pressure * piston area.
Because those are multiplied together, the area terms cancel.
As pressure * volume is a constant value here (assuming no leaks, and no heating), the integration can also be omitted.
And that simplifies down to pressure * volume again.
The work done is the integral of pressure times dV since you are summing the force times distance over tiny divisions of distance. So to pull a constant PV out of the integral you need to first multiply it by V/V. Then you can pull the PV out and you are left with PV*integral of dV/V which will give you an equation for work that is P1*V1*ln(V2/V1)
That is what you will find for the equation for isothermal compression work in a thermodynamics textbook. Of course that equation is the work done by the gas so it will be negative for compression.