Let P and Q be the two bodies,
the mass of body P = m1
And the mass of body Q = m2
As per the universal law of gravitation, the force of attraction between the earth and the body P is given by,
FP = {𝐺 × 𝑀_𝑒 × 𝑀_1 \over 𝑅^2} … (1)
Where, R is the distance of the body from the centre of the earth.
Similarly, the force of attraction between the earth and the body Q is given by
FQ = {𝐺 × 𝑀_𝑒 × 𝑀_2 \over 𝑅^2} … (2)
Since, the two forces, i.e., FP and FQ are equal, thus from (1) and (2),
{𝐺 × 𝑀_𝑒 × 𝑀_1 \over 𝑅^2} = {𝐺 × 𝑀_𝑒 × 𝑀_2 \over 𝑅^2}
⟹ m1 = m2