consider the problem of finding the center of mass for the two particle system shown below. If we try to balance the system on a pivot at a point xp in between x1 and x2 , both particles exert torques that tend to tip the beam, rotating it around the pivot. In order to balance the system on the pivot, we want the torques caused by each of the particles to cancel each other. Since the force exerted by each particle is given by its mass times the acceleration of gravity, xp must be chosen so that
m1 g (x1 - xp ) = m2 g (x2 - xp )
Rearranging this equation gives
xp (m1 + m2 ) = (x1 m1 + x2 m2 )
This line of reasoning easily generalizes. If a rigid body is composed of n particles connected in a straight line, then the location of the center of mass for the system is xcm where
(m1 + m2 + . . . + mn)xcm = m1 x1 + . . . + mn xn
cheers