# Why are there two ways to solve for energy of a spring?

I can find the energy of a spring using $F = -kx$, or by using the formula $e = 1/2mv^2 + 1/2I\omega^2 + mgh + 1/2kx^2$. The first way, I get $mg/k = x$, but the second way, I get $2mg/k = x$. Which one is correct to use and why?

This is assuming that there is no angular velocity or linear velocity.

The first answer is correct, because if you let go of the spring and it doesn't move, it means the total force on it is zero, so $mg=kx$.
To understand why the second answer is incorrect, think about what happens when you start at $x=0$, where $e=0$, and let go of the spring. Suppose for now that mechanical energy is conserved like you did. The spring will start falling down and get stretched, until it reaches the point $x'$ that you wrote down with $v=0$. But then it will get pulled back up, and proceed to bob up and down. This shows that at $x'$ the total force is not zero -- otherwise the spring would not get pulled back up.
If there is no dissipative force (like friction with the air), energy will be conserved but the spring will continue this oscillatory motion and never stop. If there is some friction the spring will eventually come to a halt at the point $x$. But because some energy was converted to heat, you cannot use energy conservation the way you did to find this point.