This question came some time back in Stony Brooks exam. I have the solution also. But i am having some conceptual doubts. Can someone help me please. The question is: Consider ‘n’ moles of an ideal monoatomic gas placed in a vertical cylinder. The top of the cylinder is closed by a piston of mass M and cross section A. Initially the piston is fixed, and the gas has volume Vo and temperature To. Next, the piston is released, and after several oscillations (due o gravity) comes to a stop. Disregarding friction and the heat capacity of the piston and cylinder, find the temperature and volume of the gas at equilibrium. The system is thermally isolated, and the pressure outside the cylinder is P. Here i just want to know if the work done by the external agent.. (i.e. Mg & P.A).. can be taken same as work done by the gas inside the cylinder.