Answer:
![Q_{in} = W_{out} = nRT ln (\frac{V_{2}}{V_{1}})](https://tex.z-dn.net/?f=Q_%7Bin%7D%20%3D%20W_%7Bout%7D%20%3D%20nRT%20ln%20%28%5Cfrac%7BV_%7B2%7D%7D%7BV_%7B1%7D%7D%29)
Explanation:
According to the first thermodynamic law, the energy must be conserved so:
![dQ = dU - dW](https://tex.z-dn.net/?f=dQ%20%3D%20dU%20-%20dW)
Where Q is the heat transmitted to the system, U is the internal energy and W is the work done by the system.
This equation can be solved by integration between an initial and a final state:
(1) ![\int\limits^1_2 {} \, dQ = \int\limits^1_2 {} \, dU - \int\limits^1_2 {} \, dW](https://tex.z-dn.net/?f=%5Cint%5Climits%5E1_2%20%7B%7D%20%5C%2C%20dQ%20%3D%20%5Cint%5Climits%5E1_2%20%7B%7D%20%5C%2C%20dU%20-%20%5Cint%5Climits%5E1_2%20%7B%7D%20%5C%2C%20dW)
As per work definition:
![dW = F*dr](https://tex.z-dn.net/?f=dW%20%3D%20F%2Adr)
For pressure the force F equials the pressure multiplied by the area of the piston, and considering dx as the displacement:
![dW = PA*dx](https://tex.z-dn.net/?f=dW%20%3D%20PA%2Adx)
Here A*dx equals the differential volume of the piston, and considering that any increment in volume is a work done by the system, the sign is negative, so:
![dW = - P*dV](https://tex.z-dn.net/?f=dW%20%3D%20-%20P%2AdV)
So the third integral in equation (1) is:
![\int\limits^1_2 {- P} \, dV](https://tex.z-dn.net/?f=%5Cint%5Climits%5E1_2%20%7B-%20P%7D%20%5C%2C%20dV)
Considering the gas as ideal, the pressure can be calculated as
, so:
![\int\limits^1_2 {- P} \, dV = \int\limits^1_2 {- \frac{n*R*T}{V}} \, dV](https://tex.z-dn.net/?f=%5Cint%5Climits%5E1_2%20%7B-%20P%7D%20%5C%2C%20dV%20%3D%20%5Cint%5Climits%5E1_2%20%7B-%20%5Cfrac%7Bn%2AR%2AT%7D%7BV%7D%7D%20%5C%2C%20dV)
In this particular case as the systems is closed and the temperature constant, n, R and T are constants:
![\int\limits^1_2 {- \frac{n*R*T}{V}} \, dV = -nRT \int\limits^1_2 {\frac{1}{V}} \, dV](https://tex.z-dn.net/?f=%5Cint%5Climits%5E1_2%20%7B-%20%5Cfrac%7Bn%2AR%2AT%7D%7BV%7D%7D%20%5C%2C%20dV%20%3D%20-nRT%20%5Cint%5Climits%5E1_2%20%7B%5Cfrac%7B1%7D%7BV%7D%7D%20%5C%2C%20dV)
Replacion this and solving equation (1) between state 1 and 2:
![\int\limits^1_2 {} \, dQ = \int\limits^1_2 {} \, dU + nRT \int\limits^1_2 {\frac{1}{V}} \, dV](https://tex.z-dn.net/?f=%5Cint%5Climits%5E1_2%20%7B%7D%20%5C%2C%20dQ%20%3D%20%5Cint%5Climits%5E1_2%20%7B%7D%20%5C%2C%20dU%20%2B%20nRT%20%5Cint%5Climits%5E1_2%20%7B%5Cfrac%7B1%7D%7BV%7D%7D%20%5C%2C%20dV)
![Q_{2} - Q_{1} = U_{2} - U_{1} + nRT(ln V_{2} - ln V_{1})](https://tex.z-dn.net/?f=Q_%7B2%7D%20-%20Q_%7B1%7D%20%3D%20U_%7B2%7D%20-%20U_%7B1%7D%20%2B%20nRT%28ln%20V_%7B2%7D%20-%20ln%20V_%7B1%7D%29)
![Q_{2} - Q_{1} = U_{2} - U_{1} + nRT ln \frac{V_{2}}{V_{1}}](https://tex.z-dn.net/?f=Q_%7B2%7D%20-%20Q_%7B1%7D%20%3D%20U_%7B2%7D%20-%20U_%7B1%7D%20%2B%20nRT%20ln%20%5Cfrac%7BV_%7B2%7D%7D%7BV_%7B1%7D%7D)
The internal energy depends only on the temperature of the gas, so there is no internal energy change
, so the heat exchanged to the system equals the work done by the system:
![Q_{in} = W_{out} = nRT ln (\frac{V_{2}}{V_{1}})](https://tex.z-dn.net/?f=Q_%7Bin%7D%20%3D%20W_%7Bout%7D%20%3D%20nRT%20ln%20%28%5Cfrac%7BV_%7B2%7D%7D%7BV_%7B1%7D%7D%29)