Given the period lengths for the orbits of $n$ different planets around the sun, how long until they all align?

270 Views Asked by At

Say you have $n$ planets orbiting around the sun, where the $i$th planet takes $t_i\in\mathbb{R}_{>0}$ days to complete one full cycle. Assume at $t=0$, all the planets are aligned with the sun. What is the minimum amount of time $T$ until all the planets are once again aligned with the sun? Does the answer always exist if the $t_i$'s are arbitrary real numbers? Or do they have to be rational?

If it's not clear, you can assume all the planets are points, and all orbiting in the same plane. And I want $T$ to be expressed as a function of $t_1, \ldots, t_n$. Lastly, "aligned" means that all the points are on the same side of the sun and form a straight line with the sun. (Though, for bonus points, you can also consider the case where the planets form a line being on either side of the sun)

To be mathematically precise, find the smallest $T$ such that $\frac{T}{t_i} \pmod{1}$ is the same for $i=1,\ldots,n$, where "mod" means "remainder" in this context. (e.g. 1.4 mod 1 = 0.4)

And just as a simple example for $n=2$, say that $t_1 = \pi$, and $t_2 = e$, then the minimal $T$ will be $\frac{e \pi}{\pi - e}\approx 20.17$.

Another simple example is for $t_1=\frac{2}{3}$,$t_2=\frac{3}{2}$, and $t_3=\frac{3}{7}$, In that case, the minimal $T$ will be $\frac{6}{5}$

2

There are 2 best solutions below

0
On BEST ANSWER

I think I've found a solution, though it's not exactly closed form, and is more algorithmic. WLOG, assume $t_1<t_2<\ldots<t_n$. Also, assume that the periods are rational. Therefore, each period can be written as $t_i = \frac{N_i}{D_i}$, where $N_i$ and $D_i$ are integers. Technically, the periods are all allowed to share a single common irrational factor, but you can divide that out (and multiply it back in at the end).

The answer is as follows:

  1. Initialize the cumulative time elapsed to be $T=\frac{1}{\frac{1}{t_{n-1}}-\frac{1}{t_n}}$. And initialize the cumulative phase to be $F=\frac{1}{1-\frac{t_{n-1}}{t_n}}\pmod{1}$. Set $t_{n-1}$ to be $T$, and remove the last planet and $t_n$ from the list.

Begin the following loop

  1. Let $a$ and $b$ be the periods of the last two planets in the list. (e.g. $a=t_5$, $b=t_6$)
  2. Let $D$ be the greatest common denominator of $\{\frac{1}{a}-\frac{1}{b},F-\frac{T}{a}\}$
  3. If $\left(D\cdot F - \frac{D T}{a}\right)\equiv 0 \pmod{D}$, let $k=0$. Else, if $\left(\frac{D}{a}-\frac{D}{b}\right)$ and $D$ are NOT coprime, let $k=D$. Else, let $k$ be $$k \equiv \left(\frac{D}{a}-\frac{D}{b}\right)^{-1}\cdot \left(D\cdot F - \frac{D T}{a}\right)\pmod{D}$$ Note that the inverse here is the modular inverse, and that things should cancel out and be integers.
  4. At the soonest, the last two elements will align after $k$ days. After aligning, the new period for these last two elements will be $P=\frac{1}{\frac{1}{a} - \frac{1}{b}}$. The relative increase in phase will be $f=k/b$.
  5. Replace $a$ with $P$, and remove the last planet and $b$ from the list. Update the cumulative variables to be $F \leftarrow F + f\pmod{1}$ and $T \leftarrow T+k$
  6. Repeat from step 1 until you're left with a single planet left. The final $T$ will be what is desired.

I'm pretty sure this will give an accurate answer. Note that every step is efficient, so the answer can be compute in $O(n)$ time.

My only wish is: does anyone have an elegant closed form expression answer, as opposed to my more algorithmic answer?

Also, as just an insight: note that Step #3 is the crucial computation step. For most large numbers, $k$ will be something large, and very often be set to $D$ (because it's hard to line up several planets exactly). If you want a more approximate or numerically stable answer (e.g. to use with floating point numbers), then when computing $k$, feel free to fudge this around a bit. Personally, I would use continued fractions to find an approximate solution with decent accuracy.

3
On

Express each planet's period as a rational number $N_i/D_i$, multiply all $n$ of them together, and multiply by the product of denominators to eliminate them.

$\prod_{i=1}^{n} N_i/D_i \prod_{i=1}^{n} D_i$

Example: three planets with periods 6/7 years, 4/3 years, and 3 years will realign after 1512 years. Since 1512 is evenly divisible by all periods, all planets will complete an integer number of orbits and will return to exactly where they started.

This answer suggests how to find a time when all planets are aligned in exactly their initial configuration, although it doesn't indicate that they cannot align elsewhere earlier.