A Byte of PhysicsLogo

Time dilation and length contraction

Special relativity does not give a moving object a mysterious new internal property called “dilated time” or “contracted length.” Instead, observers in different inertial frames use different pairs of events when they measure time and length. The formulas become much easier to use correctly once those events and frames are named.

The two key quantities are proper time and proper length:

“Proper” means “measured in the special frame that makes the definition possible,” not “more correct.” Every inertial frame is physically valid.

The Lorentz factor

For relative speed \(v\), define

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

where \(c\) is the speed of light in vacuum. Because a physical inertial frame has \(|v|<c\), the Lorentz factor satisfies \(\gamma\geq1\). It depends on speed, not direction, because \(v^2\) appears in the formula.

Some useful values show how slowly relativistic effects begin and how rapidly they grow near light speed:

SpeedLorentz factor
\(0\)\(1\)
\(0.10c\)\(1.005\)
\(0.60c\)\(1.25\)
\(0.80c\)\(1.667\)
\(0.99c\)\(7.09\)

At everyday speeds, \(v^2/c^2\) is so small that \(\gamma\) is almost indistinguishable from one. Newtonian physics is therefore the low-speed limit, not a competing theory with an unrelated answer.

Proper time and time dilation

Consider two ticks of a clock moving relative to a laboratory. In the clock's rest frame, both tick events occur at the same position. The time recorded by that one clock is the proper-time interval \(\Delta\tau\). The laboratory assigns the ticks a coordinate-time separation \(\Delta t\):

\[\Delta t=\gamma\Delta\tau\]

Since \(\gamma\geq1\), the coordinate interval is at least as large as the proper interval. In this precise sense, a moving clock accumulates less proper time between the two meetings than the coordinate time assigned by the frame in which it moves.

The equation follows directly from the invariant interval. For two ticks of the same clock, their separation in the clock frame is \(\Delta x'=0\). Therefore

\[c^2\Delta\tau^2=c^2\Delta t^2-\Delta x^2\]

and because the clock moves \(\Delta x=v\Delta t\),

\[\Delta\tau=\Delta t\sqrt{1-\frac{v^2}{c^2}}=\frac{\Delta t}{\gamma}\]

This derivation reveals the measurement conditions rather than treating the formula as a slogan.

Time-dilation example

A spacecraft passes Earth at \(v=0.60c\). Two events occur at the spacecraft: its onboard clock reads zero when it passes one marker and two seconds when it passes another. The spacecraft clock is present at both events, so \(\Delta\tau=2.0\,\mathrm{s}\). With \(\gamma=1.25\),

\[\Delta t=\gamma\Delta\tau=(1.25)(2.0\,\mathrm{s})=2.5\,\mathrm{s}\]

Earth's synchronized clocks assign a 2.5-second interval between those events. That does not mean that a broken clock loses time. The spacecraft clock behaves normally in its own frame and measures its own proper time.

The calculation in narrow Python is:

import numpy as np

beta, proper_duration = 0.6, 2.0
gamma = 1 / np.sqrt(1 - beta**2)
coordinate_duration = gamma * proper_duration
print(f"Coordinate duration: {coordinate_duration:.2f} s")

Reciprocity is not a contradiction

During uniform relative motion, each observer can say that the other's clock runs slowly. This is reciprocal because the observers use different sets of distant synchronized clocks and disagree about which distant events are simultaneous. There is no contradiction while they remain in different inertial frames and do not reunite.

If two travelers separate and later meet, their accumulated proper times can be compared at the same final event. The paths through spacetime are then different. At least one traveler must change inertial frames to turn around, so the simple symmetry of one unchanging pair of inertial frames no longer describes the whole journey. Proper time along any path is

\[\Delta\tau=\int\sqrt{1-\frac{v(t)^2}{c^2}}\,dt\]

Acceleration identifies where the paths cease to be symmetric, but the age difference is calculated from the complete spacetime paths, not from a claim that acceleration directly slows a clock.

Proper length and length contraction

Let a straight rod have proper length \(L_0\). In its rest frame, measure both endpoint positions at the same rest-frame time and subtract them. An observer who sees the rod move parallel to its length must also measure the two endpoints simultaneously—but simultaneously in the observer's own frame. That observer obtains

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

Thus \(L\leq L_0\). Only the dimension parallel to the relative velocity contracts. Transverse dimensions do not acquire the same factor.

The simultaneity requirement is essential. Measuring the front endpoint now and the rear endpoint later does not determine the rod's length in that frame, because the rod moves between measurements. This is why length contraction is not obtained by transforming one fixed pair of endpoint events: the event pair that is simultaneous in one frame is generally not simultaneous in the other.

Deriving contraction from event coordinates

In the rod's rest frame \(S'\), its endpoints remain at \(x'_A=0\) and \(x'_B=L_0\). An observer in \(S\) measures their positions at events satisfying \(\Delta t=0\). The Lorentz separation equation gives

\[\Delta x'=\gamma(\Delta x-v\Delta t)=\gamma\Delta x\]

Here \(\Delta x'=L_0\) and \(\Delta x=L\), so \(L_0=\gamma L\), which gives the contraction equation.

Length-contraction example

A spacecraft has proper length

\(L_0=10.0\,\mathrm{m}\)

and moves past Earth at \(0.60c\). Earth observers use synchronized Earth clocks to record the front and rear positions at one Earth-frame time. They obtain

\[L=\frac{10.0\,\mathrm{m}}{1.25}=8.0\,\mathrm{m}\]

The spacecraft crew still measures ten metres because the spacecraft is at rest in their frame. Conversely, they assign contracted distances to Earth-bound objects along the direction of motion. The statements refer to different simultaneous endpoint events, so they are compatible.

proper_length = 10.0
measured_length = proper_length / gamma
print(f"Simultaneously measured moving length: {measured_length:.2f} m")

Why muons reach Earth's surface

Cosmic-ray collisions high in the atmosphere create unstable muons. A muon at rest has a mean lifetime of about \(2.2\,\mu\mathrm{s}\). At relativistic speeds, Earth's frame assigns the moving muons a longer mean lifetime, so many can cross a much greater atmospheric distance than a nonrelativistic estimate predicts.

The muon's frame gives an equivalent account. The muon's lifetime is its proper time, but the atmosphere moves toward it and is length-contracted. The ground is therefore close enough to arrive during the muon's short proper lifetime. Time dilation and length contraction are not two independent tricks; they are two frame-dependent consequences of the same Lorentz geometry.

Turning a word problem into a reliable calculation

Before selecting a formula, identify which quantity is proper:

# Events at the same moving clock have dx'=0 in the clock's rest frame.
rest_dt, rest_dx = 2.0, 0.0
lab_dt = gamma * (rest_dt + beta * rest_dx)
lab_dx = gamma * (rest_dx + beta * rest_dt)  # Light-seconds.
assert np.isclose(lab_dt**2 - lab_dx**2, rest_dt**2 - rest_dx**2)
print("Laboratory event separation:", lab_dt, lab_dx)

Then calculate without rounding the Lorentz factor too early:

def relativistic_measurements(beta, proper_duration, proper_length):
    if abs(beta) >= 1:
        raise ValueError("Use a speed fraction strictly below one in magnitude.")
    gamma = 1 / np.sqrt(1 - beta**2)
    return gamma * proper_duration, proper_length / gamma


print(relativistic_measurements(0.6, 2.0, 10.0))

Notice that the two formulas use reciprocal factors. A program that mistakenly multiplies both quantities will still pass a zero-speed test, because \(\gamma=1\) at zero. Include a nonzero test such as \(v=0.60c\), where the exact, easy-to-recognize factor is \(\gamma=1.25\).

Checks and common errors

Several checks should agree:

A frequent error is to call any short time “proper time.” The defining test is co-location of the two events in that clock's rest frame. Another error is to use length contraction for a dimension perpendicular to motion. A third is to treat the equations as optical appearance. Photographs include unequal light-travel times from different parts of an object and can show rotation-like effects; coordinate length is what synchronized measurements produce after those delays are accounted for.

These formulas describe comparisons between inertial frames in flat spacetime. They do not include gravitational time dilation. They also do not justify a perfectly rigid accelerating rod: changes in motion propagate through matter at finite speed, and maintaining a constant proper shape during acceleration requires a carefully varying acceleration along the rod. For arbitrary motion, work with events and integrate proper time along each worldline.

A worked Python notebook

Observe two ticks of a moving clock that are separated by two seconds in its rest frame. The question for this calculation is precise: how does coordinate duration for 2 s proper time 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 two events occur at the same clock in the proper-time frame. 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 coordinate duration for 2 s proper time, expressed in s. 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{2}{\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 2.5 s. 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("2/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 coordinate duration for 2 s proper time:", reference_output, "s")

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 2 s. The midpoint, at 0.45 dimensionless, gives 2.23957 s. The upper endpoint gives 4.58831 s. 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} s")
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 coordinate duration for 2 s proper time. 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("Coordinate duration for 2 s proper time (s)")
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 coordinate duration for 2 s proper time 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 2.34375 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{2 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, "s")
print("Full expression:", full_prediction, "s")
print("Approximation difference:", full_prediction - linear_prediction, "s")

Here the changed input is 0.6045 dimensionless. The tangent estimate is 2.51055 s, while the full expression gives 2.51065 s. 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 coordinate duration for 2 s proper time 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 two events occur at the same clock in the proper-time frame. 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 s: 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: