Conservation of momentum:
[tex]m_1 v_1 \cos \theta_1 + m_2 v_2 \cos \theta_2 = m_1 v_1^\prime \cos \theta_1^\prime + m_2 v_2^\prime \cos \theta_2^\prime[/tex]
[tex]m_1 v_1 \sin \theta_1 + m_2 v_2 \sin \theta_2 = m_1 v_1^\prime \sin \theta_1^\prime + m_2 v_2^\prime \sin \theta_2^\prime[/tex]
Conservation of energy:
[tex]\frac{1}{2} m_1 v_1^2 + \frac{1}{2} m_2 v_2^2 = \frac{1}{2} m_1 {v_1^\prime}^2 + \frac{1}{2} m_2 {v_2^\prime}^2 + Q[/tex]
where [itex]Q[/itex] is the amount of kinetic energy lost in the collision (to "heat" or whatever). For an elastic collision, [itex]Q = 0[/itex].