A block is suspended by a spring initially in natural length l0. Take initial position of block as zero reference level for gravitational potential energy of block. The block is released from rest at its initial position. Now as the block comes down till the maximum downward displacement for the first time, the sum of the elastic potential energy of the spring and the gravitational potential energy of the block: