Average distance from a point in a hollow sphere to the surface of the sphere? I know that the average value of a function $f(x,y,z)$ over a volume $D$ is given by
$$ \bar{f} = \frac{1}{V} \int\int\int_D f(x,y,z) dV $$
I'm trying to set up the integral of the average distance from a point some distance a from the origin of a hollow sphere to the surface of the sphere (image from here):

I used this equation to find $d$: $R^2=a^2+d^2+2adcos(\theta)$
$$ \Rightarrow d = \sqrt{R^2-a^2sin^2(\theta)}-acos(\theta) $$
My problem is I am now having difficulty setting up the integral. I know I'm supposed to get:
$$ \bar{r} = \frac{3R}{2} \int_0^1 \int_0^{\pi} \sqrt{1-k^2sin^2(\theta)}k^2sin(\theta)dkd\theta $$
About the closest I can get to that is:
$$ \bar{d} = \frac{3}{4\pi R^3} \int_0^1 \int_0^{\pi} \int_0^{2\pi} \bigg(\sqrt{R^2-a^2sin^2(\theta)}-acos(\theta)\bigg)k^2sin(\theta)dkd\phi d\theta $$
I'm clearly conceptually missing something, so any advice for what I'm misunderstanding or hints on how to set up this integral would be greatly appreciated.
 A: If one want to average over the hollow sphere instead of average over
all possible directions with respect to the reference point,
one should use the green $\theta$ instead of blue $\theta$. They are
two different angles and expressions will become very complicated if one use
the wrong angle for the averaging scheme it is not intended for.
To avoid confusion with the differential operator, I will use $r$ instead of
$d$ to denote the distance between the reference point and point on the hollow sphere. Based on the given picture, I will also assume the reference point is inside the hollow sphere.
Case I - average over the hollow sphere.
In this case, the $\theta$ is the green $\theta$. We have
$$r = \sqrt{a^2 + R^2 - 2aR\cos\theta}$$
The integral I will evaluate is
$$\bar{r} \stackrel{def}{=} \frac{1}{4\pi R^2}\int_{S^2} r R^2 d\Omega
= \frac{1}{4\pi}\int_{S^2} r d\Omega
= \frac{1}{4\pi}\int_{S^2} \frac{a^2+R^2-2aR\cos\theta}{r} d\Omega
$$
where $d\Omega = \sin\theta d\theta d\phi$ is the area element of unit sphere $S^2$.
To compute the integral, we use something called
Multipole expansion.
In general, if we have two distinct points $\vec{p}$ and $\vec{q}$ in $\mathbb{R}^3$, we have following expansion:
$$\frac{1}{|\vec{p} - \vec{q}|} = \sum_{\ell = 0}^\infty \frac{r_<^\ell}{r_>^{\ell+1}} P_\ell(\cos\alpha)
\quad\text{ where }\quad
\begin{cases}
r_< &= \min\{ |\vec{p}|, |\vec{q}| \},\\
r_> &= \max\{ |\vec{p}|, |\vec{q}| \},\\
\alpha &= \cos^{-1}\frac{\vec{p}\cdot\vec{q}}{|\vec{p}||\vec{q}|}
\end{cases}
$$
and $P_\ell(x)$ is the Legendre polynomial of order $\ell$.
The key properties we need is $P_\ell(\cos\theta)$ forms a orthogonal family of polynomials over $S^2$.
More precisely,
$$\frac{1}{4\pi} \int_{S^2} P_\ell(\cos\theta)P_{\ell'}(\cos\theta) d\Omega =
\begin{cases}
\frac{1}{2\ell+1},& \ell = \ell',\\
0, &  \ell \ne \ell'
\end{cases}$$
Notice $P_0(x) = 1$, $P_1(x) = x$, we have
$$\begin{align}\bar{r} 
&=
\frac{1}{4\pi}\int_{S^2}
\left((a^2+R^2)P_0(\cos\theta) - 2aRP_1(\cos\theta)\right)\left(
\sum_{\ell=0}^\infty \frac{a^\ell}{R^{\ell+1}}P_\ell(\cos\theta)
\right) d\Omega\\
&= (a^2+R^2)\left(\frac{1}{R}\right)
- (2aR)\left(\frac{a}{3R^2}\right)\\
&= R + \frac{a^2}{3R}
\end{align}
$$
Case II - all directions with respect to reference point is equally likely.
In this case, the $\theta$ is the blue $\theta$. We have
$$(r\cos\theta + a)^2 + (r\sin\theta)^2 = 
R^2
\iff (a\cos\theta+r)^2 + (a\sin\theta)^2 = R^2\\
\implies r = \sqrt{R^2 - a^2\sin\theta^2} - a\cos\theta$$
The average we want becomes
$$\bar{r} = \frac{1}{4\pi}\int_{S^2} \left(\sqrt{R^2 - a^2\sin\theta^2} - a\cos\theta \right) d\Omega$$
where $d\Omega = \sin\theta d\theta d\phi$ again but for a different $\theta$.
Notice under the mapping $\theta \mapsto \pi - \theta$, $\cos\theta$ changes sign while the area element $d\Omega$ and the domain of integration remains unchange. the $a \cos\theta$ term doesn't contribute anything. As a result,
$$\bar{r} = \frac{1}{4\pi}\int_0^\pi \int_0^{2\pi} \sqrt{R^2 - a^2\sin\theta^2} \sin\theta d\phi d\theta
= \frac12\int_0^\pi \sqrt{R^2 - a^2\sin\theta^2} \sin\theta d\theta
$$
Change variable to $t = a\cos\theta$ and notice the intergrand is even under
the map $t \mapsto -t$, we have
$$\bar{r} = \frac{1}{a}\int_0^a \sqrt{R^2-a^2 + t^2} dt
= \frac{R}{2} +  \frac{R^2-a^2}{2a}\sinh^{-1}\left(\frac{a}{\sqrt{R^2-a^2}}\right)
$$
A: It looks like you are assuming that all values of the angle $\theta$ are equally likely. That might not be the correct assumption.
ADDED
The distance d is found in a ring of circumference $2\pi d \sin{\theta}$ and width $R d\theta$, hence of area $2\pi Rd\sin{\theta}d\theta$. This is the area by which the distance $d$ should be weighted when finding the mean,
so we want $$\frac{1}{4\pi R^2}\int_0^\pi (d)(2\pi R d \sin{\theta}) d\theta=\frac{1}{2R}\int_0^\pi d^2\sin{\theta} d\theta$$ $$=\frac{1}{2R}\int_0^\pi (R^2+a^2-2aR\cos{\theta})\sin{\theta} d\theta$$
$$=\frac{R^2+a^2}{2R}\int_0^\pi\sin{\theta}d\theta -\frac{a}{2}\int_o^\pi\sin{2\theta}d\theta$$ $$=\frac{R^2-aR+a^2}{R}$$
This checks out in the obvious special case $a=R$ for which the solution by Achille Hui gives $2R/3$
A: I have a question in an old series of maths books I am working through (An Analytical Calculus, Vol2, Maxwell) that I believe is identical to the problem under consideration (assuming the green theta). Here is the question:
Prove that the mean distance of points on a sphere of radius R from a point distant a (<=R) from the centre is $$R+\frac{a^2}{3R}$$
Note this is different than the solutions above (although almost the same as achille-hui's Case I, the green theta solution - achille’s looks like an error on the last line).
I tried answering the question using various coordinate systems but the easiest I found was just using good old rectangular coordinates and an idea similar to Phillip’s:
$$A =\text{Average Distance}= \frac{2\pi\int_{-R}^Ry \sqrt{(x+a)^2+y^2}\:ds} {4\pi R^2}$$
This is just summing up the surface areas across the diameter coincident with the line between the centre and the point inside the sphere, weighted by the common distance from the point and divided by the total surface area.
Now $$ds = \sqrt{1+\bigg(\frac{dy}{dx}}\bigg)^2\:dx= \sqrt{1+\left(\frac{x}{y}\right)^2}\:dx=\frac{R}{y}\:dx$$
So
$$2RA=\int_{-R}^R\sqrt{(x+a)^2+R^2-x^2}\:dx = \int_{-R}^R\sqrt{R^2+a^2+2xa\:}dx =\frac{(R^2+a^2+2xa)^{3/2}|_{-R}^R}{3a} = \frac{[(R+a)^3-(R-a)^3]}{3a} =\frac{6R^2a+2a^3}{3a}=2R^2+\frac{2a^2}{3}$$
or
$$A=R+\frac{a^2}{3R}$$
