# Astrodynamics/N-Body Problem
## N-Body Problem

Newton's law of universal gravitation only accounts for two bodies, m$_1$ and m$_2$. However, in space there are frequently more bodies to be concerned with. We can generalize the problem to say that there is a number N bodies to deal with, and create an equation that can deal with an arbitrary number of bodies.
All of the bodies together are known as a system of bodies.
When studying the N-body problem, it is important to focus on a single body, whose motion is of primary interest. We assume that this body, known as the ith body is able to move freely, but the other N - 1 bodies are stationary. The force of gravity between an arbitrary body n and the body i is given by the law of universal gravitation:
    $\mathbf {F} _{gn}=-{\frac {Gm_{i}m_{n}}{r_{ni}^{3}}}\mathbf {r} _{ni}$
Where r$_{ni}$ is the distance vector between object n and object i. We can express this vector in terms of the location vectors of the two bodies:
    $\mathbf {r} _{ni}=\mathbf {r} _{i}-\mathbf {r} _{n}$
The total force of gravity on the ith object is given as:
    $\mathbf {F} _{g}=-\sum _{k=1}^{N-1}{\frac {Gm_{i}m_{k}}{r_{ki}^{3}}}\mathbf {r} _{ki}$
We also know that the force of gravity on the ith body from the ith body (the force of gravity on itself) must be zero. We can also define a new force vector, F$_O$ that consists of all the force elements that can act on a body, besides gravity. Some of these elements are drag, solar radiation pressure, magnetic field pressure, and thrust (in the case of a man-made satellite or rocket). We can define the total force on the object, F$_T$ as a sum of the gravitational force and the other forces:
    $\mathbf {F} _{T}=\mathbf {F} _{gn}+\mathbf {F} _{O}$
Recalling Newton's second law, the complete equation of motion of a particle in the N-body system is:
    $m_{i}{\ddot {\mathbf {r} }}_{i}=-\sum _{k=1}^{N-1}{\frac {Gm_{i}m_{k}}{r_{ki}^{3}}}\mathbf {r} _{ki}+\mathbf {F} _{O}$

## Simplified Two Body Problem

The equation of motion in its general form is impossible to solve. In the context of astrodynamics, it is generally sufficient to deal with only two bodies at a time, and the equation of motion becomes significantly easier to solve. Solutions also exist for certain three-body systems, which will be discussed in later chapters.
To solve for the motion of an object in a two body system, two simplifying assumptions can be made:
    1. The bodies are spherically symmetric and can be treated as point masses.
    2. There are no external or internal forces acting upon the bodies other than their mutual gravitation.
The shapes of large celestial bodies are close to spheres. By symmetry, the net gravitational force attracting a mass point towards a homogeneous sphere must be directed towards its centre. The shell theorem (also proven by Isaac Newton) states that the magnitude of this force is the same as if all mass was concentrated in the middle of the sphere, even if the density of the sphere varies with depth (as it does for most celestial bodies). From this immediately follows that the attraction between two homogeneous spheres is as if both had its mass concentrated to its center.
Smaller objects, like asteroids or spacecraft often have a shape strongly deviating from a sphere. But the gravitational forces produced by these irregularities are generally small compared to the gravity of the central body. The difference between an irregular shape and a perfect sphere also diminishes with distances, and most orbital distances are very large when compared with the diameter of a small orbiting body. Thus for some applications, shape irregularity can be neglected without significant impact on accuracy.
Planets rotate at varying rates and thus may take a slightly oblate shape because of the centrifugal force. With such an oblate shape, the gravitational attraction will deviate somewhat from that of a homogeneous sphere. This phenomenon is quite noticeable for artificial Earth satellites, especially those in low orbits. At larger distances the effect of this oblateness becomes negligible. Planetary motions in the Solar System can be computed with sufficient precision if they are treated as point masses.
Two point mass objects with masses m$_1$ and m$_2$ and position vectors r$_1$ and r$_2$ relative to some inertial frame of reference experience gravitational forces:
    $m_{1}{\ddot {\mathbf {r} }}_{1}={\frac {-Gm_{1}m_{2}}{r^{2}}}\mathbf {\hat {r}}$
    $m_{2}{\ddot {\mathbf {r} }}_{2}={\frac {Gm_{1}m_{2}}{r^{2}}}\mathbf {\hat {r}}$
where $\mathbf {r}$ is the relative position vector of mass 1 with respect to mass 2, expressed as:
    $\mathbf {r} =\mathbf {r} _{1}-\mathbf {r} _{2}$
(Please note that the two diagrams are misleading in their capitalizations of M1, M2, R1, and R2, but significantly more importantly, the direction of the r vector in diagram two is pointing in the opposite direction)
Dividing by their respective masses and subtracting the second equation from the first yields the equation of motion for the acceleration of the first object with respect to the second:
    ${\ddot {\mathbf {r} }}=-{\frac {\mu }{r^{2}}}\mathbf {\hat {r}}$
where μ is the gravitational parameter and is equal to
    $\mu =G(m_{1}+m_{2})$
In many applications, a third simplifying assumption can be made:
    3. When compared to the central body, the mass of the orbiting body is insignificant. Mathematically, m$_1$ >> m$_2$, so μ = G (m$_1$ + m$_2$) ≈ Gm$_1$.
This assumption is not necessary to solve the simplified two body problem, but it simplifies calculations, particularly with Earth-orbiting satellites and planets orbiting the sun. Even Jupiter's mass is less than the sun's by a factor of 1047, which would constitute an error of 0.096% in the value of μ. Notable exceptions include the Earth-moon system (mass ratio of 81.3), the Pluto-Charon system (mass ratio of 8.9) and binary star systems.
Under these assumptions the differential equation for the two body case can be completely solved mathematically and the resulting orbit follows Kepler's laws of planetary motion. The orbits of all planets are to high accuracy Kepler orbits around the Sun. The small deviations are due to the much weaker gravitational attractions between the planets, and in the case of Mercury, due to general relativity. The orbits of the artificial satellites around the Earth are, with a fair approximation, Kepler orbits with small perturbations due to the gravitational attraction of the sun, the moon and the oblateness of the Earth. In high accuracy applications for which the equation of motion must be integrated numerically with all gravitational and non-gravitational forces (such as solar radiation pressure and drag) being taken into account, the Kepler orbit concepts are of paramount importance and heavily used.

### Gravitational Parameter

The standard gravitational parameter μ of a celestial body is the product of the gravitational constant and the total mass of the two bodies. It can be expressed as μ = G(m$_1$ + m$_2$). When one body is much larger than the smaller body we can say that μ = G (M + m) ≈ GM. Its SI unit is m$^3$⋅s$^{-2}$, although km$^3$⋅s$^{-2}$ is also commonly used. For several objects in the solar system, μ is known to a greater accuracy than G or M.