<s>[INST] The Shortest Distance Between 2 Points On The Earth 
Assuming that the earth is a perfect sphere with radius 6378 kilometers, what is the expected straight line distance through the earth (in km) between 2 points that are chosen uniformly on the surface of the earth?
 [/INST] View the sphere as the surface of revolution of the circle $$x^2+y^2=r^2 \tag 1$$ about the $x$-axis.  Differentiating both sides of $(1)$ we get
$$
2x\,dx+2y\,dy=0\quad\text{or}\quad x\,dx+y\,dy=0\quad\text{or}\quad\frac{dy}{dx}=\frac{-x}{y}.
$$
The distance from $(r,0)$ to $(x,y)$ is $\sqrt{(x-r)^2+y^2}$, by the Pythagorean theorem.
The element of arc length is
\begin{align}
& \sqrt{(dx)^2+(dy)^2} \quad\text{(by the Pythagorean theorem)} \\[8pt]
= {} & \sqrt{1 + \left(\frac{dy}{dx}\right)^2} \  \   dx \\[8pt]
= {} & \sqrt{1+\frac{x^2}{y^2}}\  \  dx = \frac{\sqrt{y^2+x^2}}{y} \, dx = \frac r y \, dx.
\end{align}
When the graph is revolved about the $x$-axis, the point $(x,y)$ traverses a circle of circumference $2\pi y$.  So we get an infinitely narrow strip of length $2\pi y$ and infinitely small width $\dfrac r y\, dx$, hence with area $2\pi y\dfrac r y\,dx=2\pi r\,dx$, and every point on that strip is at the same distance from $(r,0)$, namely
$$
\sqrt{(x-r)^2+y^2} = \sqrt{(x-r)^2+(r^2-x^2)}= \sqrt{2r^2-2rx\  {}}.
$$
So summing all these infinitely small quantities we get
\begin{align}
& \int_{-r}^r\  \overbrace{{}\  \sqrt{2r^2-2rx\  {}}\  {}}^{\text{distance}} \  \overbrace{{}\  2\pi r\,dx\  {}}^{\text{element of area}} \\[8pt]
= {} & (2r)^{3/2}\pi \int_{-r}^r \sqrt{r-x\,{}}\  dx \\[8pt]
= {} & (2r)^{3/2}\pi \int_{2r}^0 \sqrt{u}\,(-du) \\[8pt]
= {} & (2r)^{3/2}\pi \frac 2 3 (2r)^{3/2} = \frac {16} 3 \pi r^3.
\end{align}
Dividing this by the whole surface area $4\pi r^2$ to get the average, we have
$$
\text{average} = \frac{(16/3)\pi r^3}{4\pi r^2} = \frac{4r}3.
$$
Where we saw $2\pi y\dfrac r y\, dx$, the cancelation of the $y$ seems a bit startling.  It was in effect discovered by Archimedes in around 250 BC.
</s>