# Work done by a gas in an isothermal system

Currently I am trying to improve my knowledge of thermodynamics and I have stumbled upon the following description of a thermodynamic system in which I don't fully understand the calculation:

A container with an ideal gas is given in which a piston with a certain weight resides and the movement of the piston is frictionless. The container is linked to a work reservoir and is surrounded by a thermostat with diathermic walls so that any influence of heat does not change the temperature. -> the system is isothermic

The first law states: $dU=\delta{Q}+\delta{W}=\delta{Q}-pdV=\left(\frac{\partial{U}}{\partial{T}}\right)dT +\left(\frac{\partial{U}}{\partial{V}}\right)dV$

Because the gas is an ideal gas:
$dU=\delta{Q}+\delta{W}=\delta{Q}-pdV=\left(\frac{\partial{U}}{\partial{T}}\right)dT$

For an isothermic process $dT=0$ and thus: $\delta{Q}=-\delta{W}$

Let the gas in the container have a pressure of $p_{1}$ and the piston exert a pressure of $p_{p}$ where $p_{1}\gg p_{p}$. Here follows my first question: Is it right to say that the system seeks equilibrium and thus the force exerted by the gas will change until it is the same as the force exerted on the piston leading to the same pressure? And how can one explain this behaviour?

The next question I have regards the work done by the system: The textbook from which I have this example states the the work done is given by: $W=\int_{V_1}^{V_2}{p_pdV}= p_p\cdot \left(V_2-V_1\right)$ I can't fully comprehend why the pressure used in this equation is the constant pressure exerted from the piston. Due to $dU=0$ we see that the state equation equals 0 and thus I would say that the way we obtain a change in the system does matter. I am somewhat fixated on the idea that the work done is the scalar product of the force exerted and the path on which the force takes effect. Hence I can't let go of the idea that if we split the container into say 100 parts in the first department there exists a force $F_1$ and thus a pressure $p_1$ which leads to a an energy $j_1$ and in the next department the same holds the truth for $F_2, p_2, j_2$ and as such I would add them. I know that it is wrong but I can't understand the other idea fully either.

In the irreversible expansion or compression that you are describing, the pressure of the gas within the cylinder is going to be non-uniform spatially (as you correctly concluded) and there will be viscous stresses (related to the rate at which the gas is deforming) contributing to the force per unit area on the piston. However, at the interface between the gas and the piston, the force per unit area exerted by the gas on the piston will be equal to the "pressure of the piston" $p_p$. So to determine the amount of work that the gas does on the piston (its surroundings), you can't use the ideal gas law for fluid on the gas side of the interface and you need to rely on knowledge of what is happening on the piston side of the interface. In this case, since the pressure being supplied by the piston is specified (and manually held constant), the work is $p_p\Delta V$.