The force due to a stretched spring (Hooke's Law) is:
F = kx
Use the given data point (32 cm, 20 N) to find the value of the constant k:
20 N = k(32-22)
20 N = k*10
2 = k
Work is given by:
dW = F*dx = 2x dx
To find the work done is stretching the spring 5 cm (27 cm - 22 cm = 5 cm):
5
W = ∫ 2x dx
0
5
W = x2 | = 52 - 02 = 25 N-m
0