The recoils is caused by the gun trying to balance out the momentum of the bullet and the gas being discharged. The gas helps balance out the momentum of the bullet a little, but the recoil is still needed for the complete balance. This need for balance is proved by Newtons third law.
The formula for finding the velocity of recoil is as follows:
(Weight of Bullet * Velocity of Bullet + Weight of Gases * Velocity of Gases) / (7000 * Weight of Gun)
Hope this helped!!! :D