Potential energy of spring: When a spring is compressed or elongated by a force F and the elongation or compression is x, then F x.

Or, F = kx [where k is the force constant of spring] ——-(i)

If F_{e} is the elastic force or restoring force applied by spring, then F_{e} = – kx [F_{e} is always towards the mean position].

Now the spring is further stretched through a distance dx, therefore the work done by the spring for further stretching is dw = -F_{e}.dx = F_{e}dxcos180^{0} = -F_{e}dx = -kxdx [using equation (i)]

Therefore the work done to stretched the spring through a distance x from its normal position(x = 0) is

W = dW = –kxdx = -k[] = – kx^{2} = potential energy of spring.

If spring is elongated from x_{i} to x_{f}, then work done by spring is w = – k( – ).