The force required to maintain a spring stretched by the length `Delta x` is determined by the formula
`F = 1/2 k(Deltax)` , where k is a constant depending on the properties of the spring and `Delta x = x_1 - x_0` .
`x_1 = 15 cm = 0.15 m` - the length of the streched spring
`x_2 = 12cm = 0.12 m` - the natural length of the spring.
Since the force is given, the constant k can be determined:
`Delta x = 0.15 - 0.12 = 0.03 m`
`30 N = 1/2 k (0.03)` m
From here `k = (2*30)/(0.03) = 2000 N/m` .
Now that k is known, the work done in stretching the spring can be determined.
The work is in the integral of the force applied to the spring over the length of the stretching (it has to be an integral rather then simply a product of force and distance, because the force applied depends on how much the spring is already stretched: `F = kDelta x` ).
Let F = kx, where x is the amount of stretching (when x = 0, the spring is not stretched, so the force is 0.) Then, the work will done to stretch the spring by 8 cm (from 12 cm to 20 cm) will be
`W = int_0 ^ 0.08 kxdx = kx^2/2 |_0 ^0.08 = k(0.08)^2/2`
Plugging in k = 2000 N/m, we get
`W = 2000*(0.08)^2/2 = 6.4 J`
The work done in stretching the spring from 12 cm to 20 cm is 6.4 Joules.