$\newcommand{\oiint}{\iint\limits_{\partial V}\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\;\;\;\subset\!\supset }$
Imagine a ball of dust of total mass $M$ and radius $R$. The total mass of the ball remains uniform as $R$ changes. We will use $r$ as the radial coordinate, so that in general $0<r<R$.
Write down the gravitational potential $V(r)$ inside and outside the ball (using Gauss' theorem for gravity), as defined here.
For the outside, I have the following: $$\oiint \mathbf{g} \cdot d\mathbf{A} = -4\pi GM \implies \int_S \mathbf{g} \cdot {\hat {\mathbf {n} }} dS = g(r) \int_S dS = g(r) 4\pi r^2 = -4\pi GM \implies g(r) = -\frac{GM}{r^2}. \; V(r)={\frac {U_g}{m}}={\frac {1}{m}}\int \limits _{\infty }^{r} F_g dr ={\frac {1}{m}}\int \limits _{\infty }^{r}{\frac {GmM}{r^{2}}}dr=-{\frac {GM}{r}}$$
I believe this is the right answer, though I'm not 100% on the work. However, I tried to do some research on such an equation for gravitational potential inside of the ball. I eventually found $$\frac{GMr^2}{2R^3} - \frac{3GM}{2R}$$ somewhere on Wikipedia, but I can't find the page for it nor do I understand the derivations. I read that it had something to do with Poisson's equations? However, I'm not too familiar with the Laplacian, so I was wondering if I could get an explanation on all these notions.
\oiint
work using the method from this post. See \oiint doesn't seem to work for more information. $\endgroup$