Consider the gun and bullet in its barrel as an isolated system
In the beginning when bullet is not fired both the gun and bullet are at rest.So the momentum of the before firing is zero
p_{i}=0
Now when the bullet is fired ,it moves in the forward direction and gun recoil back in the opposite direction
Let m_{b} be the mass and v_{b} of velocity of the bullet And m_{g} and v_{g} be the velocity of the gun after the firing
Total momentum of the system after the firing would be
p_{f}=m_{b}v_{b} +m_{g}v_{g}
since no external force are acting on the system,we can apply the law of conservation of linear momentum to the system
Therefore
$p_{final}=p_{initial}$
or $m_bv_b +m_gv_g=0$
or $v_g=-\frac {m_bv_b}{m_g}$
The negative sign in above equation shows that velocity of the recoil of gun is opposite to the velocity of the bullet
Since mass of the gun is very large as compared to the mass of the bullet,the velocity of the recoil is very small as compared to the velocity of the bullet
Example -1
Calculate the recoil velocity of gun whose mass is 5 kg and it shoot the bullet of mass .015 kg with velocity 500 m/s Solution
$v_g=-\frac {m_bv_b}{m_g}$
Here $m_b=.015 kg$
$v_b=500 m/s$
$m_g=5 Kg$
So ,
$v_g=-\frac {.015 \times 500}{5}=-1.5 m/s$
Here $m_b=.015 kg$