# Why do we use the external pressure to calculate the work done by gas

I read in a textbook that in the case when we have a gas in a cylinder fitted with a massless frictionless piston being held with an external pressure $$p_1$$, and when the pressure is reduced to become the value $$p_2$$, the gas pushes up against the piston and then the work done by the gas for a small change in volume is calculated by:

$$\mathrm dW=p_2\,\mathrm dV$$

Here, is what I don't conceptually understand. If the gas's molecules was under some pressure $$p_1$$ which is equal to the external pressure in the static state then after the external pressure became lower than the internal pressure, shouldn't the work done by the gas be the difference between the two pressures?

If the piston is frictonless and massless, then, if you do a force balance on the piston, you must have that the force per unit area that the gas exerts on the inside face of the piston will always be equal to the external force per unit area that one imposes on the outside face of the piston. The sudden drop in pressure on the outside face of the piston causes the gas to undergo an irreversible expansion. During an irreversible expansion, the local pressure within the cylinder becomes non-uniform, so that the average pressure of the gas differs from the force per unit area at the piston face. As a result, the ideal gas law (or other equation of state) cannot be applied globally to the gas in the cylinder. In addition, during an irreversible expansion, there are viscous stresses present in the gas that allow the force per unit area at the piston face to drop to the new lower value while requiring that force to match the external force on the outer face. So the work done by the gas on the piston is equal to the external force per unit area times the change in volume: $$W = \int{P_{ext}dV}$$ This equation is always satisfied, irrespective of whether the expansion is reversible or irreversible.

Consider a thought experiment; imagine playing your favourite sport competitively against someone. Imagine losing the game as time runs out (bleak scenario sorry). The work is what you actually put in to catch up. If they are good it becomes even harder to catch up. Winning is just how much better you were with your work ethic over theirs. Work is done against the external force. The external force is the resistance to which effort must be put in to overcome it. The external force is your opponents score that you must achieve. Achieving this is work. The resultant force or resultant pressure (internal minus external) merely causes an acceleration and tells you how much time it will take to achieve a particular distance change. If your internal pressure is much larger than your external pressure before equilibrium the faster it will take to reach your desired volume change due to a bigger acceleration. The resultant is just how much better you are over your opponent and this will show by the massive scoreline difference (acceleration) after the game. If the system is quasi-static the internal pressure is only infinitismally larger than the external pressure which means the resultant is infinitismally small which means the acceleration is really tiny, which means you were only slightly better than your opponent because the scoreline was almost tied. Your work, however, is still how much you had to put in to match your opponent therefore the work is based on the external pressure just as work against friction is based on the frictional force and work against an incline is based on the resisting forces of inclination because this is what you need to overcome. In free expansion a gas expands without an opposing external pressure. Even if the original internal gas pressure was 2 or 10 atm, the work is still zero because no opposing force is present. If your opponent doesn't show you cannot call it work. Work is a measure of how much hell someone gives you before you win. So you use their measure not yours. This is why we use external pressure. Resultant force doesn't indicate work, it indicates how easy or hard you overcame that work (or resistance) as measured by an acceleration. In ideal gas behaviour a piston is considered massless therefore resistance by inertia of the piston is Zero. The only resistance is therefore the external pressure and thus this is what you must work against.

The derivation of pressure-volume work is as follows, in reverse:

$W = P\Delta V$

$P = F/A$

$\Delta V = A\Delta d$

Subbing those last two into the first:

$W = (F/A) (A\Delta d)$

Or:

$W = F \Delta d$ which is the definition of work.

So, the work done by the gas in the cylinder is indeed independent of the outside pressure, it is a function of the force exerted by the gas and the displacement of the piston. But, the work done on the piston is different. It is the sum of the work done by the gas inside and that done by the gas outside. The gas outside is exerting a force inward while the distance moved by the piston is outward so that work is negative compared to the positive work done by the gas inside the cylinder. So the gretaer the difference between inside and outside pressure, the greater the net work done on the piston. But still, the work done by only the inside gas on the piston is a function of its pressure and the $\Delta V$.