I am self-studying classical mechanics. I came across a problem which required me to calculate the gravitational potential inside of a sphere. I found in one of my textbooks that the potential energy of a point P inside of a sphere is $$V=-\frac{GMm}{R}$$ where $M$ and $R$ are the mass and radius of the sphere. However, I also found this answer: Confusion over the gravitational potential energy inside a sphere in which the top answer gives a more complicated formula for the potential, which wouldn't agree when finding the PE. The one given in the link makes more sense to me, but I keep seeing different formulas for the same thing, and sometimes it's not specified whether it is the potential or the potential energy. I would like some clarification on what is going on (is the concentric sphere outside the point contributing to the potential or is it not; if so, why can't we just forget about the outer part of the sphere and just calculate it like P is on the surface of a smaller sphere?)
For context, I am working on solving the brachistochrone problem for a particle traveling between points through the Earth and need to find the velocity.