The change in entropy for both a reversible and irreversible process is using a reversible path involving an infinite series of thermal reservoirs. Work done in a reversible process is always equal to or greater than work done in a corresponding irreversible process. Therefore W_max int_ v_2 v_1 - dw.
R ideal gas constant.
It is given as WAB NkTln VB VA W A B NkT ln V B V A. Here why we are not considering internal pressure. Let the pressure of the gas be P which is equal to external atmospheric pressure P. Now if you consider n moles of ideal gas going from state 1 given by P 1 V 1 T 1 to state 2 given by P 2 V 2 T 2 then change in internal energy is.