Let the mass of planet and moon be Mp and Mn respectively.
And the distance between them is "r"
Then according to Newton's law of gravitation,
The force with which the planet and the moon attract esch other is
1) directly proportional to the product of their masses i.e. Mp * Mn
2) inversly proportional to the square of the distance between them i.e r ^2
Therefore,F =. G (Mp* Mn)/r^2
Where,G is gravitational constant