The equation for work is W = PdV and it is integrated and limits are the conditions of state 1 and state 2 If the gas is ideal and the expansion is isothermal, then P = nRT/V and the equation can be integrated with respect to V If the process is adiabatic, the equation P1V1^g = PV^g can be used to substitue P in terms of conditions of State 1.