Discrepancy in general work and pressure-volume work Consider a massless, frictionless piston fit into an airtight container containing an ideal gas. And let us say that the gas undergoes quasi-static isothermal expansion by lowering the pressure applied by the piston slowly.
The piston moves a distance, say $dr$ in an instant in which the force applied on it by the gas is $F$. So, the work done on it by the gas should be $\delta W=Fdr$.
Now, my textbook states that work done on the gas by the piston should be equal to the negative of the work done on the piston by the gas, saying that it is a consequence of Newton's third law of motion.
The problem is, according to Newton's third law of motion, the mutual forces of interaction between the gas particles and the piston should be equal and opposite to one another. But for the corresponding work done to be negative of one another, each gas particle must be displaced in the opposite direction with same displacement $dr$, which is not necessarily true. So, how come does this hold true?
EDIT: Can anyone prove it mathematically that work done on the gas by the piston should be equal to the negative of the work done on the piston by the gas?
 A: Work done is defined as $dW = \vec{F}.d\vec{r}$. Force on the piston is in direction of it's displacement, so according to definition of work done it will be positive. On the other hand, force on gas is opposite to the displacement of gas, so work done on gas comes out to be negative due to the $cos(\theta)$ term.
For proving that work done by piston on gas should be equal to negative of the work done by gas on piston, you can use work-energy theorem. The theorem states that for all forces net work done on the system should be equal to total change in kinetic energy of the system. 
To apply the theorem, for simplicity choose your initial and final states when the piston is at rest and for gas we can assume average velocity is zero at these two states. Now change in kinetic energy is zero which is equal to net work done by the forces. Net work done is summation of work done on piston plus net work done on gas. So this proves work done on gas is negative of the work done on piston. Mathematically,
$\Delta KE = WD_{pg} + WD_{gp}$
Since $\Delta KE=0$
$WD_{pg} = -WD_{gp}$
A: 
But for the corresponding work done to be negative of one another, the each gas particle must be displaced in the opposite direction with same direction dr, which is not necessarily true.

I think I see where you're coming from. The piston is gaining energy (i.e. work done on the piston), because it is moving in the same direction as the force being applied to it (i.e. both are down). The gas molecules are losing energy (i.e. work is being done by them), because they are 'moving' in the opposite direction to the force being applied to them - the force acting from the piston on them is up, but they are 'moving' down.
However, I put 'moving' in inverted commas there because to picture the gas molecules as 'moving down' is a bit simplistic. Each molecule of the gas does not need to be displaced by $dr$. Consider that there are billions (trillions?) of gas molecules impacting on the piston every second. As the piston is retreating, it is taking a very small amount of momentum from each molecule, as they strike the moving piston. Thus, the energy (work) is being taken from the gas over the course of billions of molecule collisions.
Newton's Third Law still holds during each collision - during the contact, each molecule will experience an equal and opposite force to that which it exerts on the piston. However, during a collision, it is probably more useful to think in terms of a momentum transfer, rather than a balance of forces - Newton's Second Law can be written as 'force equals rate of change of momentum'.
