Which of Kepler's laws gave Newton the idea about gravitational force and how it is related to distance?
1 Answer
The inversesquare idea can be got at pretty easily from Kepler's 3rd Law , if one assumes a circular orbit.
So if we say that there is some radial force
We know from Kepler's 3rd third law :
We also know that period,
That of course completely ignores Kepler's 1st Law , namely that planetary orbits are elliptical . The math becomes more turgid with ellipses, and certainly would have been for Newton as he was making it all up it as he went along.
Using postNewton maths, and actually assuming (naughty) an inverse law

#ddot r  dot theta^2 r =  mu/r^2 qquad star# 
# d/dt( m r^2 dot(theta) ) = " const." qquad square#
That's a nonlinear DE; but the strategy I have borrowed  namely, we want a polar coordinate expression
First we introduce a new fictional variable,
We can do that, this is physics not maths, and we assume everything is sufficiently smooth, as it is in the physical world. In maths terms, we are, I think, assuming that these interrelated functions are invertible, so the chain rule is operating on fullpower.
What's truly mindblowing is that, thanks to Newton et al, we are now just pushing letters about according to certain rules, because it follows from the chain rule that:
It then follows that:
Then
That's now trivial, it solves as:
Or
To finish this, from Wiki: "in the slightly more general case of an ellipse with one focus at the origin and the other focus at angular coordinate
We can match that up and then we are guaranteed at least an elliptical orbit using specifically the inverse square law ..... and that orbit may even in the oddest of cases be circular.
The fact that elliptical orbits can keep the inverse square law happy is seminal.
And this is the brilliant resource I found, though I find it really hard to follow:
http://galileo.phys.virginia.edu/classes/152.mf1i.spring02/KeplersLaws.htm