The total momentum of a gun-bullet system remains unchanged after the shot is fired(Assume that no external force is acting on the system).
Initial momentum of the system is zero, as both the gun and bullet are at rest.
According to the law of conservation of momentum,
The total momentum of a system remains constant unless an external unbalanced force starts to act on it.
Therefore, the total final momentum of the system is also zero, as the momentum of bullet and recoil are in opposite directions and hence balance each other out.