# Comparing work in thermodynamics with work done in mechanics

Let us the consider a gas as our system enclosed in a cylinder with piston.

1st case(Expansion of gas):

Here force on the piston is exerted by the gas in upward direction and during expansion piston moves up. So, the work done here is positive(force and displacement in same direction). Also the relation W=PΔV (with their usual meanings) also satisfies the "positive" sense of work, since the volume increases during expansion.

2nd case(Compression of gas):

Here, the surrounding exerts the force on the piston and compresses the gas. Since, the direction of force by surrounding on the system and displacement of piston(both downwards) are in same direction, should not the work done by the surrounding on the system should be positive? But, W=PΔV gives -ve work, since volume decreases during compression. Why does the mechanical concept of work and W=PΔV does not give same result?

(In Physics)We are usually told that work done by the system is positive and work done by the surrounding on the system is negative. But 2nd picture shows exactly what I am confused with. During compression, it is the gas that does negative work not the surrounding does the work in the gas?

1st picture is screenshot of book University Physics. 2nd picture is from here.

Normally both results are the same for work but it is defined in another way as you wrote: $dw = -pdV$ so the work you can get by integration.
• This is just one man's opinion, but I wish the founders of thermodynamics had formulated the 1st Law as $\Delta U = W_{in} + Q_{in} - W_{out} -Q_{out}$, where everything on the right hand side of the equal sign has a positive sign. Terms that are non-existent would then drop and the equation would match the physical situation with no confusion on what sign work should have. – David White Aug 13 at 20:59