I think you have heard the story of the apple falling from the tree on newton's head which eventually led him asking the question why do apples fall. Newton's law of gravity is given by the formula
F=Gm1m2/(r^2) where G is the universal gravitational constant and its value is approximately equal to 6.67384 × 10-11 m3 kg-1 s-2.... m1 and m2 are the masses of 2 different objects which are attracting each other and r the distance between them. Newton derived this law from Kepler's law of planetary motion. Google it and see the 3 laws 1 of them being (T^4) is directly proportional to (r^3).