To solve this problem we need to use the equations related to Elastic Potential Energy, which allows us to know the Energy stored in a spring based on its elastic constant and its respective compression. By definition it is described as
![PE = (1)/(2)kx^2](https://img.qammunity.org/2020/formulas/physics/high-school/mlaeis5txtmjr8kx83bcaofvyb0ppjlkko.png)
Where,
k = Spring constant
x = Displacement
Our values are given as
As we do not know the spring constant but if the energy stored at the compression given then,
![PE = (1)/(2)kx^2](https://img.qammunity.org/2020/formulas/physics/high-school/mlaeis5txtmjr8kx83bcaofvyb0ppjlkko.png)
![20 = (1)/(2)k(0.08)^2](https://img.qammunity.org/2020/formulas/physics/college/gtvtav56zapj35mqpfar3gi7c8aizy78j7.png)
![k = 6250N/m](https://img.qammunity.org/2020/formulas/physics/college/hrarzreekh8l3x7qeei9k52e3mnqvnqw0y.png)
In the case of the second compression and understanding that the spring constant is intrinsic to the internal force of the spring, then
![x_2 = 0.12m](https://img.qammunity.org/2020/formulas/physics/college/phtci6dcl1z1z63m7u9j6oilmqzxfh2kl8.png)
Replacing,
![PE = (1)/(2)(6250)(0.12)^2](https://img.qammunity.org/2020/formulas/physics/college/u4lsiwnh5j6z30rljqgrppqwshwj4nrxiv.png)
![PE = 45J](https://img.qammunity.org/2020/formulas/physics/college/f30g4dv8tkl7qoqo8zlr3m0wjo29uic0bc.png)
Therefore the elastic potential energy in the spring at this elongation is 45J