# Thermodynamics : Work Done by a Gas

Suppose in a piston in which there is a gas, the gas exerts pressure P on surroundings, whereas the surrounding exerts a pressure $P[ext]$ on the gas.

In order for the gas to expand, P must be greater than P[ext]. So far I understand. Suppose initially that $P>P[ext]$ and the gas expands until $P=P[ext]$ This is what I don't understand is that when you calculate the work done by the gas, you use the external pressure and not the gas pressure. This makes no sense to me. After all, if you calculate the work done on something, you should use the force or pressure applied on that object, or not the other way around, correct? So why do we use external pressure instead of internal pressure when calculating the work done by the gas?

• To expand on this, if the expansion is irreversible, there are also viscous stresses present within the gas that also affect the pressure at the piston, such that the force per unit area exerted by the gas on the piston face depends not only on the volume of gas but also on the rate of change of volume. So the ideal gas law couldn't be used even if the pressure and temperature were uniform (which they are not, as pjg pointed out). For a massless frictionless piston, the gas pressure at the piston face always matches $p_{ext}$, but the average gas pressure in the cylinder is higher. – Chet Miller Mar 19 '16 at 12:02