Surface integral for a point inside or outside of sphere Let $S$ a sphere or radius $r$ centered at the origin and $\vec{p}$ which is inside or outside but not in the sphere. Show that 
$$\int \int _S \frac{1}{||\vec{x}-\vec{p}||}dS=\begin{cases}
4\pi r \hspace{10 pt} \text{if ||p||<r },\\
\frac{4\pi r^2}{||p||} \hspace{10 pt} \text{if ||p||>r }
\end{cases}$$
I tried to show it by the parametrization of $S$, and using that $||\vec{x}-\vec{p}||=\sqrt{||\vec{p}||^2+r^2-2||\vec{p}||r \langle p,\vec{x}\rangle}$, I used mean value too but without results (I got $\frac{4\pi r^2 }{||\vec{{{q}}}-\vec{p}||}$, $||q||=r$ ). And geometrically I can't see how $\frac{1}{||\vec{x}-\vec{p}||}$ changes when $\vec{p}$ is inside or outside. Any help is appreciate
 A: As mentioned in a comment above, this question has been answered here.
The trick is to do the integral in spherical coordinates, and to simplify the calculations with symmetry arguments:


*

*$S$ can be parametrized as follows:
$$
\begin{cases}
x=r\sin\phi \cos \theta\\
y=r\sin\phi \sin \theta\\
z=r\cos \phi\\
\end{cases}
$$
with $(\theta,\phi)\in D=[0,2\pi] \times [0,\pi]$.

*With this parametrization, and with $\vec{p}=(x_0,y_0,z_0)$, the integral equals:
$$
I=\iint _S \frac{1}{||\vec{x}-\vec{p}||}dS = \iint_D \frac{r^2\sin\phi \;d\phi\;d\theta}{ \sqrt {r^2 - 2r\cos\theta \sin\phi x_0 - 2r\sin\theta\sin\phi y_0 -2r\cos\phi z_0 + x_0^2 +y_0^2 + z_0^2} }
$$

*Without loss of generality, we can assume that $x_0, y_0 = 0, z_0=d$ such that
$$
I = \iint_D \frac{r^2\sin\phi}{ \sqrt {r^2 - 2r\cos\phi d + d^2} } \;d\phi\;d\theta
$$

*Using the change of variables $u^2 = r^2 - 2rd\cos\phi  + d^2$ yields
$$
\boxed{
I =\frac{r}{d}\int_0^{2\pi}\int_{|d-r|}^{|d+r|}dud\theta =\cases{\frac{4\pi r^2}{d} \quad \mbox{if } d=||\vec{p} ||\ge r\\
4\pi r  \quad \mbox{if } d=||\vec{p} ||<r }
}
$$

