Note that the linear momentum is always conserved in any kind of collision either elastic or inelastic that is the linear momentum before collision is equal to the linear momentum after collision if there is no external force in the system.
In two dimensional collision the x-component of linear momentum before collision is equal to the x-component of linear momentum after the collision and the same is true for the y-component of linear momentum before and after the collision.
What is elastic collision?
The collision in which both the linear momentum and the kinetic energy are conserved is called elastic collision. The linear momentum is conserved in any kind of collision but one difference is that the kinetic energy is also conserved in elastic collision that is the total kinetic energy before collision is equal to the total kinetic energy after the collision.
We consider one dimensional elastic collision of two bodies \(A\) and \(B\) of masses \({m_a}\) and \({m_b}\) respectively as shown in Figure 1. One dimensional means the collision is along a straight line.
The initial velocity of the body \(A\) is \({\vec v _{a1}}\) and the initial velocity of the body \(B\) is \({\vec v _{b1}}\) before the collision. Again the final velocity of the body \(A\) is \({\vec v _{a2}}\) and that of the body \(B\) is \({\vec v _{b2}}\) after the collision.
We know that both the linear momentum and kinetic energy in elastic collision is conserved; that is the linear momentum and kinetic energy before the collision is equal to the linear momentum and kinetic energy after the collision. So we have two equations as
\[{m_a}{v_{a1}} + {m_b}{v_{b1}} = {m_a}{v_{a2}} + {m_b}{v_{b2}} \tag{1} \label{1}\]
\[\frac{1}{2}{m_a}{v_{a1}}^2 + \frac{1}{2}{m_b}{v_{b1}}^2 = \frac{1}{2}{m_a}{v_{a2}}^2 + \frac{1}{2}{m_b}{v_{b2}}^2 \tag{2} \label{2}\]
You can write Eqs.\eqref{1} and \eqref{2}as,
\[({v_{a1}} - {v_{a2}}){m_a} = ({v_{b2}} - {v_{b1}}){m_b} \tag{3} \label{3}\]
\[{m_a}({v_{a1}} - {v_{a2}})({v_{a1}} + {v_{a2}}) = {m_b}({v_{b2}} - {v_{b1}})({v_{b2}} + {v_{b1}}) \tag{4} \label{4}\]
Dividing Eq. \eqref{4} by Eq. \eqref{3} you obtain,
\[\begin{align*} {v_{a1}} + {v_{a2}} = {v_{b2}} + {v_{b1}}\\ {\rm{or,}}\quad {v_{a1}} - {v_{b1}} = - ({v_{a2}} - {v_{b2}}) \tag{5} \label{5} \end{align*}\]
The Eq. \eqref{5} says that the relative velocity before the collision is equal to the negative of the relative velocity after the collision. Note that Eq. \eqref{5} is for the elastic collisions in one dimension; you can use this equation to solve problems related to one dimensional elastic collision. Now we go into further details of elastic collision in one dimension. To do this, first put the value \({v_{b2}} = {v_{a1}} - {v_{b1}} + {v_{a2}}\) from Eq. \eqref{5} into Eq. \eqref{1} and solve for \(v_{a2}\), you'll get,
\[{v_{a2}} = \frac{{({m_a} - {m_b}){v_{a1}}}}{{{m_a} + {m_b}}} + \frac{{(2{m_b}){v_{b1}}}}{{{m_a} + {m_b}}} \tag{6} \label{6}\]
And similarly put the value of \({v_{a2}} = {v_{b2}} - {v_{a1}} + {v_{b1}}\) from Eq. \eqref{5} into Eq. \eqref{1} and solve for \(v_{b2}\). You'll get,
\[{v_{b2}} = \frac{{(2{m_a}){v_{a1}}}}{{{m_a} + {m_b}}} - \frac{{({m_a} - {m_b}){v_{b1}}}}{{{m_a} + {m_b}}} \tag{7} \label{7}\]
Consider that the body \(B\) is at rest, that is \({v_{b1}} = 0\). If the mass of the body \(A\) is extremely larger than the mass of the body \(B\), we can neglect the mass of the body \(B\). Thus, from Eq. \eqref{6} and Eq. \eqref{7} we have \({v_{a2}} = {v_{a1}}\) and \({v_{b2}} = 2{v_{a1}}\) which means the initial and the final velocities of the body \(A\) are equal and the final velocity of the body \(B\) is twice the initial velocity of the body \(A\).
When the mass of the body \(B\) is extremely larger than the mass of the body \(A\), the mass of body \(A\) can be neglected and from Eq. \eqref{6} and Eq. \eqref{7} we have \({v_{a2}} = - {v_{a1}}\) and \({v_{b2}} = 0\) that is, the initial velocity of the body \(A\) is equal and opposite to its final velocity and the final velocity of the body \(B\) is zero.
When the mass of both bodies is the same, that means when \({m_a} = {m_b}\) we have from Eq. \eqref{6} and Eq. \eqref{7} that \({v_{a2}} = 0\) and \({v_{b2}} = {v_{a1}}\) which means the body \(A\) stops after the collision (\({v_{a2}} = 0\)) and the initial velocity of the body \(A\) is converted to the final velocity of the body \(B\) (\({v_{b2}} = {v_{a1}}\)).
You can also investigate on the results for \({m_a} = {m_b}\) in Eq. \eqref{6} and Eq. \eqref{7} when the body \(B\) is not initially at rest. The results are quiet straightforward. The above discussions is based on one-dimensional elastic collision.
For two-dimensional elastic collision you'll have three equations in total. Two equations are obtained from the conservation of x-component of linear momentum and the conservation of y-component of linear momentum. The third is obtained from the conservation of kinetic energy.
What is inelastic collision?
The collision in which the kinetic energy is not conserved is inelastic collision. It means the total kinetic energy before collision is not equal to the total kinetic energy after the collision. You know that the momentum is conserved in any kind of collision. Here I focus on a type of inelastic collision which is perfectly inelastic in straight line.
In perfectly inelastic collision the bodies before collision completely stick together to form one body and move with a common velocity after collision. It does not mean that the bodies should stick together in inelastic collision but in perfectly inelastic collision they should.
Consider a body \(A\) of mass \({m_a}\) and a body \(B\) of mass \({m_b}\). The initial velocity of the body \(A\) is \({\vec v _{a1}}\) and that of the body \(B\) is \({\vec v _{b1}}\). After the collision they stick together and move with a common velocity \(v\). The sum of the masses of the bodies after the collision act as a single mass \(M\) which is \(M = {m_a} + {m_b}\). Now the momentum conservation gives,
\[{m_a}{\vec v _{a1}} + {m_b}{\vec v _{b1}} = ({m_a} + {m_b})\vec v = M\vec v \tag{8} \label{8}\]