In mechanics, work is done on an object when the force acting on it displaces the object. In thermodynamics, work done on a system can be estimated when the system's volume changes during any thermodynamic process.
Consider a gas confined to a cylinder fitted with a movable piston at one end. If the gas expands from volume V1 to volume V2, it exerts a force on the piston, such that the piston moves by a distance dr.
The work done by the gas on the piston can be expressed as
If p is the pressure acting on the face of the piston of area A, then the force acting on the piston is
Consequently, the work done can be expressed as
The change in the volume of the gas dV equals Adr. Therefore, the work done by the gas on the piston when it expands from volume V1 için V2 is expressed as
Here, the integral is only meaningful for a quasi-static process, which means a process that takes place in infinitesimally small steps, keeping the system at thermal equilibrium.
If the piston compresses the gas, the work is done on the gas, and hence conventionally, is considered negative.