When we walk on hard ground, the force with which our foot pushes the ground is equal to the force with which the ground pushes the foot. Since, the ground is hard it doesn’t change its shape and we walk easily. While in sand, a part of the force by our foot is used up in displacing the sand. So, the reaction force now is smaller. So, it becomes difficult to walk on sand.

__

Suppose:

Mass of bullet = m

Mass of gun = M

Velocity of bullet = v

Recoil velocity of the gun = V

Initially the gun and bullet were at rest, so, the initial momentum of the system is, Pi = 0

After firing the momentum of the system = momentum of gun + momentum of bullet

=> Pf = MV + mv

By conservation of momentum,

Pf = Pi

=> MV + mv = 0

=> V = -(mv)/M

The negative sign indicates that the direction of velocity of gun is opposite to that of the bullet.

For a lighter gun, M is smaller, so V will be large. And for a heavy gun M is larger and V will be smaller.