In a stark contrast to gravitational systems, n-body simple harmonic oscillators are always soluble. This is because the differential equations governing their motion are linear no matter how many interactions are included, so the solution is a matter of matrix algebra. It is straightforward to evaluate the exact solution for an arbitrary number of bodies in an arbitrary number of dimensions.

Consider an n-body system with equal masses and frequencies, since the solution is particularly elegant. The Lagrangian for pairwise interaction in d spatial dimensions is

$L=m2 ∑i=1 n ∑k=1 d (x· ik )2 -mω2 2 ∑i=1 n-1 ∑ j=i+1 n ∑k=1 d (xik -xjk )2$

where the upper indices label spatial dimensions as is done in general relativity. Evaluating the Lagrange equations

$ddt ∂L ∂q· i =∂L ∂qi$

for any one of the variables gives simply

$x ·· ik =−ω2 ∑j≠i (xik -xjk)$

which are linear equations as stated at the outset. The overall sign on the right-hand side can be confirmed by expanding each individual square in the potential.

These equations are independent of the number of spatial dimensions in the sense that the same form holds for each Cartesian coordinate individually. Since a general solution for one coordinate holds for all, apart from initial conditions, the upper index can be dropped temporarily.

The right-hand side of these equations contains n−1 terms for the variable on the left-hand side and one term for each of the remaining variables. The set of equations for each Cartesian coordinate thus has a matrix on the right-hand side which is all ones apart from the diagonal:

$d2 dt2 [ x1 x2 ⋮ ] =ω2 [ 1-n1⋯ 11-n⋯ ⋮⋮⋱ ] [ x1 x2 ⋮ ] =ω2M [ x1 x2 ⋮ ]$

The general behavior of this matrix can be understood by splitting it into two matrices, one which is all ones and the other proportional to the identity matrix:

$M=J-nI J=[ 11⋯ 11⋯ ⋮⋮⋱ ]$

A matrix of all ones has the interesting property

$J2=nJ$

which is easy to understand because multiplying any column with any row simply gives the dimension of the matrix. From this one can determine

$M2 =(J-nI )2 =nJ-2nJ +n2I =−n(J -nI) =−nM$

Multiplying repeatedly by M on both sides gives the general formula

$Mk =(−n )k-1 M$

while taking the square root of both sides gives

$M =±in M$

consistent with the general formula. This last expression is needed for writing down the general solution to the system of equations for each Cartesian coordinate,

$[ x1 x2 ⋮ ] =exp(ω Mt) [ x1 x2 ⋮ ]0 =exp( ±iωt n M) [ x1 x2 ⋮ ]0$

where the subscripts indicate initial values. Evaluating the exponential factor is straightforward:

$exp( ±iωt n M) =I +∑k=1 ∞ (±iωt n )k Mkk! =I +∑k=1 ∞ (±iωt n )k (−n )k-1 k! M =I-Mn ∑k=1 ∞ (∓in ωt )k k! =I-Mn [exp(∓in ωt)-1] =Jn -Mn exp(∓in ωt)$

In terms of real functions one then has

$cos(ωt n M) =Jn -Mn cos(n ωt) sin(ωt n M) =Mn sin(n ωt)$

so that the general solution can be written

$[ x1 x2 ⋮ ] =cos(ωt n M) [ x1 x2 ⋮ ]0 -1nω sin(ωt n M) [ x·1 x·2 ⋮ ]0 [ x1 x2 ⋮ ] =[Jn -Mn cos(n ωt)] [ x1 x2 ⋮ ]0 -M n3/2 ω sin(n ωt) [ x·1 x·2 ⋮ ]0$

Although the idempotent matrix M is not invertible, one can still multiply both sides of the initial condition for velocity to determine the proper relationship to input values. Note that the entire solution is divided by the number of bodies.

It should be stressed that this solution holds for all Cartesian coordinates and any number of interacting bodies. The system with equal masses and frequencies clearly has a tremendous amount of symmetry.

As a check of the general solution, consider two bodies interacting in one dimension, which is immediately separable:

$x ··1 =−ω2 (x1 -x2) x ··2 =−ω2 (x2 -x1) → x ··1 -x ··2 =−2ω2 (x1 -x2) x ··1 +x ··2 =0$

The factor here of two represents a reduced mass. The solutions to these equations are

$x1-x2 =(x1,0 -x2,0) cos(2ωt) +x· 1,0 -x· 2,0 2ω sin(2ωt) x1+x2 =x1,0 +x2,0 +(x· 1,0 +x· 2,0)t$

The individual variables are then determined by adding and subtracting these two expressions. Comparing the result to the general solution indicates that it represents the same motion but with the center of mass unmoving, since there is no term linear in time. This check also indicates the source of the overall denominator of the number of bodies.

And now to see it in action! The frequency is taken as unity because it merely represents a rescaling of the temporal variable. Initial positions and velocities are randomized about the origin, with the velocities adjusted to keep the center of mass at the origin. In two dimensions the evolution of the system looks like this:

The size of the bodies has been increased for legibility, but one can imagine them as points that do not collide. The reset button starts the visualization again with random initial conditions.

Since the motion is completely soluble in terms of simple functions, it is clearly precisely periodic. There is no chaos possible in this system, no matter how many bodies are involved. Quite different from gravitation in this respect!

In three dimensions the evolution of the system looks like this:

Again, the bodies can be imagined as point spheres that do not collide. The coordinate axes are included to provide some perspective for the scene. Apart from the added spatial coordinate, this visualization is essentially the same as the last.

Although this system is simple enough to be exactly soluble, one would still expect it would have something to say about n-body problems for other pairwise potentials. To be continued...