Look at the forces acting on body 1:
The forces balance, so
Remember that ,insert this into the equation and do some math, and we get:
What is r1? From the definition of center of mass,
Plug r1 into our equation and we now get
or, after rearranging terms,