Hello again. Last lesson, you showed that the relative orbit stays in a fixed plane because its specific angular-momentum vector is constant. Today we will derive a second constraint: specific mechanical energy is constant, even though speed and distance can change substantially. We will then turn both conservation laws into checks that can expose errors in a computed trajectory before its animation has a chance to look convincing.
Deriving energy from the equation of motion
Keep the relative position and velocity from the previous lessons:
Write . For , the two-body relative equation is
To discover what happens to speed, take the dot product with . The left-hand side is the rate of change of half the squared speed:
On the right, distance changes at a rate determined by the component of velocity along the separation. Differentiating gives
Thus the equation of motion implies
Now notice that the term on the right is the negative rate of change of :
Adding these rates leaves zero. We have derived, rather than assumed,
Here (epsilon) is the specific mechanical energy of the relative motion. Its first term is specific kinetic energy; its second is specific gravitational potential energy. “Specific” means per unit reduced mass, not per unit mass of whichever physical body happens to be labelled body 2.
For a second presentation of the dot-product derivation, consult slides 47–51 of Orbital Mechanics & Spacecraft Attitudes for Thermal Engineers. The PDF’s extracted mathematical symbols can appear garbled, so use the equations as displayed on the slides.
Orbital Mechanics & Spacecraft Attitudes for Thermal Engineers
This presentation develops the specific-energy constant directly from the two-body governing equation. Read it to compare each step with the derivation above.
On slides 47–51, under “Conservation of Specific Mechanical Energy,” begin with the sentence “To show conservation of specific mechanical energy, form the dot product of the governing differential equation with” and read through the result at the end of slide 51. Track where the dot product becomes a derivative of squared speed and where the radial term becomes a derivative of inverse distance. The slides use the symbol \mu for our \gamma=G(m_1+m_2), not for reduced mass.
The negative sign in the potential term is worth fixing in your mental model. We choose gravitational potential energy to approach zero as approaches infinity. At any finite positive separation, is negative. When the bodies move farther apart, this term increases toward zero, while the kinetic term must decrease by the same amount. Neither term is generally constant on its own.
Relating “specific” energy to the two physical bodies
Let , let , and let be the barycentre’s velocity. The mechanical energy of the full pair, in an inertial frame, is
Using the centre-of-mass decomposition from earlier in the module, this becomes
The first term is kinetic energy of the uniformly moving barycentre. The second is energy of the relative motion. Both are constant for the isolated pair. In a barycentric rest frame, , so .
This distinction prevents a common diagnostic mistake. If both bodies move, calculating from body 2’s velocity in an arbitrary inertial frame is not the exact specific energy derived above. Use the relative velocity and . Treating the larger body as fixed and using only its mass is a useful approximation when the other mass is negligible, but it is not our exact two-body model.
What energy and angular momentum constrain differently
The energy equation can be rearranged to give speed at a known separation:
It says nothing by itself about the direction of the velocity. Last lesson’s invariant,
supplies complementary information. In the orbital plane, split velocity into a radial component and a transverse component . Since the radial component is parallel to , it contributes nothing to their cross product:
For example, use dimensionless units with , and start at with purely transverse speed . Then and . If the separation later reaches , energy requires speed squared to be approximately , while angular momentum requires transverse speed . The remaining radial speed has magnitude approximately . A computed state at that distance with the correct total speed but zero transverse speed would pass the energy check and fail the angular-momentum check.
These are necessary checks, not a complete proof that a trajectory is correct. A program might preserve both constants yet follow the wrong timing or initial conditions. But a substantial change in either constant cannot be part of an exact, collision-free solution of the isolated Newtonian two-body equations.
Before constructing the numerical checks, watch the selected portions of Python Physics Lesson 8: Orbits, Energy, and Graphs from Dot Physics. Its spacecraft calculation holds the larger body fixed; focus on the diagnostic idea rather than treating that assumption as exact for two comparable masses.
Python Physics Lesson 8: Orbits, Energy, and Graphs
The video makes the kinetic–potential exchange visible on plots and shows how a changed timestep can spoil the apparent conservation of total energy.
Watch energy definitions for the quantities being plotted, then the energy plots for the changing kinetic and potential terms, and finally the timestep test. Focus on constancy of their sum, not whether its value is zero: the conserved total is set by the initial state.
Making invariants into trajectory checks
Suppose your simulator records relative positions and velocities at times . Compute both invariants from every position–velocity pair at the same time:
Compare each with its initial value. Energy error is a scalar difference; for angular momentum, compare the vector, not just its magnitude. An unchanged magnitude with a turning direction would conceal a violation of the fixed-plane result.
Here is a small NumPy diagnostic, assuming d and u are arrays with one three-component vector per recorded time and gamma is constant:
import numpy as np
r = np.linalg.norm(d, axis=1)
if np.any(r == 0):
raise ValueError("The point-mass model is undefined at zero separation.")
eps = 0.5 * np.sum(u * u, axis=1) - gamma / r
h = np.cross(d, u)
eps_scale = 0.5 * np.dot(u[0], u[0]) + gamma / r[0]
h_initial = np.linalg.norm(h[0])
h_scale = h_initial if h_initial > 0 else r[0] * np.sqrt(gamma / r[0])
energy_error = np.abs(eps - eps[0]) / eps_scale
angular_error = np.linalg.norm(h - h[0], axis=1) / h_scale
These positive scales make runs with different units or orbital sizes easier to compare. Using alone as an energy-error denominator can be misleading when the positive kinetic and negative potential terms nearly cancel. In the radial case , dividing by its magnitude is impossible; the code instead uses a characteristic angular-momentum scale. You can also retain the unscaled differences when their physical units matter.
Plots of both error series against time help you distinguish a brief excursion from error that accumulates throughout a run. Large errors may indicate a timestep that is too coarse, a force or sign error, inconsistent units, mismatched position and velocity timestamps, or an integrator ill-suited to the run. Conversely, small invariant errors are encouraging but do not replace comparison with known solutions and timestep refinement. Later, you will use those additional tests to judge your integrators.
Key takeaways
Dotting the relative gravitational equation with relative velocity gives the conserved quantity
It describes kinetic–potential exchange in the relative motion. To check a simulated isolated pair, calculate this specific energy and the specific angular-momentum vector from consistently timed relative states, and monitor how far each departs from its initial value. Energy checks the speed–distance relationship; angular momentum also tests the transverse motion and orbital plane.
Next, these same constants will do more than diagnose a simulation: they will help identify which distances an orbit can reach and whether a circular orbit is possible.