To what I can understand-in a piston cylinder arrangement, piston moves out due to net force experienced by piston due to difference between internal pressure of system and external pressure. So, the formula of work done by system on piston, should be
Work = $\int (P_{\rm int}-P_{\rm ext})\cdot{\rm area \,}\cdot dx$
then only we should be able to account for the net force acting on piston but then why do we define work as $\int P_{\rm ext} \cdot {\rm area} \cdot dx$?
To be clear, I understand the concept of reversible processes (where $P_{\rm ext}=P_{\rm int}$ as the system is undergoing a quasistatic process, so in such a case work $= \int P_{\rm int} \cdot dV $= $\int P_{\rm ext} \cdot dV)$ as well as irreversible processes (where work $=\int P_{\rm ext} \cdot dv$).
What I don't understand is why $P_{\rm ext}$ is used in the formula of work done instead of the pressure difference (i.e., $ P_{\rm int} - P_{\rm ext}$)?
Thanks.