(N/A) Consider a cylinder containing one mole of an ideal gas fitted with a frictionless piston. The initial volume of the gas is $V_{i}$ and the internal pressure is $p$. Let the external pressure be $p_{ex}$,where $p_{ex} > p$.
The piston is moved inward until the internal pressure becomes equal to $p_{ex}$. Let the final volume be $V_{f}$. During this compression,suppose the piston moves a distance $l$,and the cross-sectional area of the piston is $A$.
Volume change $= l \times A = \Delta V = (V_{f} - V_{i}) \quad \ldots (i)$
Force on the piston $= p_{ex} \cdot A$
If $w$ is the work done on the system by the movement of the piston,then:
$w = \text{force} \times \text{distance} = p_{ex} \cdot A \cdot l$
Since the change in volume is a compression,$l \cdot A = -(V_{f} - V_{i}) = -\Delta V$.
Therefore,$w = p_{ex} \cdot (- \Delta V) = -p_{ex}(V_{f} - V_{i})$.