What will happen to the potential energy of the spring when it is compressed or stretched?
The potential energy of spring:
Now the potential energy can be given by,
where,
x is the displacement from its mean position.
So the potential energy will increase with the increase in displacement (it may be compression or stretching).
Therefore, the potential energy of the spring will increase when it is compressed or stretched.