How do we derive these laws: (most of the time, the numbers are subscript)

v'2 = v1 * ( (2 * m) / (m1 + m2) ) + v2 * ( (m2-m1) / (m1+m2) )
&
v'1 = v1 * ( (m1-m2) / (m1+m2) ) + v2 * ( (2 * m2) / (m1 + m2) )

Could it be from the law of conservation of momentum? In the top equation it should be (2M1)