Work done by the spring on the body as it is compressed or stretched by x from natural length.
Class 11Class JEE
Derivation
Setup
A spring of spring constant k is attached to a wall. A body is attached to the free end. The natural (unstretched) length position is x=0.
When the body is displaced by x from the natural length (either stretched or compressed), the spring exerts a restoring force:
Fspring=−kx
The negative sign means the force always opposes the displacement — it pulls back when stretched, pushes back when compressed.
Derivation
Work done by the spring force as the body moves from x=0 to x=x0:
Wspring=∫0x0Fspringdx=∫0x0(−kx)dx
Wspring=−k⋅2x20x0=−21kx02
Wspring=−21kx2
Why the work is negative
As the body moves away from equilibrium (stretching or compressing the spring), the spring force opposes this motion. Force and displacement are in opposite directions — negative work.
The spring takes energy from the body and stores it as elastic potential energy.
If ∣x2∣>∣x1∣: spring does negative work (stores energy)
If ∣x2∣<∣x1∣: spring does positive work (releases energy)
Work done when spring returns to natural length
If body is released from x=x0 and returns to x=0:
Wspring=21k(x02−0)=21kx02
Positive — the spring releases all the stored energy back to the body. This is why springs are useful as energy storage devices.
Connection to elastic potential energy
The elastic potential energy stored in a spring at extension x:
U=21kx2
Work done by spring = decrease in elastic PE:
Wspring=−ΔU=−(Uf−Ui)=21kxi2−21kxf2
Consistent with the general formula above.
Remember
Work done by the spring on the body and work done by external agent on the spring are equal and opposite. To stretch a spring by $x$, an external agent must do work $+\frac{1}{2}kx^2$ (positive — agent puts energy in). The spring does work $-\frac{1}{2}kx^2$ on the body (negative — takes energy from body).