Suppose a particle with mass $m_1$ and speed $v_{1i}$ undergoes an elastic collision with stationary particle of mass $m_2$. After the collision, particle of mass $m_1$ moves with speed $v_{1f}$ in a direction of angle $\theta$ above the line it was moving previously. Particle with mass $m_2$ moves with speed $v_{2f}$ in a direction of angle $\phi$ below the line which particle with mass $m_1$ was moving previously. Using equations for conservation of momentum and kinetic energy, how can we prove these two equations
$\frac{v_{1f}}{v_{1i}}=\frac{m_1}{m_1+m_2}[\cos \theta \pm \sqrt{\cos^2 \theta - \frac{m_1^2-m_2^2}{m_1^2}}]$
and
$\frac{\tan(\theta +\phi)}{\tan(\phi)}=\frac{m_1+m_2}{m_1-m_2}$ ?
EDIT. Here is what I've done:
For the first one, set the $xy$ coordinate system so that the positive direction of the $x$ axis points toward the original path of the particle with mass $m_1$. So we have three equations:
$m_1v_{1i}=m_1v_{1f}\cos \theta + m_2v_{2f} \cos \phi$
$0=m_1v_{1f}\sin \theta - m_2v_{2f}\sin \phi$
$m_1v_{1i}^2=m_1v_{1f}^2+m_2v_{2f}^2$.
From the second one, we get:
$v_{2f}=\frac{m_1v_{1f}\sin \theta}{m_2 \sin \phi}$
Plotting this into third equation, we get
$v_{1i}^2=v_{1f}^2(1+\frac{m_1 \sin^2 \theta}{m_2 \sin^2 \phi})$ (1)
From the first equation, we have
$\cos \phi =\frac{m_1(v_{1i}-v_{1f}\cos \theta)}{m_2v_{2f}}$
which after applying the equation we have for $v_2f$ becomes
$\sin^2 \phi = \frac{1}{1+\frac{(v_{1i}-v_{1f}\cos \theta)^2}{\sin^2 \theta \times v_1f^2}}$
Plotting this into equation (1), gives us an equation in terms of $m_1$, $m_2$, $v_{1f}$, $v_{1i}$ and $\theta$, but it is too far from what I expected.
For the second one, assigning the $xy$ coordinate in a way that the positive direction of the $x$ axis points toward the final path of the particle $m_2$, will give us three equations (two for conservation of linear momentum and one for conservation of kinetic energy), but I don't know what to do next.