Let there be a certain amount of gaseous substance kept in a cylinder fitted with a weightless & frictionless piston. The initial volume and pressure of the gas are $V_1$ & $P_1$ respectively. The gas initially exists in thermodynamic equilibrium state with the surroundings(piston) . That means the gas is in mechanical equilibrium with the pressure from the surroundings which,therefore,initially exerts pressure $P_1$ .Now to take the gas at state where volume is $V_2$, suddenly the external pressure is reduced to $P_2$ . Since $P_2 < P_1$ , therefore the gas will do work on the piston to again equalize the pressure. Now,the question is how much work is done by the gas?
Here, discrepancy arose between my thinking and my book. What I did to find the work done was simple: since at equilibrium ,the pressure was $P_1$, no work was done. Now, the external pressure is reduced to $P_2$ . Therefore a net pressure arises on the piston which is equal to $$P_1 - P_2$$ ,which will be exerted by the gas( since it exerts the same previous pressure $P_1$ on piston and the external surroundings now exert pressure $P_2$ on the piston . Therefore,the gas is exerting greater pressure by an amount $P_1 - P_2$ and that will do work ,right?) . Therefore, work done $$w = \int_{V_1}^{V_2} (P_1 - P_2)\, dV $$ . This was my deduction. But my book did it like that: $$ w = \int_{V_1}^{V_2} P_{\text{ext}} \, dV \implies \int_{V_1}^{V_2} P_2\, dV $$ . So, what is the problem with my approach? I couldn't understand my book's approach. Is mine wrong? If so, why? And why did the book do so? Plz help.