The linear momentum of an object is a vector p =  m * v, where v is the velocity vector and m is the object's mass. The law of conservation of [linear] momentum states that when the net external force on a system is zero, the total linear momentum remains constant.

The total momentum of a system at any time  is the vector sumof the momentum vectors of every body in the system. When momentum is conserved this principle can therefore be applied to each component of the total momentum. For a two-body system in two dimensions:
     p1i_x + p2i_x = p1f_x + p2f_x
     p1i_y + p2i_y = p1f_y + p2f_y
where "i" is used on initial values and "f" on final values. Equivalently, we have
     m1 * v1i_x + m2 * v2i_x = m1 * v1f_x + m2 * v2f_x
     m1 * v1i_y + m2 * v2i_y = m1 * v1f_y + m2 * v2f_y

This law can also be stated in vector form as p1i + p2i = p1f + p2f or
     m1 * v1i + m2 * v2i = m1 * v2i + m2 * v2f

This law can be applied to collisions: When two bodies collide, the force each body exerts on the other during the brief time interval of the collision is normally very much larger than any external forces acting on the system such as gravity or friction, so the total momentum just before and just after the collision can be equated.