<s>[INST] 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.
 [/INST] 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.
</s>