(a) The spring force Fs=−kx is proportional to the extension and acts opposite to it. Its graph against x is a straight line through the origin with slope −k, lying below the x-axis for x>0.
The work done by a variable force is the area under its F–x graph. From x=0 to x=xm this area is a triangle with base xm and height kxm, lying on the negative side of the force axis:
Ws=−21×xm×kxm=−21kxm2
The same result follows from integration:
Ws=∫0xmFsdx=∫0xm(−kx)dx=−21kxm2
So Ws=−21kxm2. It is negative because the spring force points opposite to the stretching displacement at every point.

(b) On the return from xm to 0 the displacement is towards the natural length, the same direction as the spring force, so the spring force does positive work:
Wreturn=∫xm0(−kx)dx=+21kxm2
Over the whole cycle:
Wcycle=−21kxm2+21kxm2=0
The total work done by the spring force over the closed cycle is zero. More generally, between any two extensions xi and xf the work is Ws=−21k(xf2−xi2), which depends only on the end points. Hence the spring force is a conservative force, and a potential energy V(x)=21kx2 can be defined for it.
(c) The energy stored in a spring stretched by x is U=21kx2. When the stretching force F is given, x=F/k, so
U=21k(kF)2=2kF2
(i) Same force, F=40 N:
U1=2k1F2=2×200402=4 JU2=2k2F2=2×800402=1 J
(The extensions are x1=40/200=0.20 m and x2=40/800=0.05 m.)
The softer spring (k1=200 N m−1) stores more energy, 4 J against 1 J. For the same force U∝1/k: the softer spring stretches more, so the same force acts over a larger distance and does more work.
(ii) Same extension, x=0.10 m:
U1=21×200×(0.10)2=1 JU2=21×800×(0.10)2=4 J
The stiffer spring (k2=800 N m−1) stores more energy, 4 J against 1 J. For the same extension U∝k: the stiffer spring needs a larger force at every point of the stretch, so more work is done on it.