For a rope obeying Hooke's law show that the elastic potential energy stored in the rope is given by

E=1/2kx^2

where k is the elastic spring constant and x is the extension.