The correct option is A −2.5 mJ
The spring force is the restoring force given by F=−kx and it will act in a direction opposite to the displacement of the point on the spring.
Therefore, work done by spring force,
Wspring=∫Fspringdx
Wspring=∫x0−kxdx=−12kx2
⇒W=−12×(50 N/m)×(0.01 m)2
Or, W=−2.5×10−3 J=−2.5 mJ
The force will be opposite to the displacement of the point of application, hence it is evident that work done by spring-force will be negative.
Alternative solution:–––––––––––––––––––––––
Spring force is a conservative force, hence we can write
Wspring=−ΔU
′U′ represents the spring potential energy
When spring was at its natural length, Ui=0
After compressing the spring through distance x,
Uf=12kx2
⇒Wspring=−(Uf−Ui)=−Uf
Or, Wspring=−12kx2
Or, Wspring=−12×(50 N/m)×(0.01 m)2
∴Wspring=−2.5×10−3 J=−2.5 mJ