Derivation of law of conservation of momentum