How much work must you do to stretch the spring 0.030 m ? and how much work must you do to compress it 0.030m ?

Given:
The force constant of spring is
[tex]k\text{ =2.5}\times10^4\text{ N/m}[/tex]To find the work done when spring is stretched to 0.03 m and work done when compressed to 0.03 m.
Explanation:
The work done to stretch the spring will be
[tex]\begin{gathered} W\text{ =}\frac{1}{2}kx^2 \\ =\frac{1}{2}\times2.5\times10^4\times(0.03)^2 \\ =\text{ 11.25 J} \end{gathered}[/tex]The work done to compress the spring will be
[tex]\begin{gathered} W\text{ =-}\frac{1}{2}kx^2 \\ =-\frac{1}{2}\times2.5\times10^4\times(0.03)^2 \\ =-11.25\text{ J} \end{gathered}[/tex]