Let S be the sphere of radius $r$ centered at the origin. Define $f:S\to\Bbb R$ as $f(x)=\frac{1}{||x -x_0||}$, where $x_0=(a,b,c)\in\Bbb R^3\setminus S$. Compute $\int_S fdS$ (Scalar surface integral).
My solution is to first parametrize $S$ by $\sigma:D:=[0,\pi]\times[0,2\pi]\to\Bbb R^3$ where $\sigma(\varphi, \theta) = (r\cos\theta\sin\varphi, r\sin\theta\sin\varphi, r\cos\varphi)$. Hence, after some computation, $$\int_S fdS = \int_D \frac{r^2\sin\varphi}{\sqrt{(r\cos\theta\sin\varphi-x_0)^2 + (r\sin\theta\sin\varphi-y_0)^2 + (r\cos\varphi-z_0)^2}}d\varphi d\theta = \int_D \frac{r^2\sin\varphi \;d\varphi\;d\theta}{ \sqrt {r^2 - 2r\cos\theta \sin\varphi x_0 - 2r\sin\theta\sin\varphi y_0 -2r\cos\varphi z_0 + x_0^2 +y_0^2 + z_0^2} }$$ But from there I don't know how to compute it. In fact, after researching more about this problem, I found that it has already been solved here: https://math.stackexchange.com/a/3225231/1174522 But I don't understand how $$\sqrt{r^2+\lVert x_0\rVert^2-2r\,\lVert x_0\rVert\cos\varphi} = \sqrt{(r\cos\theta\sin\varphi-x_0)^2 + (r\sin\theta\sin\varphi-y_0)^2 + (r\cos\varphi-z_0)^2}$$ and then how he solves it.