The force exerted by a one-dimensional spring, fixed at one end, is F=-kx, where x is the displacement of the other end from its equilibrium position. Assuming that this force is conservative (which it is) show that the corresponding potential energy is U=1/2kx^2, if we choose U to be zero at the equilibrium position. (b) Suppose that this spring is hung vertically from the ceiling with m suspended from the other end and constrained to move in the vertical direction only. Find the extension x0 of the new Equilibrium position with the suspended mass. Show that the total potential energy (spring plus gravity) has the same form 1/2ky^2 if we use the coordinate y equal to the displacement measured from the new equilibrium position at x=x0 (and redefine our reference point so that U=0 at y=0).
This solution calculates the potential energy of the spring using the extension and spring constant, it also calculates the extension of the new equilibrium position by taking into account the effects of gravity.