On this figure we show a gas confined in a blue jar at two separate states. On the left, in State 1, the gas is at a higher pressure and occupies a smaller volume than in State 2, at the right. The states of the gas are indicated on the graph at the far right by the red numbers. To move from State 1 to State 2, we must change the conditions in the jar, either by heating the gas, or removing the small green weights, or physically changing the volume with the red piston. Thermodynamics helps us determine the amount of work and the amount of heat necessary to change the state of the gas.
Scientists define work to be the product of force acting through a distance.
For a gas, work is the product of the pressure and the volume during a change of volume. In general, during a change of state both the volume and the pressure change. The work is shown on the graph as the red shaded region for a change of state proceeding from State 1 to State 2 along the curved black line. We could, instead, hold the pressure constant and increase the volume by heating the gas using Charles' law . If we then remove the weights, holding a constant volume, we proceed on to State 2.