To either increase or decrease the length of a spring from its equilibrium length work has to be done on the spring. The work done is stored as potential energy in the spring and when the spring is let free it regains its equilibrium length.
The force that has to be applied to change the length of a spring is dependent on the change in length. It is equal to F = -k*x, where x is the change in length. The negative sign indicates a restoring force.
Work is force*distance. If the spring has been extended by x, the work to be done to intend the length further by an infinitesimal length dx is dW = k*x dx
Here the spring constant is 500 N/m and the spring is extended by 20 cm. The work done is the definite integral Int[500*x dx], x= 0 to x = 0.20
=> 500*x^2/2, x = 0 to x = 0.2
=> 10 J
The energy stored in the spring when it is stretched 20 cm is 10 J
We'll recall the formula of the potential energy of a spring:
E = k*x^2/2
Since we know the spring constant k and the maximum stretch x, we can calculate the stored potential energy of the spring.
But before start calculating, we must convert the cm into m => x = 20 cm = 0.2 m.
Now, we'll calculate the energy:
E = 500*(0.2)^2/2
E = 0.5*0.04*500
E = 10 Joules
Therefore, the energy stored in the spring is of 10 Joules.