I read, long ago, a book, whose title I can't remember but I think the author was Carl Sagan. In the book was saying that gravity follows the inverse square law because of our Universe was 3 dimensions of space. (I'm obviously not taking into account string theory which states that are extra dimensions). By this logic, if the Universe had 4 spatial dimensions the law would be 1/r^3 and if there were 5 dimensions, it would be 1/r^4.
So my question is: is this true? And if it is, could you elaborate and state exactly how do we know this is true? I think this might be related to GR theory, but I'm not very sure. Thank you in advance.