To develop the problem it is necessary to apply the concepts related to Hooke's Law. For which it is understood that

Where,
k = Spring constant
x = Displacement of Spring
By the theorem of work we understand that it is the force realized when there is the path of an object therefore

Our value of F is

Integrating

Therefore the expresion is
