Work done by isothermal expansion from two different viewpoints

Consider an adiabatic system as follows. It consists of a gas in a container and a piston. Initially, the system is at equilibrium and the gas inside it occupies a volume $V_i$ at a pressure $p_i$ which is equal to the outside pressure. Suddenly, the outside pressure changes and reduces to $p_{atm}$. The piston moves to equalize the pressure and the gas expands isothermally to obtain equilibrium. The gas now occupies a volume $V_f$ at a pressure of $p_f$ which is equal to $p_{atm}$

Now, two textbooks I have define the work done from two different viewpoints.

1: From the viewpoints of the surroundings:

The work done on the system by the surroundings equals $-p_{atm}\Delta V$. Since $p_{atm}$ is pretty much constant for the whole of the whole of the process, we can say that the work done equals:

$$W_1 = -p_{atm}(V_f - V_i)\tag1$$

2: From the viewpoint of the system:

We can write the internal pressure of the system as a function of its volume: $p_{in}(V)$. As during the expansion, the internal pressure changes, the work done by the system equals

$$W_2 = \int_{V_i}^{V_f}p_{in}(V)dV$$

Now, I don't know which definition to use. The work is done by the system (from definition 2) is done on the surroundings. But what about the negative work that the surroundings did on the system? Where did that energy go? Maybe, the two definitions express the same thing: the work done by the system. The negative sign in definition 1 signifies that the work is done by the system. But that would mean that

$$W_1 = W_2$$

We can simplify $W_2$ as follows. Clearly,

$$p_{in}(V) = \frac{p_iV_i}{V}$$

$$W_2 = \int_{V_i}^{V_f}\frac{p_iV_i}{V}dV = p_iV_i \ln{\frac{V_f}{V_i}} \tag2$$

The internal pressure when the volume is equal to $V_f$ is $p_{atm}$

$$\implies p_{atm} = p_{in}(V_f) = \frac{p_iV_i}{V_f}$$

$$\implies V_f = \frac{p_iV_i}{p_{atm}}$$

Putting this into $(1), (2)$ gives us,

$$W_2 = p_iV_i\ln{\frac{p_{i}}{p_{atm}}}$$

$$W_1 = -p_{atm}\left(\frac{p_iV_i}{p_{atm}} - V_i\right) = -V_i(p_{atm} - p_i)$$

Consider some values. Let $p_i = 5 \ \rm{Pa}, V_i = 1 \ \rm{m^3}, p_{atm} = 1 \ \rm{Pa}$.

$$W_1 = -1\cdot(1-5) = 4$$

$$W_2 = 1\cdot1\cdot\ln{\frac{5}{1}} = 1.609$$

Where am I making a mistake?

• When your system is adiabatic the gas in the container will expand isentropically rather than isothermally, if no friction is involved. – Mirc Breitschuh Mar 13 '14 at 9:37

However, in practice the piston probably won't move so rapidly that you can't define the pressure at all. Instead, the system will lose energy equal to $W_2$ (to a good approximation), and the environment will gain energy equal to $W_1$. The difference between the two will be found in the piston plug itself, in the form of kinetic energy.
The end result is that, after the piston has stopped oscillating, the piston has done an amount of work $W_1$ on the surroundings, but it has also given off an amount of heat equal to $W_2 - W_1$, and therefore its internal energy has changed by $W_2$.
• Nathaniel has the right answer! I only add to this that in general one can always say for any process that $dU=\delta Q + \delta W = TdS-pdV$. Here $U,T,S,p,V$ are the state variables of the system and $\delta Q, \delta W$ are the externally imparted heat transfer and work on the system. The equality holds always but only in a reversible process it is true that $\delta Q=TdS$ and $\delta W = -pdV$. When instead the process is irreversible one has $\delta Q < TdS$ and $\delta W > -pdV$. The difference $\delta W+pdV>0$ is the internally dissipated energy. – hyportnex Mar 13 '14 at 13:57
After some thinking, I got the answer. When you decrease the ambient pressure from $p_i$ to $p_{atm}$ , the system goes out of equilibrium, and so the expansion of the gas is not quasi-static. So, all the state variables like pressure and volume aren't defined. So we can't use them for calculating the work done in definition 2.