I am confused about the minus signs in potential and kinetic energies For a basic problem consisting of a ball on a loaded spring that shoots into the air I get the following energy balance:
Then I get for a point of the ball in the air:
$$\Delta KE= W = - \Delta PE.$$
The ball starts at rest (zero kinetic energy), with potential energy equal to the amount that the spring is compressed.
At a certain point in air the energy of the ball is equal to the amount of kinetic energy and the potential energy of gravity.
At any point in time the $E_{total}$ has to remain constant:
$$E_{total} = KE + PE_{gravity} + PE_{spring}  $$
Where $$PE_{gravity} = - mgy $$
So at start:
$$E_{start} = \frac{1}{2}  mv_{start}^2  -mgy_{start} + \frac{1}{2} k \Delta y^2 $$
Where $v = 0$, $y_{start} \equiv 0$ $\Delta y$,  amount of spring compression.
$$E_{start} = \frac{1}{2}  m(0)^2 - mg(0) + \frac{1}{2} k \Delta y^2 = \frac{1}{2} k \Delta y^2 $$
$$E_{start} = \frac{1}{2} k \Delta y^2 $$
In the air:
$$E_{air} = \frac{1}{2}  mv^2 - mgy + \frac{1}{2} k 0^2 = \frac{1}{2} k \Delta y^2 $$
$$E_{air} = \frac{1}{2}  mv^2 - mgy $$
So $E_{air} = E_{start} $ if we ignore friction etcetera. So then I get:
$$E_{air} = E_{start} = \frac{1}{2}  mv^2 - mgy = \frac{1}{2} k \Delta y^2 $$
Is this reasoning right? I'm not using Work because I am using potential energies. I think I should not get a minus sign there for the potential energy of gravity.
However if I write the following I get wrong minus signs:
$$ \Delta KE= W = - \Delta PE $$
What should I actually plug in for $\Delta PE$? Like this:
$$ - \Delta PE = - (PE_{air} - PE_{start}) $$
$$  PE_{air} = -mgy + \frac{1}{2} k \Delta (0)^2 = -mgy  $$
$$  PE_{start} = -mg(0) + \frac{1}{2} k \Delta y^2 $$
$$ - \Delta PE = - (-mgy - \frac{1}{2} k \Delta y^2) = mgy + \frac{1}{2} k \Delta y^2  $$
Thus:
$$ \frac{1}{2}  mv^2 = mgy + \frac{1}{2} k \Delta y^2 $$
I have no clue where and if the minuses are correct. But I don't think my answer is right.
Hopefully someone can clearly enlighten me where I go wrong.
 A: TL;DR Your mistake is that you treat $y$ for gravitational and elastic potential energy separately. Although in case of gravitational potential energy you can arbitrarily choose the reference point, that is not the case for the spring. There are two requirements:

*

*If gravitational potential energy is defined as $U_g = mgy$ then positive $y$ direction must point upwards (away from Earth's center). You can set $y = 0$ wherever you want.

*If elastic potential energy is defined as $U_e = \frac{1}{2} kx^2$ then $x = 0$ must be at the position of the spring relaxed state. It does not matter where positive $x$ direction points.

Since in your example $y$ denotes both spring position for $U_e$ and height (altitude) for $U_g$, then you must define $y$ axis such that

*

*positive $y$ axis points upwards (away from Earth's center), and

*$y = 0$ is where the spring relaxed state is.

Therefore, you cannot say $y_\text{start} = 0$ in expression for gravitational potential energy if the spring was initially compressed! See below for full explanation.

The work-energy theorem in expanded form states that
$$K_1 + U_{g,1} + U_{e,1} + W_\text{other} = K_2 + U_{g,2} + U_{e,2} \tag 1$$
where $U_g = mgy$ is the gravitational potential energy, $U_e = \frac{1}{2} kx^2$ is the elastic potential energy, and $W_\text{other}$ is the work done by all other forces. Note that in case of gravitational potential energy you can define origin for $y$ wherever you want because the difference is the only thing that matters. However, in case of elastic potential energy, $x$ denotes elongation from the spring relaxed state.
The Eq. (1) can be written in a compact form as
$$\Delta K + \Delta U_g + \Delta U_e = W_\text{other} \tag 2$$
If there are no other forces involved (such as external forces, friction, buoyancy etc.), then the above equation becomes
$$\boxed{\Delta K + \Delta U_g + \Delta U_e = 0} \tag 3$$
which is also known as the Law of conservation of mechanical energy.

In your example you have a spring positioned vertically and an object with some mass, so you have to consider kinetic, gravitational potential and elastic potential energy. From Eq. (3) it follows
$$\boxed{K_1 + U_{g,1} + U_{e,1} = E = \text{const.}} \tag 4$$
where $E$ is the total mechanical energy which is constant in this case because there are no other forces that do work.
Let positive $y$ axis point upwards (away from Earth's center), and let $y$ denote elongation of the spring. When the spring is compressed the total mechanical energy is
$$\frac{1}{2} m 0^2 + \frac{1}{2} k y_1^2 + mg y_1 = E$$
where $y_1 < 0$ because spring is compressed! When the spring goes through "origin", all the mechanical energy is in the kinetic energy of the body
$$\frac{1}{2} m v_2^2 + \frac{1}{2} k 0^2 + mg(0) = E$$
When the spring reaches position $y = 0$, assuming the object is not "glued" to the spring, the object detaches and the spring stops moving giving all its energy to kinetic energy and gravitational potential energy. From these two equations you can calculate the launch speed
$$v_2^2 = \frac{k}{m} y_1^2 + 2 g y_1$$
From that point you need to consider only kinetic and gravitational potential energy. At some point all kinetic energy will get converted to the gravitational potential energy in which case we have
$$\frac{1}{2} m 0^2 + mg y_3 = E$$
and the maximum height $y_3$ above the spring is easily calculated as
$$y_3 = \frac{1}{2} \frac{k}{mg} y_1^2 + y_1$$
where $y_1 < 0$ denotes initial negative elongation (compression) of the spring.
A: If the object is going up, the increase in gravitational energy is +mgh, where h is measured from the starting position (with the spring compressed).
