Suppose we got two particles, both of mass $m$ for simplicity, travelling at high speeds towards each other, meaning we have to take into consideration of relativistic effects. We also know that the collision is inelastic, and they hit each other head to head, meaning they travel along the same direction. We have also been given the fact that their relative velocity is $v$. What is then the rest mass of the particle formed after the collision?
My attempt at solving this problem is using the fact that the four-momentum vector is conserved in all types of collisions.
The four-momentum vector can be described as $\vec{P}_1 = m \gamma(v_1)(1,v_1,0,0)$ for our first particle, and $\vec{P}_2 = m \gamma(v_2)(1,v_2,0,0)$, meaning that the initial four-momentum vector is $\vec{P} = m \gamma(v_2)(1,v_2,0,0) + m \gamma(v_1)(1,v_1,0,0)$
After the collision, we get a new particle with mass $M$ and velocity $v_f$. Meaning, our four-momentum vector becomes $\vec{P} = M\gamma(v_f)(1,v_f,0,0)$
Since it's conserved, we set the previous expression equal to the latter, giving us:
$$\left\{\begin{matrix} m(\gamma(v_1)+\gamma(v_2)) = M\gamma(v_f) \\ m(\gamma(v_1)v_1+\gamma(v_2)v_2) = M\gamma(v_f)v_f \end{matrix}\right.$$
$$\Leftrightarrow$$
$$\left\{\begin{matrix} m(\gamma(v_1)+\gamma(v_2)) = M\gamma(v_f) \\ (\gamma(v_1)v_1+\gamma(v_2)v_2) = (\gamma(v_1)+\gamma(v_2)) v_f \end{matrix}\right.$$
$$\Leftrightarrow $$
$$\left\{\begin{matrix} m(\gamma(v_1)+\gamma(v_2)) = M\gamma(v_f) \\ \frac{(\gamma(v_1)v_1+\gamma(v_2)v_2)}{(\gamma(v_1)+\gamma(v_2)} = v_f \end{matrix}\right. $$
Substituting the latter equation into the first, we have:
$$ m(\gamma(v_1)+\gamma(v_2)) = \frac{M}{\sqrt{1-\left(\frac{(\gamma(v_1)v_1+\gamma(v_2)v_2)}{(\gamma(v_1)+\gamma(v_2)}\right) ^2}} $$
$$\Leftrightarrow$$
$$ m = \frac{M}{\sqrt{\left(\gamma(v_1)+\gamma(v_2)\right)^2-\left(\gamma(v_1)v_1+\gamma(v_2)v_2)\right) ^2}}$$
$$\Leftrightarrow$$
$$ m = \frac{M}{\sqrt{\gamma(v_1)^2(1-v_1^2)+\gamma(v_2)^2(1-v_2^2)+2\gamma(v_1)\gamma(v_2)(1-v_1v_2)}} = \frac{M}{\sqrt{2+2\gamma(v_1)\gamma(v_2)(1-v_1v_2)}}$$
Now from this I want to somehow simplify the root using the fact that $v_1-v_2 = u$ and then solving for $M$, however, I struggle solving it from here. I'd be glad if someone could give me any tips on how to further simplify this expression.
Edit: Okay, I see what went wrong now, it's the fact that $u \neq v_1-v_2$, rather $u = \frac{v_1-v_2}{1-v_1v_2}$, this managed to solve the problem for me. However, why is that $u$ is simply not what I first thought it to be. I mean, when we are given their relative velocity, we are an observer "outside" measuring their difference in velocity. Why did I have to use their relative velocity in special relativity, since the relative velocity is not given in the frame of one of the particles?