The potential $\phi(\boldsymbol{x})$ satisfies
$\nabla^2\phi=f$
It may be shown that by defining an appropriate Green's function $g(\boldsymbol{x},\boldsymbol{\xi})$ that
$\phi(\boldsymbol{\xi})=\int_V g(\boldsymbol{x},\boldsymbol{\xi)} f(\boldsymbol{x})d^3\boldsymbol{x}$
Now if the Greens' function is $g(\boldsymbol{x},\boldsymbol{\xi})=\frac{-1}{4\pi|\boldsymbol{x}-\boldsymbol{\xi}|}$ and that
$f(\boldsymbol{x}) = \left\{ \begin{array}{ll} 1 & \mbox{if } \boldsymbol{|x|} < a \\ 0 & \mbox{if } a < \boldsymbol{|x|} \end{array} \right.$
and denoting $ \boldsymbol{|\xi|}=R$ show that
$\phi(\boldsymbol{\xi}) = \left\{ \begin{array}{ll} -(\frac{a^2}{2}-\frac{R^2}{6}) & \mbox{if } R < a \\ -\frac{a^3}{3R} & \mbox{if } a < R \end{array} \right.$
I get that
$ \int_0^{\pi} \int_0^{a}\frac{-1}{4\pi(R^2+r^2-2Rrcos(\theta))^{1/2}}4\pi r^2 sin(\theta) dr d\theta$
with $\frac{d}{d\theta}|\boldsymbol{x}-\boldsymbol{\xi}|= \frac{4Rrsin(\theta)}{(R^2+r^2-2Rrcos(\theta))^{1/2}}$ so I get that
= $\frac{-1}{8R} \int_0^a r[R^2+r^2-2Rrcos(\theta)]^{1/2} \vert^\pi_0 dr$
= $\frac{-1}{8R} \int_0^a r[R+r-|R-r|] \vert^\pi_0 dr$
but this does not integrated to the required function.