Newton's law of gravitation states that "Everybody in the universe attracts every other body with the force which is directly proportional to the product of their masses and inversely proportional to the square of the distance between their centers".
So, F ∝ m1m2 .......... relation 1
F ∝ 1/d2 .......... relation 2
From relation 1 and 2:
F ∝ ( m1m2 )/d2
F = G . ( m1m2 )/d2
Where G is gravitational constant as a proportional constant.