Definition of $PV$ work A balloon contains gas with pressure $P_1$, volume $V_1$. It is connected to a container with vacuum with volume $V_2$, and the gas is released into the vacuum. What is the work done by the gas and the heat change of the system?
By conventional wisdom, the gas does not need to do any work against the vacuum to enter the container, so the work done is obviously $0$. But looking at it as $W=\int_{V_i}^{V_f}PdV$(in which the $W$ here is defined as the work done by the system on the surroundings), does that mean that the $P$ here in the integral is defined as the pressure exerted by the surroundings on the system? That doesn't seem to fit with wikipedia's definition, which says "$P$ denotes the pressure inside the system, that it exerts on the moving wall that transmits force to the surroundings"
To sum it up, my question is, does the $P$ in $W=\int_{V_i}^{V_f}PdV$ represent pressure of system on surroundings, or surroundings on system?
 A: According to Newton's 3rd law, the magnitude of the force per unit area exerted by the surroundings on the system is equal to the magnitude of the force per unit area exerted by the system on the surroundings.  In a reversible process, the force per unit area exerted by the system on the surroundings is equal to the pressure calculated from the ideal gas law (or other equation of state).  But, for an irreversible process, it is not, because the ideal gas law applies only to equilibrium states of the system.  In an irreversible process, the force per unit area exerted by the system on the surroundings is a combination of the ideal gas pressure plus a contribution from viscous stresses.  However, this is still equal to the external pressure of the surroundings.
In the present example, no work is done on the vacuum end of the gas.  But work is done by the air outside the balloon in pushing air into the chamber.  If we neglect the pressure difference across the balloon membrane, this work is equal to the outside air pressure times the change in volume of the balloon (assuming that the amount of air that enters the balloon is not sufficient to deplete the volume of the balloon when the pressure in the chamber matches the outside air pressure).
