Gas in a cylinder-piston device expands from state 1 $(p_1, V_1, T_1)$ to state 2 $(p_2, V_2, T_2)$. The expansion process is polytropic, i.e., $pV^n = \text{constant}$, $n \neq 1$. Assuming the ideal gas behaviour, the expression for the work done, $W$, by the system is given by: