# Conservation of energy on a spring. When are forces positive and negative?

I'm doing physics problems on my own and I cannot figure out when Potential Energies (U) are supposed to be positive and when negative in a Conservation of Energies problem.

Take for example this one. You have a vertical string stretched downwards by a weight with a mass M. Someone launches a pellet with a mass m at it that causes it to compress.

So, if you were to whip up an equation of Conservation of Energy at point (1) when the pellet hits the weight and point (2) when the spring is at maximum compression, you would have something like this:

K_1 + U_s1 + U_g1 = K_2 + U_s2 + U_g2

Now my question is, which of those would be positive and which negative, if we place the origin of the coordinate system at the point when the spring is in equilibrium?

Now we know that if force has a component in the same direction as the displacement of the object, the force is doing positive work; and if the force has a component in the direction opposite to the displacement, the force does negative work.

So, at both points (1) and (2) the gravitational potential energy (U_g1 and U_g2) should be negative right? Because the pellet is causing the weight to move in the opposite direction. What about the spring potential energy?

• Rephrased it as requested – user8814 Nov 13 '18 at 15:14

Taking the zero of elastic potential energy to be when the spring is unextended, $$x=0$$, the elastic potential energy is $$U_{\rm spring}=\frac 12 k\, x^2$$ where $$k$$ is the spring constant and $$x$$ is the extension or compression of the spring.
You will note that both $$k$$ and $$x^2$$ are positive quantities which means that the elastic potential energy is always positive whether the spring is extended ($$x$$ positive) or compressed ($$x$$ negative).
However the change in elastic potential energy of a spring can be either positive when $$x^2_{\rm final} > x^2_{\rm initial}$$ or negative when $$x^2_{\rm final} < x^2_{\rm initial}$$.
Gravitational potential energy $$U_{\rm gravitational}$$ does not have a distance squared term so it all depends where the zero of gravitational potential is.