# The Epicycles of Ancient Astronomy

In the days of antiquity, most astronomers worked under (the rather selfish) assumption that the Earth lay in the center of the universe.  Given the predictable nature of the sun and moon, this assumption must have seemed obvious at first, but astronomers noticed some strange behavior amongst other celestial bodies. As some planets orbited the Earth, they would slow, stop, reverse direction, and then reverse direction again shortly after. This retrograde motion didn’t fit the model that all bodies simply travelled in circular paths around Earth. To address this issue, the ancient Greek astronomers Apollonius and Hipparchus developed the theory of epicycles around 200 BC.

They theorized that the planets had smaller “suborbits”, that is, they orbited a point which meanwhile orbited Earth (well not quite Earth, but a point near Earth called the eccentric). In the diagram below, the larger orbit is know as the deferent, while the smaller orbit is know as an epicycle. The model was extended to include multiple epicycles, where each epicycle recursively orbits around the previous one (see some of the gifs below).

This model of multiple epicycles works well in the sense that any observed planet’s orbit could be approximated with epicycles. Unfortunately this model works too well: a classical theorem of Fourier analysis states that any periodic function (or orbit in this case) can approximated with such epicycles. I’ll show you what I mean.

First, we’ll need some math. Let’s represent the plane as the set of complex numbers $\mathbb{C}$.  A circle is parametrized by $t \mapsto e^{it}$ which has a period of $2 \pi$ for $t$ in the interval $[0,\infty)$. We visualize $t$ moving from 0 to $2\pi$ by the red dot traveling along the larger circle in the gif below. The second circle can also be parameterized, this time by the rule $t \mapsto e^{-it}/10$. Notice that the red dot on the smaller circle is rotating in the opposite direction to the larger once, hence the minus sign in our parameterization. The movement of the red dot orbiting the smaller circle is therefore given by $t \mapsto e^{it} + e^{-it}/10$.

Generalizing this, we can consider any periodic curve of the form

$\displaystyle t \mapsto \sum_{n= -N}^N c_n e^{int}$

for some natural number $N$ and complex coefficients $c_n$. An epicycle corresponds to a summand $c_ne^{int}$ in the above formula. Note that we can express a complex number $c_n = r_n e^{i\theta_n}$ where $r_n$ is a non-negative real number and $\theta_n$ is an angle between $0$ and $2\pi$ and hence the coefficients $c_n$ determine both the radius and starting point of the red dot in the epicycle.

Now let’s say we’re astronomers in 2nd century BC and we want to come up with the epicycles that describe the orbit we observe of some planet. How can pick an appropriate $N$ and $c_n$‘s? They key is to understand two critical properties about the exponentials $\left\{ e^{int} \right\}_{n= -\infty}^\infty$. The first important property is that they form a dense subset of the set of continuous $2\pi$ periodic functions

$\displaystyle E = \left\{ f | f : \mathbb{R} \to \mathbb{C}, f(t) = f(t +2\pi) \right\}.$

This fact is not obvious (and is actually more general), but it ensures that any orbit we observe in the sky can actually be arbitrarily well approximated by finite combinations of these exponentials. The second important property is that they form an orthonormal set. Recall that in linear algebra, whenever we express a vector, say $(a,b,c) \in \mathbb{R}^3$, we are implicitly choosing a some basis to express it. In other words, $(a,b,c)$ is really

$\displaystyle a(1,0,0) + b(0,1,0) + c(0,0,1) = ae_1 +be_2 + ce_3$.

where the $e_i$ are the orthonormal basis vectors. Another way to express this is via the inner product $\left<\cdot,\cdot\right>$, so that

$\displaystyle (a,b,c) = \left< (a,b,c),e_1 \right> e_1 + \left<(a,b,c),e_2 \right>e_2 + \left<(a,b,c),e_3 \right>e_3 = ae_1 +be_2 + ce_3$.

In the same way, the $c_n$ serve as coordinates in terms of the basis $\left\{ e^{int} \right\}_{n= -\infty}^\infty$. Hence we could (though we won’t in the future) express our orbit as a vector with infinity many coordinates

$\displaystyle \sum_{n= -N}^N c_n e^{int} \leftrightarrow ( \dots, 0, c_{-N,}c_{-N+1}, \dots, c_{-1}, c_0, c_1,,\dots c_N, 0, \dots )$.

By the analogy with $\mathbb{R}^3$ , if we had an inner product $\left< \cdot , \cdot \right>$ on $E$ (a function space), then we would hope given some $f \in E$ that

$\displaystyle t \mapsto \sum_{n= -N}^N \left< f , e^{ins} \right> e^{int}$

is a good approximation for $f$. Indeed it is, if we take the inner product in $E$ to be the continuous and complex analog of the inner product in $\mathbb{R}^3$, i.e. for $f,g \in E$ we define

$\displaystyle \left< f, g \right> = \int_0^{2\pi} f(s)\overline{g(s)} ds$.

As we take $N$ to infinity, we get a better and better approximation of $f$ by exponentials, which in fact converges uniformly. Now let’s see some examples.

Our function $f$ above is a piecewise continuous function whose image in the plane looks like a triangle. We approximate it with five epicycles $(N = 2)$ and see that it does a pretty decent job. It only has trouble with the sharp corners, which has to do with the smoothness of the functions $e^{int}$, so we’ll need a much larger $N$ to make it more precise.

Here’s an example of various levels of precision when approximating the blue path below:

Above we have (roughly) the same curve approximated with five, fifteen, and thirty-one epicycles.

As we can see, if one models the orbits of plants with epicycles, there’s no reason why some of the above curves couldn’t be the paths of planets near Earth. It was only until Kepler did these theories fall out of favor and become replaced with his model of elliptical orbits. All of the above gifs were made (by me) in Processing, a language geared towards visual arts. Some (very hacked together) code is available on my github.