College Board Problem: Conservation of Momentum -> Conservation of Energy in a Spring In my AP Physics C class today, we ran into a problem written by College Board whose answer we disputed. The problem is as such :

A block of mass $M=5.0 \ \mathrm{kg}$ is hanging at equilibrium from an ideal spring with spring constant $k=250 \ \mathrm{N/m}$.An identical block is launched up into the first block. The new block is moving with a speed of  $v=5.0 \ \mathrm{m/s}$ when it collides with and sticks to the original block. Calculate the maximum compression of the spring after the collision of the two blocks.

According to the College Board answer key, the answer is $0.5 \ \mathrm{m}$ :

$p_1=p_2$
$Mv_0=(M+M)v_2$
$v_2=\frac{1}{2}v_0= \left (\frac{1}{2} \right)\left (5.0 \frac{m}{s}\right)$
$v_2=2.5 \frac{m}{s}$
$K_1 + U_1=K_2+U_2$
$\frac{1}{2}mv_1^2 +0=0+\frac{1}{2}kx_2^2$
$x_2=\sqrt{\frac{m}{k}}v_1= \sqrt{\frac{(10 \ \mathrm{kg)}}{\left(250 \frac{N}{m}\right)}} \left(2.5 \frac{m}{n}\right)$
$x_2=0.50 \ \mathrm{m}=50 \ \mathrm{cm}$

However, half of us disputed this during class. We argued that, yes, $U_2$ includes $\frac{1}{2}kx^2$, but it also includes gravitational potential energy at the maximum compression (that is, when it compresses $x$ meters from equilibrium, the mass $M$ is $x$ meters higher above ground). Thus $K_1+U_1=K_2+U_2$ is $\frac{1}{2}mv^2+0=0+\frac{1}{2}kx^2+mgx$. When $mgx$ is included, $x$ is $0.24 \ \mathrm{m}$, not $0.5 \ \mathrm{m}$.
My physics teacher reluctantly agreed with College Board but could not give a solid explanation why. He said he would e-mail College Board, but in the meantime, I would very much appreciate any input from people who know the answer.
 A: I guess this is a homework/check-my-work problem, so by the letter of the law I should not answer, but I would argue there is broad interest in solving it correctly given that a supposedly reputable source is presenting an incorrect solution.

Here is how I would do this. Initially, the spring is stretched distance $d=mg/k$ below its equilibrium position. Choose the position of the hanging block as $y=0$, so the gravitational potential energy immediately after the collision is zero. In terms of the speed $v=v_0/2$ of the blocks after the collision and the mass $m$ of one block, the total energy immediately after the collision is
\begin{align}
E_i &= \frac{1}{2}(2m) v^2 + \frac{1}{2}kd^2\\
&= \frac{1}{4}mv_0^2 + \frac{1}{2}\frac{m^2g^2}{k}.
\end{align}
Let $h$ be the distance of the blocks above the equilibrium position of the spring when the blocks are at their maximum height. At this point, the blocks are at rest, so their total energy is
\begin{align}
E_f &= \frac{1}{2}kh^2 + 2mg(h + d)\\
&= \frac{1}{2}kh^2 + 2mgh + \frac{2m^2g^2}{k}.
\end{align}
Using conservation of energy,
\begin{align}
&\frac{1}{4}mv_0^2 + \frac{1}{2}\frac{m^2g^2}{k} = \frac{1}{2}kh^2 + mgh + \frac{2m^2g^2}{k}\\
\rightarrow &\frac{1}{2}kh^2 + 2mgh + \frac{3}{2}\frac{m^2g^2}{k} - \frac{1}{4}mv_0^2 = 0.
\end{align}
We can solve this quadratic equation for $h$ to obtain
\begin{align}
h = -\frac{2mg}{k} + \sqrt{\frac{m^2g^2}{k^2} + \frac{mv_0^2}{2k}}.
\end{align}
In terms of the given numbers, $v_0 = 5.0\,\text{m}/\text{s}$, $m=5.0\,\text{kg}$, and $k=250\,\text{N}/\text{m}$, we get $\boxed{h=15\,\text{cm}.}$
Note that if we set $g=0$ so that there is no gravity, we get
\begin{align}
h = \sqrt{\frac{mv_0^2}{2k}} = \boxed{50\,\text{cm}.}
\end{align}
We are left to conclude that the author of the solution was likely in free-fall at the time of its writing.
A: There is already a very good and complete answer from d_b, let me just add a comment to elucidate the possible (erroneous in this case) reasoning by which one could try to forget about gravity.
First, consider one block hanging from the spring in equilibrium. Assume that we provide it with the  vertical speed $v$ without any other block sticking to it, so it moves up alone. What height above the initial position will it reach in such a case? Writing energy conservation (for detailed explanation look at d_b's answer, it is quite the same here - only I choose to measure height relative to the initial position of the block for reasons which will become clear shortly), we get:
$$\frac{m v^2}{2} + \frac{m^2 g^2}{2 k} = m g h + \frac{k (h-\frac{mg}{k})^2}{2}$$
Let us play a little with this equation. Open the square in the RHS and observe that $mgh$ cancels:
$$m g h + \frac{k (h-\frac{mg}{k})^2}{2} = mgh + \frac{k(h^2 + \frac{m^2g^2}{k^2} - \frac{2mgh}{k})}{2} = \frac{kh^2}{2} + \frac{m^2 g^2}{2k}$$
Plugging it back to the energy conservation, we observe that $\frac{m^2 g^2}{2k}$ cancels as well, and we are left with
$$\frac{m v^2}{2} = \frac{kh^2}{2}$$
In other words, it looks exactly like we could forget about gravity and initial elongation of the spring altogether: the answer is the same as it would have been for a horizontal spring. This is not a coincidence: what we have derived means that the total (gravitational+elastic) potential energy of this system is quadratic in deviation from the equilibrium, so it really looks like for a horizontal spring. One could also understand it graphically: potential energy of the spring is a parabola with the equilibrium position at the lowest point. If we also add gravity, a linear function is added to this parabola. The result is another parabola with the same shape but another minimum position - at the equilibrium point of the hanging block (equilibrium is always the minimum of total potential energy). If we measure all elongations compared to the new equilibrium, we could forget about both gravity and initial elongation: they compensate each other.
I think this might have been the logic of authors of the solution. However, this logic only works if we measure elongations compared to the position with minimal potential energy. If another block sticks to the first one, the equilibrium position is now shifted below, so the blocks start moving already from a non-equilibrium position and one needs to account for the potential energy of initial position as well - which was not done in the provided College Board solution. As an exercise I would suggest an interested reader to reproduce d_b's answer with this method of total potential taking the above consideration into account.
A: With a 5 kg mass hanging at rest from the spring of constant k = 250 N/m, the stretch of the spring will be X = mg/k =5(9.8)/250 = 0.196 m.  With (x) measured positive down from the un-stretched position, and gravitational potential energy chosen to be zero when x = 0, then the energy of the 10 kg mass is (1/2)(10)$2.5^2$ + (1/2)(250)$0.196^2$ - 10(9.8)(0.196)  = (1/2)(250)$x^2$ -10(9.8)x. (x when v = 0) Or: 125$x^2$ - 98x – (31.25 +4.802 – 19.208) = 0.  Solving gives x = - 0.145 m. (The other solution is for initial velocity downward).  Since positive x was measured down, this negative x represents a compression of the spring above the unstretched position. Then the total rise is 0.196 + 0.145 = 0.341 m. For the record, if the moving mass is the same as the hanging mass: then mg = kX  and (1/2)m$v^2$ + (1/2)k$X^2$ - (kX)X = (1/2)k$x^2$ - (kX)x.   Or rearranged: (1/2)m$v^2$ = (1/2)k$(X^2 – 2Xx +  x^2) = (1/2)k(X-x)^2$. Lets try ignoring gravity with x measured from a 10 kg hanging position (which is an additional 0.196m further down):  (1/2)(10)$2.5^2$ + (1/2)(250)$0.196^2$ = (1/2)(250)$x^2$. Rearranging: 125$x^2$ = (31.25 + 4.802) Giving x = 0.537. With the starting position 0.196 m above the new equilibrium, this gives a rise of 0.341 m. The bottom line: A mass hanging from a spring defines a new equilibrium position. The kx measured from that position includes the force of gravity (but don't change the mass).
Here is an alternative approach:  With the stretch of the spring (x) measured positive down from the unstretched position, the net force on the hanging mass is: F = mg - kx  Then dF = - k(dx). Integrating both sides gives F(x) - $F_o$ = -k(x - $x_o$).  If starting from the new equilbrium then $F_o$ =0.
