Take into account that the first law of thermodynamics can be written as follow:
U = Q - W
where U is the internal energy, Q the heat and W the work (in the previous expression these variables represents changes in internal energy, heat, etc). In the given procees there is no change in the internal energy, then, you have:
0 = Q - W
Q = W
That is, the change in heat gas is given by the work done over the gas.
The work done for an isothermal process (the tempetature is constant at 500K) is given by:
![W=n\cdot R\cdot T\cdot ln((P_1)/(P_2))](https://img.qammunity.org/2023/formulas/physics/college/1df8cz0ifecw5aquy4af8nabhmgi4l631z.png)
where,
n: number of moles = 40 mol
T: temperature = 500K
P1: initial pressure = 7 Pa
P2: final pressure = 3 Pa
R: ideal gas constant = 8.314 J/(mol*K)
Replace the previous values into the formula for W ans simplify:
![\begin{gathered} W=(40mol)(8.314(J)/(mol\cdot K))(500K)\ln ((7Pa)/(3Pa)) \\ W=(40mol)(8.314(J)/(mol\cdot K))(500K)\lbrack\ln (7Pa)-\ln (3Pa)\rbrack \\ W\approx1.41\cdot10^5J \end{gathered}](https://img.qammunity.org/2023/formulas/physics/college/44xdtynxl1yu2fs8164puzsmy9znc7vbrz.png)
The work done is also the change in heat, the gas experience a change of approximately 1.41*10^5 J in heat.