# Finding the average distance from an ellipse to a point

18th Dec 2021

## Motivation

I've recently been reading a book called Infinite Powers by Steven Strogatz about the history that led to the development of calculus. This, combined with the subject of conics which I've been studying as part of my university work, led me to start thinking about the Astronomical Unit and how it's calculated.

## A Problem

My understanding of the Astronomical Unit was that it represents the average distance between the Earth and the Sun. This understanding leads to an interesting problem: the Earth orbits around the Sun in an ellipse, and there are infinitely many points on that ellipse at which you could measure the distance between the Earth and the Sun. How can we take an average of infinitely many things? This sounds like a problem well suited to calculus.

As it turns out, the Astronomical Unit was originally calculated by taking the average of the Earth's aphelion and perihelion (the furthest and closest points to the sun, respectively).

So it's quite a rough average. I therefore set myself the challenge of finding the true average - the average of the infinitely many distances from the sun to points along the Earth's orbit.

In this post, I'll outline the process I went through to find a general formula for finding the true average of the distances from an arbitrary point to all the possible points along an ellipse. I'll save the final step of deriving the equation of the Earth's elliptical orbit and applying the formula to it for another post.

## The Strategy

I'll start this section by saying that I'm an undergraduate student just doing this for fun, so do take my conclusions with some skepticism.

I reasoned that if we can find a function $f(\theta)$ for the distance from an arbitrary point $(p,q)$ to the point on the ellipse which coincides with the straight line extending from the origin at angle $\theta$, we could then take $n$ evenly spaced values of $\theta$ and take the average of their respective $f(\theta)$ values.

Notice that $\theta$ is replaced with $\frac{2\pi \times k}{n}$. Dividing $2\pi$ by $n$ divides the circle around the origin into the appropriate number of slices, and then we multiply the result by $k$ to select the appropriate slice. $k$ effectively becomes an index.

*$2\pi$ divided into $n = 8$ slices*

It's important for the values of $\theta$ to be evenly spaced so as not to introduce a bias towards one or another extreme of the ellipse. The fact that the angles are evenly spaced also makes simplifying the equation much simpler later on, as we'll see.

This average would increase in precision as you take more and more distances (as $n$ increases) - much like how a mean average better represents the population as the sample size increases. Continuing the statistics analogy, the population we're dealing with is infinitely large, meaning no matter how large (but finite) our sample size $n$, the result will still only be a rough average.

*Average gets more accurate as $n\to\infty$*

The true average distance would be the limit as $n$ approaches infinity.

So the strategy can be summarised as follows:

- Find a function for the distance from a given point on an ellipse
**in standard position**to an arbitrary point $(p,q)$. - Find a function for the average of the distances between $n$ evenly spaced points on the ellipse and the point $(p,q)$ (using the function found in part 1).
- Find the limit of the function found in part 2 as $n \to \infty$.

## Step 1: A function for the distance from $(p,q)$ to a point on the ellipse

To find a function for the distance from a point on the ellipse to the point $(p,q)$, we can start with the standard formula for the distance between two points

but since we're looking for a function, we'll need to square both sides. This will just mean taking the square root as a final step in calculating the average. So the function will take the form

where $x$ and $y$ are the coordinates of the point on the ellipse.

The equation of any ellipse in standard position takes the form

where $a$ and $b$ are constants. However, this can be parametrised into two separate formulas for $x$ and $y$.

Therefore, our function for the square of the distance will be

## Step 2: A function for the average of $n$ distances

Now that we have a function $d(\theta)$ for a single square distance from $(p,q)$ to a point on the ellipse, the function $D(n)$ for the average of $n$ distances will take the form

For small values of $n$, this is quite simple to calculate by hand. For example:

However, the numerator becomes longer as $n$ gets larger, and since we're trying to find the limit as $n \to \infty$ this method will become unmanageable. Therefore, we need to find a way to express the same rule for the function without the need for series notation.

The first step in doing this is to use some of the rules for manipulating series to simplify as much as possible. For simplicity, let's focus on the numerator.

Next we can use the two trigonometric half angle identities

to remove the $\cos^2$ and $\sin^2$ functions.

The expression now looks very long and complex, but we can divide and conquer by using the following rule for manipulating a series

to replace the single long series with a simpler series for each subexpression, which we can then sum together.

These resulting series can be simplified substantially if we remember that $a$, $b$, $p$ and $q$ are all constants, and therefore we can apply the following two further rules.

The expression becomes

Earlier I mentioned the importance of the values of $\theta$ being evenly spaced. This step is where that becomes relevant. As it happens, the fact that the values are evenly spaced means that all our remaining sums (sums of sine and cosine) evaluate to zero.

I won't provide a proof for this here as this post is already becoming cumbersome with equations, but I found this article very helpful https://matthew-brett.github.io/teaching/sums_of_cosines.html. It also makes sense intuitively if we remember that the sine and cosine are just the $y$ and $x$ components of the point on the unit circle corresponding with the angle $\theta$, respectively. By virtue of the points on the unit circle being evenly spaced, each point's distance from the relevant axis is cancelled out by a point on the opposite side.

*Sums of sines and cosines cancel to 0*

So, we can remove the remaining sums from our expression which leaves us with the following much simpler one.

Bringing this back into context, this is the numerator in our original expression for the square of the average distance from the infinitely many points on the ellipse to the point $(p,q)$.

I was surprised at how concise this formula is. Moreover, Step 3 for finding the limit as $n\to\infty$ has become irrelevant since $n$ is entirely cancelled from the expression; as $n$ approaches infinity it is always cancelled by the denominator.

## Trying it out

Let's try the formula on an example point and ellipse.

I won't prove the accuracy of the formula here, but this result matches the approximation we get from Maxima with a value of $n=100$ (essentially calculating an approximate value by brute force).

In another post I'll return to the example of the Earth's orbit around the Sun, and attempt to find the average distance between them using this formula.