The bullet is pushed out of the barel at high speed by expanding gasses from the burning gunpowder. At the same time, the gun is pushed back by the recoil. This is the "equal and opposite reaction" mentioned in the Laws of motion.
Chat with our AI personalities