← Back to Learn Simulator

2.1.1 Two Body Problem:

The two body problem is a very high level differential equation that allows you to do a lot of stuff with two objects in orbit, it's given by.

$\ \frac{d^{2}\underline{r}}{dt^{2}} = \frac{GM}{r^{2}}\widehat{r}$

2.1.1.1 What You Can Find With It

1. Position and velocity over time

2. Trajectory prediction

3. Collision/encounter prediction

4. Orbit determination from observations

5. Ground track calculations

2.1.1.2 When to Use It

USE two-body when:

✅ You need complete trajectory (position vector evolving in time)

✅ You're doing numerical integration / simulation

✅ You need 3D spatial coordinates, not just scalar distance

✅ Working in Cartesian coordinates (x, y, z)

✅ Propagating state vectors forward in time

✅ You need the actual path, not just orbital characteristics

Real-time simulation of orbital motion

DON'T use two-body when:

❌ You need just orbital period/energy → use orbital elements directly

❌ Multiple bodies significantly affect motion → need n-body or patched conics

❌ Drag/thrust/perturbations present → need modified equations

❌ You want analytical closed-form answers → two-body gives you a differential equation to solve

The two body problem is fundamental to orbital mechanics, It states that in a closed system between only two objects there is a closed solution to the positions of both objects at time t. This problem assumes that both objects are perfect spheres and are never going to collide with each other.

Derivation:

Imagine you have two objects in a space, they are always exerting a force of F on each other. Imagine this is due to gravity. Then the equations are represented as

$F_{1} = G\frac{M_{1}M_{2}}{r^{2}}$ were going to analyze this from the position of one of the objects, object A

$F_{1} = m_{1}\underline{a} = m_{1}\frac{d^{2}r_{1}}{dt^{2}}$ so that means

$m_{1}\frac{d^{2}\underline{r_{1}}}{dt^{2}} = G\frac{M_{1}M_{2}}{r^{2}}$ but remember acceleration and position are both positional vectors so we need to introduce our unit vector to give direction

$m_{1}\frac{d^{2}\underline{r_{1}}}{dt^{2}} = G\frac{m_{1}m_{2}}{r^{2}}\frac{(\underline{r_{2}} - \ \underline{r_{1}})}{r}$ multiplying

$m_{1}\frac{d^{2}\underline{r_{1}}}{dt^{2}} = G\frac{m_{1}m_{2}\ (\underline{r_{2}} - \ \underline{r_{1}})}{r^{3}}$ dividing by ${m}_{{{1}}}$

$\frac{d^{2}\underline{r_{1}}}{dt^{2}} = G\frac{m_{2}\ (\underline{r_{2}} - \ \underline{r_{1}})}{r^{3}}$

Repeating all of this but for object B were left with

$\frac{d^{2}\underline{r_{2}}}{dt^{2}} = G\frac{m_{1}\ (\underline{r_{1}} - \ \underline{r_{2}})}{r^{3}}$

$\frac{d^{2}\underline{r_{2}}}{dt^{2}} = G\frac{{- m}_{1}\ (\underline{r_{2}} - \ \underline{r_{1}})}{r^{3}}$

Subtracting one from the other to get relative acceleration

$\frac{d^{2}\underline{r_{1}}}{dt^{2}} - \frac{d^{2}\underline{r_{2}}}{dt^{2}} = G\frac{m_{2}\ (\underline{r_{2}} - \ \underline{r_{1}})}{r^{3}} - G\frac{{- m}_{1}\ (\underline{r_{2}} - \ \underline{r_{1}})}{r^{3}}$

$\frac{d^{2}\underline{r_{1}}}{dt^{2}} - \ \frac{d^{2}\underline{r_{2}}}{dt^{2}} = G\frac{(m_{2} + {\ m}_{1})(\underline{r_{2}} - \ \underline{r_{1}})}{r^{3}}$ , $r = \underline{r_{1}} - \ \underline{r_{2}}$

$\ \frac{d^{2}\underline{r}}{dt^{2}} = G\frac{(m_{2} + {\ m}_{1})(\underline{r_{2}} - \ \underline{r_{1}})}{r^{3}}$ using the definition of unit vector $\frac{(\underline{r_{2}} - \ \underline{r_{1}})}{r} = \ \widehat{r}$

$\ \frac{d^{2}\underline{r}}{dt^{2}} = G\frac{(m_{2} + {\ m}_{1})}{r^{2}}\widehat{r}$ finally defining the total mass of the system as $M = m_{2} + {\ m}_{1}$

$\ \frac{d^{2}\underline{r}}{dt^{2}} = \frac{GM}{r^{2}}\widehat{r}$

2.1.1.3 Solving problems

Two stars with masses ${\ m}_{1} = 2*10^{30}kg$ and ${\ m}_{2} = 1*10^{30}kg$ are initially separated by ${r}={1}\cdot{10}^{{{11}}}{m}$ (about Earth-Sun distance) with zero relative velocity. How fast are they moving when their distance = r/2?

First lets find our constants

$M = m_{2} + {\ m}_{1}\ = \ 2*10^{30} + 1*10^{30} = \ 3*10^{30}$

${r}={1}\cdot{10}^{{{11}}}$

$G = \ 6.6743 \times 10^{- 11}$

Because they have no relative velocity $\widehat{r} = 1$ so were left with

$\ \frac{d^{2}\underline{r}}{dt^{2}} = \frac{GM}{r^{2}}$ because we want to find velocity we can take our term $\frac{d^{2}\underline{r}}{dt^{2}}$ and convert it to terms of velocity

$\frac{d^{2}\underline{r}}{dt^{2}} = (\frac{dv}{dt}) = \frac{dv}{dr}\frac{dr}{dt}$ , Using the chain rule

$\frac{dv}{dr}\frac{dr}{dt} = \frac{dv}{dr}v$ , $\frac{dr}{dt} = Velocity$

So

$\frac{dv}{dr}v = \frac{GM}{r^{2}}$

So

$\frac{dv}{dr}v = \frac{GM}{r^{2}}$

Integrating

$\int_{}^{}(v)dv\ = \int_{}^{}(\frac{GM}{r^{2}})dr$

$\frac{v^{2}}{2} = \frac{GM}{r} + c$

$\frac{v^{2}}{2} = \frac{GM}{r} + c$

$\frac{v^{2}}{2} = \frac{GM}{r} + c$ initial conditions when v = 0 and ${r}={r}_{{{0}}}$

$0 = \frac{GM}{r_{0}} + c$

$- \frac{GM}{r_{0}} = c$

So our general equation is

$\frac{v^{2}}{2} = \frac{GM}{r} - \frac{GM}{r_{0}}$

$\frac{v^{2}}{2} = GM(\frac{1}{r} - \frac{1}{r_{0}})$

$v^{2} = 2GM(\frac{1}{r} - \frac{1}{r_{0}})$

So now substituting our value of $r = \frac{r}{2} = \frac{1*10^{11}}{2} = 5*10^{10}$ and substituting that and ${r}_{{{0}}}$= ${1}\cdot{10}^{{{11}}}$

$v^{2} = 2GM(\frac{1}{5*10^{10}} - \frac{1}{1*10^{11}})$ Substituting

$v^{2} = (6.6743 \times 10^{- 11})(3*10^{30})(2)(\frac{1}{5*10^{10}} - \frac{1}{1*10^{11}})$ and solving

$v^{2} = (4.00458*10^{20})(\frac{1}{5*10^{10}} - \frac{1}{1*10^{11}})$

${v}^{{{2}}}={\left({4.00458}\cdot{10}^{{{20}}}\right)}{\left({1}\cdot{10}^{{-{11}}}\right)}$

${v}^{{{2}}}={\left({4.00458}\cdot{10}^{{{20}}}\right)}{\left({1}\cdot{10}^{{-{11}}}\right)}$

${v}^{{null}}={63281}$

And that is the answer.

Lets do another problem but with velocity to use our vectors
Two asteroids in space:

Question: Find an equation that finds speed as a function of distance

$\frac{d^{2}\underline{r}}{dt^{2}} = \frac{GM}{r^{2}}\widehat{r}\ = > \ \frac{d^{2}\underline{r}}{dt^{2}} = \frac{GM}{r^{2}}\frac{(\underline{r_{1}} - \ \underline{r_{2}})}{r}$ their relative positions are given by $\underline{r_{2}} - \ \underline{r_{1}}$

to do the full development it would look like this

$\underline{r_{2x}} - \ \underline{r_{1x}}\ = \underline{r_{x}}$

$\underline{r_{2y}} - \ \underline{r_{1y}}\ = \underline{r_{y}}$

$\underline{r_{2z}} - \ \underline{r_{1z}}\ = \underline{r_{z}}$

Substituting

$1000 - \ 0\ = \underline{r_{x}}\ \ = 1000$

$0 - \ 0 = \underline{r_{y}}$

$0 - \ 0 = \underline{r_{z}}$

So our given position vector is (1000, 0, 0) $= \underline{r}$ $$

We can then multiply this vector by the scalers

$GM\frac{\underline{r}}{r^{3}} = GM\frac{(1000,\ 0,\ 0)}{1000^{3}}\ = \frac{GM}{10^{6}}$

$\frac{GM}{10^{6}} = \frac{d^{2}r_{}}{dt^{2}}$ doing the same thing of getting velocity out using the chain rule

$\frac{GM}{10^{6}} = \frac{dv_{}}{dr_{}}v_{}$

$\frac{GM}{10^{6}}dr_{} = v_{}dv_{}$

$\int_{}^{}\frac{GM}{10^{6}}dr_{} = \int_{}^{}v_{}dv_{}$

$\frac{GM}{10^{6}}r_{} + c = \frac{v_{}^{2}}{2}$

Finding c using initial conditions of $r = 1000\ \&\ v = 25$

$\frac{GM}{10^{6}}r_{} + c = \frac{v_{}^{2}}{2}$

$\frac{GM}{10^{6}}1000 + c = \frac{(25)^{2}}{2}$

$\frac{GM}{10^{3}} + c = \frac{625}{2}$

$c = \frac{625}{2} - \frac{GM}{10^{3}}$

Simplifying numerically

${c}={112.271}$

So our general equation looks like where $\underline{r} =$ and $\underline{v} =$

$\frac{GM}{10^{6}}{\underline{r}}_{} + 112.271 = \frac{{\underline{v}}^{2}}{2}$

← Back to Learn