In this example (see here) we saw that the work done by an ideal 
gas during isothermal expansion could be zero (for free expansion into a vacuum) or non-zero 
(for expansion against a force). In the first case the process is non-reversible.  
We now see that in the second case, if the process is reversible, the work done by the gas on the 
surroundings  will be 
The reversible process extracts the maximum work from the gas, as no work is lost overcoming friction or
creating sound waves.  In a non-reversible process, these are both mechanisms which convert energy which could have 
gone into work  into internal energy of the gas instead, and so the gas will  
need to extract less heat from the surroundings.  Thus 
 will still hold.