I am trying to calculate the average squared distance from point A to a circle whose origin lies at point B at a distance of R. The circle has a radius of r. Note that there are no restrictions on r and R, i.e. r<R, r=R, and r>R are allowed for.
I have come this far and do not fully trust my results:
The squared distance to a point on the circle is given by the law of cosines: $$ d^2 = r^{2} + R^{2} - 2 r R \cos \phi $$
Then, the average squared distance to any point on the circle for a uniformly distributed random variable $\phi \epsilon [0, 2\pi]$ should be given by:
$$ d^2 = \frac{1}{2\pi} \int_0^{2\pi} r^{2} + R^{2} - 2 r R \cos \phi \quad d\phi\\ = r^{2} + R^{2} - \frac{1}{2\pi} \int_0^{2\pi} 2 r R \cos \phi \quad d\phi\\ = r^{2} + R^{2} - \frac{2Rr}{\pi} \int_0^{2\pi} \cos \phi \quad d\phi\\ = r^2 + R^2$$
Now note that the difference between the squared distance to the circle's origin and the average squared distance to the circle only depends on the circle's radius $r$, not the distance $R$ to the circle:
$$d^2 - R^2 = r^2$$
Intuitively, I think this result is wrong, but I don't see why. How can I correctly calculate the average squared distance to any point on the circle?
This shouldn't be intuitively surprising. Note that this average distance is basically the distance to the top- (or bottom-) most points on the circle relative to the line connecting the starting point to the circle center. Take any two points that are separated by the same angular distance from the top (mirror images about the vertical). Their angles from the horizontal are $\phi < \frac{\pi}{2}$ and $\pi - \phi > \frac{\pi}{2}$, and we have that $\cos \phi = - \cos (\pi - \phi)$. That is to say, the distance to the closer point, $r^2 + R^2 - 2 r R \cos \phi$, is shorter by the average, $r^2 + R^2$, by exactly the same amount that the distance to the farther point, $r^2 + R^2 - 2 r R \cos (\pi - \phi) = r^2 + R^2 + 2 r R \cos \phi$, is longer than the average.