I am stuck in a question where energy conservation is failing and momentum conservation is correct. I think I might be doing something wrong, that's why I'm asking this question.
The problem is as follows:
A bullet of mass $25\,g$ is fired horizontally into a ballistic pendulum of mass $5.0\,kg$ and gets embedded in it. If the centre of pendulum rises by a distance of $10\,cm$, find the speed of the bullet.
(H.C. Verma, Centre of Mass, Q47)
Let the mass of the bullet be $m=25\,g$.
Let the mass of the pendulum be $M=5\,kg$.
Let the peak height be $h=0.1\,m$.
Let the initial and final velocities be $u$ and $v$ respectively.
Method 1: (Momentum Conservation)
$$mu=(M+m)v \implies v=\frac{mu}{M+m}\\ \text{Also, }\frac{1}{2}(M+m)v^2=(M+m)gh\\ \implies u^2=2\biggl(\frac{M+m}{m}\biggr)^2gh\\ \implies u=201\sqrt2 \text{ m/s}$$
Method 2: (Energy Conservation)
Since both the masses move together after the collision, and because the velocity at highest point is null, therefore: $$\frac{1}{2}mu^2=\frac{1}{2}(M+m)v^2=(M+m)gh\\ \implies u^2=2gh\biggl(\frac{M+m}{m}\biggr) \implies u=\sqrt{402}$$
To summarize myself, I am curious about the following:
Why do the results differ? Shouldn't the energy be conserved as well as the momentum? Since it should be, then what is the flaw in my calculations?