A Byte of PhysicsLogo

Relativistic energy and momentum

Newtonian momentum \(p=mv\) and kinetic energy

\(K=\tfrac12mv^2\)

are excellent low-speed approximations. Near the speed of light, however, they cannot simultaneously conserve energy and momentum in every inertial frame. Special relativity replaces them with formulas that form one consistent energy–momentum structure.

Throughout this lesson, \(m\) is invariant mass, often called rest mass. It is the same for every inertial observer. The older phrase “relativistic mass” assigns the factor \(\gamma\) to mass, but it hides the cleaner modern idea: mass remains invariant while energy and momentum depend on frame.

Momentum at relativistic speed

For a particle of invariant mass \(m\) moving with three-velocity \(\mathbf v\), define

\[\gamma=\frac{1}{\sqrt{1-v^2/c^2}}\]

and

\[\mathbf p=\gamma m\mathbf v\]

The momentum vector points in the direction of velocity for a positive mass. Unlike \(m\mathbf v\), its magnitude rises without bound as \(v\to c\). This behavior makes momentum conservation compatible with Lorentz transformations.

At low speed, \(v^2/c^2\ll1\), so \(\gamma\approx1\) and the expression reduces to the Newtonian result \(\mathbf p\approx m\mathbf v\).

Total energy, rest energy, and kinetic energy

The total relativistic energy of a massive free particle is

\[E=\gamma mc^2\]

When the particle is at rest, \(\gamma=1\), so it still has rest energy

\[E_0=mc^2\]

Kinetic energy is the total energy minus rest energy:

\[K=E-E_0=(\gamma-1)mc^2\]

Energy is not created merely because an observer changes frames. Different observers divide a system's energy and momentum differently, while the invariant relations between them remain fixed.

The low-speed limit recovers the familiar kinetic-energy formula. Expanding the Lorentz factor for a small value of \(v/c\) gives

\[\gamma=1+\frac12\frac{v^2}{c^2}+\frac38\frac{v^4}{c^4}+\cdots\]

Therefore

\[K=(\gamma-1)mc^2\approx\frac12mv^2\]

The next terms quantify when the classical approximation begins to fail.

The energy–momentum relation

Energy and momentum are connected by

\[E^2=p^2c^2+m^2c^4\]

or equivalently

\[E^2-(pc)^2=(mc^2)^2\]

To verify it, substitute

\(E=\gamma mc^2\)

and \(p=\gamma mv\):

\[E^2-p^2c^2=\gamma^2m^2c^4\left(1-\frac{v^2}{c^2}\right)=m^2c^4\]

because \(\gamma^2(1-v^2/c^2)=1\). This is the momentum-space counterpart of the invariant spacetime interval.

Given energy and momentum, the invariant mass can be reconstructed:

\[m=\frac{1}{c^2}\sqrt{E^2-p^2c^2}\]

The square root is real for a free massive particle. In numerical work, directly subtracting two almost equal large numbers can lose precision when \(\gamma\) is very large. Use well-scaled quantities or an alternative stable representation in that regime.

Worked example at sixty percent of light speed

Let a particle of mass \(m\) move at \(v=0.60c\). Then

\[\gamma=\frac{1}{\sqrt{1-0.60^2}}=1.25\]

It is clearest to express the answers in multiples of the particle's rest energy and of \(mc\):

\[E=1.25mc^2,\qquad K=0.25mc^2,\qquad p=0.75mc\]

The invariant check is

\[E^2-(pc)^2=(1.25^2-0.75^2)m^2c^4=m^2c^4\]

because \(1.25^2-0.75^2=1\). This exact arithmetic makes the example useful as a software fixture.

import numpy as np

mass, c, beta = 1.0, 299792458.0, 0.6
gamma = 1 / np.sqrt(1 - beta**2)
rest_energy = mass * c**2
total_energy = gamma * rest_energy
momentum = gamma * mass * beta * c
kinetic_energy = total_energy - rest_energy
assert np.isclose(total_energy**2 - (momentum * c) ** 2, rest_energy**2)
print("Total and kinetic energy (J):", total_energy, kinetic_energy)

Why a massive particle cannot reach light speed

As \(v\to c\), the denominator of \(\gamma\) approaches zero. For any nonzero invariant mass,

\(E=\gamma mc^2\)

and \(p=\gamma mv\) grow without bound. No finite energy input can accelerate a massive particle to \(c\).

This conclusion is more precise than saying that a particle “gets infinitely massive.” Its invariant mass does not change. The required energy and momentum diverge.

Massless particles

The formulas involving \(\gamma m\) cannot be evaluated by setting \(m=0\) and \(v=c\) separately: that creates the indeterminate product of zero and an unbounded factor. Use the invariant equation instead. For a massless particle,

\[E=pc\]

Photons have zero invariant mass but nonzero energy and momentum. Their momentum is \(p=E/c\) and, using photon energy \(E=hf\), also \(p=h/\lambda\). They travel at \(c\) in vacuum; there is no photon rest frame.

Four-momentum

Energy and three-momentum form a four-vector:

\[P^\mu=\left(\frac{E}{c},\,\mathbf p\right)\]

Its Minkowski norm is invariant:

\[P^\mu P_\mu=\frac{E^2}{c^2}-p^2=m^2c^2\]

Under a Lorentz boost, energy and the momentum component parallel to the boost mix in the same way that time and position mix. For a boost in the positive \(x\) direction,

\[E'=\gamma(E-vp_x),\qquad p'_x=\gamma\left(p_x-\frac{vE}{c^2}\right)\]

while the transverse momentum components remain unchanged. A transformed energy must therefore be paired with transformed momentum; mixing quantities from two frames destroys the invariant check.

Systems, collisions, and invariant mass

For an isolated system, total energy and every component of total momentum are conserved:

\[E_{\mathrm{before}}=E_{\mathrm{after}},\qquad \mathbf p_{\mathrm{before}}=\mathbf p_{\mathrm{after}}\]

Add each particle's energy and vector momentum before applying the invariant relation:

\[M^2c^4=E_{\mathrm{system}}^2-c^2|\mathbf p_{\mathrm{system}}|^2\]

The system's invariant mass \(M\) need not equal the sum of its particles' individual rest masses. Kinetic energy, binding energy, and internal excitation contribute to the system's mass. Two photons traveling in opposite directions each have zero invariant mass, but the two-photon system can have positive invariant mass because its total momentum can be zero while its total energy is positive.

In the center-of-momentum frame, \(\mathbf p_{\mathrm{system}}=0\), so \(E_{\mathrm{system}}=Mc^2\). This frame is especially useful for threshold energies and collision analysis.

# Two opposing photons, each with energy 1 joule.
energies = np.array([1.0, 1.0])
momenta = np.array([[1 / c, 0.0, 0.0], [-1 / c, 0.0, 0.0]])
total_p = momenta.sum(axis=0)
system_mass = np.sqrt(energies.sum() ** 2 - c * c * np.dot(total_p, total_p)) / c**2
print("Invariant mass of the photon pair (kg):", system_mass)

The small tolerance handles roundoff near zero; it must not be used to hide a large negative value caused by mixed units or inconsistent frames.

Units and numerical care

In SI units, energy is in joules and momentum is in kilogram metres per second. Particle physics commonly reports energy in electronvolts and momentum in \(\mathrm{eV}/c\). Invariant mass may be reported in \(\mathrm{eV}/c^2\). Those factors of \(c\) are part of the unit and should not silently disappear unless natural units with \(c=1\) are explicitly declared.

A reliable single-particle calculation can be organized as follows:

def massive_particle_state(mass, velocity):
    velocity = np.asarray(velocity, dtype=float)
    beta_squared = np.dot(velocity, velocity) / c**2
    if mass <= 0 or beta_squared >= 1:
        raise ValueError("This velocity formula needs positive mass and speed below c.")
    gamma = 1 / np.sqrt(1 - beta_squared)
    # Stable gamma-1 avoids subtracting nearly equal numbers at low speeds.
    gamma_minus_one = gamma**2 * beta_squared / (gamma + 1)
    return gamma * mass * c * c, gamma_minus_one * mass * c * c, gamma * mass * velocity


print(massive_particle_state(1.0, [3.0, 0.0, 0.0]))

Test zero speed, a moderate exact case such as \(0.60c\), and a speed close to but below \(c\). Reject speeds at or above \(c\) for a massive-particle velocity input; do not clamp them, because clamping would replace an invalid state with a physically different one.

Work and changing momentum

Relativistic dynamics keeps the operational definition of force \(\mathbf F=d\mathbf p/dt\). Because momentum contains the speed-dependent Lorentz factor, force is not in general equal to mass times coordinate acceleration. The rate at which force transfers energy is \(dE/dt=\mathbf F\cdot\mathbf v\). These two relations remain compatible with \(E^2-p^2c^2=m^2c^4\).

For motion parallel to an applied force, ever more work produces progressively smaller increments of speed as the particle approaches \(c\), while its energy and momentum continue increasing. This is the experimentally useful prediction: particle accelerators deliver additional energy to a beam without pushing a massive particle through the light-speed boundary.

The equations here concern special relativity in flat spacetime. They do not by themselves model gravity, radiation reaction, quantum particle creation, or forces during a finite interaction. They do provide the correct conservation bookkeeping for relativistic reactions once every relevant particle and field crossing the chosen system boundary is included.

A worked Python notebook

Compare the total relativistic energy of a massive particle with its rest energy. The question for this calculation is precise: how does total energy divided by rest energy change when we change speed fraction, while keeping the other choices fixed? The earlier sections explain the physical relationship. Here we turn one part of that relationship into a calculation that you can run, inspect, and change in Google Colab.

The ratio is defined for positive rest mass and subluminal speed. Keep that sentence beside the results. A formula can return a number outside its useful range, and a plotting library will usually draw that number without asking whether the physical assumptions still hold. The selected interval is from 0 to 0.9 dimensionless. It gives us a specific domain to discuss instead of leaving the graph's range to a software default.

Use the notebook link above the lesson, run the setup cell, and then run the cells in order. The code below is also included there. NumPy handles the arrays of numerical values, SymPy keeps the equation symbolic, and Matplotlib draws the results. If these libraries or notebook cells are unfamiliar, start with Your first physics notebook.

State the relationship before choosing a graph

In this small example, q stands for speed fraction, expressed in dimensionless. The output is total energy divided by rest energy, expressed in dimensionless. The equation below uses the numerical values in those units. Any fixed coefficients therefore carry the units needed to make the relation consistent. A value supplied in another unit must be converted before it enters this expression.

\[f(q) = \frac{1}{\sqrt{1 - q^{2}}}\]

This is a function of one changing input. It is not a statement that the physical system has only one variable. We deliberately hold the other inputs fixed so that one cause of variation is visible. Changing several inputs at once would make it harder to tell which change produced the output difference. Write down the held-fixed choices before trying a different experiment.

At 0.6 dimensionless, the expression gives 1.25 dimensionless. This is our reference calculation. It is a prediction of the stated example, not a new measurement. Its displayed digits help us compare implementations. They should not be read as a claim that physical inputs are known to six significant figures.

import numpy as np
import sympy as sp
import matplotlib.pyplot as plt

q = sp.Symbol("q", real=True)
expression = sp.sympify("1/sqrt(1-q**2)", locals={"q": q})
reference_input = 0.6
reference_output = float(expression.subs(q, reference_input))
print("Input:", reference_input, "dimensionless")
print(
    "Predicted total energy divided by rest energy:", reference_output, "dimensionless"
)

sp.Symbol declares a mathematical symbol. It does not assign a numerical measurement to that symbol. subs then replaces the symbol with our chosen input, and float converts the resulting symbolic number into a standard Python numerical value. Keeping these steps separate lets us inspect the equation before numerical substitution. It also prevents a later plot from becoming the only surviving record of the model.

Compare a few cases you can explain

Before drawing hundreds of points, calculate three. The lower endpoint gives 1 dimensionless. The midpoint, at 0.45 dimensionless, gives 1.11979 dimensionless. The upper endpoint gives 2.29416 dimensionless. Read these together with the assumptions: they describe different choices of speed fraction within the same example, with the other inputs held fixed.

These three values are a useful first check, but they do not establish the shape between them. Two endpoints can be equal even when the curve bends or oscillates in between. Likewise, a large change between endpoints does not tell us whether the relationship is linear. We need the equation and intermediate samples to answer those questions.

evaluate = sp.lambdify(q, expression, modules="numpy")
inputs = np.array([0.0, 0.45, 0.9])
outputs = np.asarray(evaluate(inputs), dtype=float)
outputs = np.broadcast_to(outputs, inputs.shape)
for input_value, output_value in zip(inputs, outputs):
    print(f"{input_value:.6g} dimensionless -> {output_value:.6g} dimensionless")
assert np.all(np.isfinite(outputs))

lambdify turns the symbolic expression into a numerical function. We explicitly select NumPy as its numerical backend so it can accept an array. The same expression now has two useful forms: one for algebra and one for calculating many cases. The assertion checks that the chosen inputs produce finite outputs. It would catch an infinity or an undefined numerical result, but a finite value can still be physically inappropriate.

Make a graph that answers the question

The horizontal axis shows speed fraction; the vertical axis shows total energy divided by rest energy. Every plotted point is a prediction of the same expression. We mark the reference case separately so that a reader can connect the earlier printed value to its place on the curve. The axis labels include units because a shape without a scale cannot tell us the size of a physical effect.

input_grid = np.linspace(0.0, 0.9, 301)
output_grid = np.asarray(evaluate(input_grid), dtype=float)
output_grid = np.broadcast_to(output_grid, input_grid.shape)
fig, ax = plt.subplots(figsize=(7, 4))
ax.plot(input_grid, output_grid, label="Stated model")
ax.scatter([reference_input], [reference_output], label="Reference case", zorder=3)
ax.set_xlabel("Speed fraction (dimensionless)")
ax.set_ylabel("Total energy divided by rest energy (dimensionless)")
ax.legend()
ax.grid(alpha=0.25)
fig.tight_layout()
plt.show()

Look for a sign change, a turning point, or a region where the curve becomes steep. Connect each feature to the expression rather than to the colour of the line. If the curve has a minimum or maximum, changing the input in opposite directions may have similar effects on the output near that point. If it is nearly straight over a short interval, a local linear approximation may be useful even when the complete expression is nonlinear.

Increasing the number of samples makes the line smoother and may reveal features that a coarse grid missed. It does not improve the physical inputs or enlarge the model's validity range. For quantities that can take only discrete values, use the line as a guide to the relationship and interpret only the allowed input values. A plotting function does not enforce such restrictions for you.

Measure the local sensitivity

A derivative asks a more specific question than the whole graph: how quickly does total energy divided by rest energy change near the reference input? Its units are the output unit divided by the input unit. For this calculation, the derivative at 0.6 dimensionless is 1.17188 in those ratio units. Locally, the output increases as the input increases. This statement is local; the sign or size of the slope can be different elsewhere on the curve.

\[f'(q) = \frac{q}{\left(1 - q^{2}\right)^{\frac{3}{2}}}\]

For a small input change, multiply the derivative by that change to estimate the output change. Then compare that estimate with a fresh evaluation of the full expression. The distinction between these two calculations matters: the derivative gives a tangent approximation, while substitution evaluates the chosen expression at the new point.

slope_expression = sp.diff(expression, q)
slope_at_reference = float(slope_expression.subs(q, reference_input))
changed_input = 0.6044999999999999
linear_prediction = reference_output + slope_at_reference * (
    changed_input - reference_input
)
full_prediction = float(evaluate(changed_input))
print("Symbolic derivative:", slope_expression)
print("Tangent prediction:", linear_prediction, "dimensionless")
print("Full expression:", full_prediction, "dimensionless")
print("Approximation difference:", full_prediction - linear_prediction, "dimensionless")

Here the changed input is 0.6045 dimensionless. The tangent estimate is 1.25527 dimensionless, while the full expression gives 1.25533 dimensionless. If the two values are close, it means the chosen input change is small enough for this local approximation at this point. It does not mean the entire model is linear. If the slope is zero, a quadratic or higher-order term may supply the leading change instead.

This is also the beginning of uncertainty propagation. If the input has a small stated standard uncertainty, the magnitude of the slope times that uncertainty estimates one contribution to output uncertainty. Do not automatically use the same rule for a wide interval, a discontinuity, a turning point with zero first derivative, or several correlated uncertain inputs. Those situations need more of the model than one slope.

Check the derivative with numerical differences

We can estimate the same slope from values on either side of the reference point. Subtract the lower output from the upper output and divide by twice the input step. Parentheses are essential: the entire output difference must be divided by the entire input interval. Without them, Python can execute a different mathematical expression while still producing a plausible number.

The calculation below uses three decreasing step sizes. Each estimate is compared with the symbolic derivative, so the reference is independent of the numerical difference formula. Near an endpoint, it is acceptable here to evaluate a small extension only because the displayed mathematical expression is smooth there; such a check does not assert that extrapolated values describe additional physical cases.

input_span = 0.9
for fraction in [1e-2, 1e-3, 1e-4]:
    step = input_span * fraction
    upper = float(evaluate(reference_input + step))
    lower = float(evaluate(reference_input - step))
    numerical_slope = (upper - lower) / (2 * step)
    difference = numerical_slope - slope_at_reference
    print(f"step={step:.6g}: slope={numerical_slope:.6g}, difference={difference:.6g}")

For a smooth function, reducing the step often reduces the approximation error at first. Very small steps can eventually make subtraction of nearly equal floating-point values less reliable. Therefore “smaller” is not an unlimited guarantee of “better.” Compare the observed behaviour over a useful range of steps instead of choosing the smallest number the computer can represent.

An absolute slope difference is useful when the expected slope is near zero. A relative difference would divide by a very small reference and could look enormous even when the absolute discrepancy is tiny. Away from zero, a relative difference can help compare quantities with very different scales. The tolerance should reflect the question and the numerical method, rather than a universal decimal threshold copied into every test.

Change the example and preserve the reasoning

Make one copy of the reference calculation before editing it. Choose a second value of speed fraction inside the stated interval, predict whether total energy divided by rest energy will rise or fall, and then evaluate the expression. Place the prediction and the result in a text cell. If they disagree, identify whether the mistake was in the sign, the unit conversion, the algebra, or the assumption about how the curve behaves.

Next choose a shorter plotting interval around the reference point. Compare the local curve with its tangent approximation. Then widen the interval again. The difference shows why a useful local estimate need not describe the whole range. Keep the axis labels and numerical scale visible when comparing the plots; automatic axis limits can make two different effects appear equally large.

Finally, return to the physical limit stated at the start: The ratio is defined for positive rest mass and subluminal speed. Describe one change to the setup that would violate that limit. State what new input, equation, or observation would be needed before trusting an answer in the changed situation. This last step connects the Python experiment to the physics instead of treating successful execution as the only criterion for a useful result.

Before saving, restart the runtime and run all cells in order. A result that depends on an earlier, now-deleted input cell is not reproducible from the saved notebook. Keep unrounded values for later calculations, round only the reported output, and label any new data as measured, assumed, or generated. The graph and printed values should remain traceable to the same expression and the same choices of inputs.

Recover the output change by integrating the slope

There is another way to check that the expression and its derivative describe the same relationship. Add up the small output changes predicted by the slope across the chosen input interval. In the continuous limit, this integral equals the output at the upper endpoint minus the output at the lower endpoint. The result has units of dimensionless: the input unit in the integration cancels the input unit in the denominator of the slope.

This statement is about the mathematics of this particular relationship. It does not assign a new physical meaning to an arbitrary area under a graph. For example, an area under force versus distance represents work, while an area under a different pair of quantities may represent something else or have no standard name. Always carry the axis units through the calculation before naming an integral.

slope_function = sp.lambdify(q, slope_expression, modules="numpy")
endpoint_change = float(evaluate(0.9) - evaluate(0.0))
for points in [101, 201, 401]:
    grid = np.linspace(0.0, 0.9, points)
    slopes = np.asarray(slope_function(grid), dtype=float)
    slopes = np.broadcast_to(slopes, grid.shape)
    integrated_change = np.trapezoid(slopes, grid)
    print(
        points,
        "integrated change:",
        integrated_change,
        "endpoint change:",
        endpoint_change,
    )

The trapezoidal rule joins neighbouring slope samples with straight segments and adds their signed areas. A negative contribution remains negative; replacing every slope by its magnitude would calculate a different quantity. Increasing the sample count provides a practical refinement check. If the values do not settle toward the endpoint difference, first inspect the interval, singularities, and array ordering.

Do not conclude that two agreeing calculations prove the model is physically complete. Both use the same selected relationship, so an omitted effect would be omitted from both. Their agreement is evidence that the numerical tools implement that relationship consistently. Comparing with an independent experiment or a more appropriate physical model is a separate test.

Keep this comparison in the notebook when you change the expression. It is particularly useful after adding a coefficient, changing a sign convention, or converting an input unit. A code cell that produces a smooth graph can conceal these mistakes; a second calculation of the same output change gives you another place to notice them.

Sources


Share to: