What you'll learn
- Compute time dilation with the Lorentz factor
- Apply length contraction along the direction of motion
- Explain why cosmic-ray muons reach the ground
- Compute gamma - 1 accurately at everyday speeds with log1p and expm1
Compute the Lorentz factor, time dilation and length contraction, and avoid the round-off trap at everyday speeds.
Why it matters
Special relativity is not only for astrophysics. Particle accelerators, cosmic-ray detectors and GPS receivers all need it to give correct answers. Muons made in the upper atmosphere reach the ground only because their clocks run slow in our frame, and GPS satellite clocks would drift by microseconds a day without relativistic corrections. As a physicist you will compute these effects often, and the calculation has a numerical trap that is worth learning early.
The core idea
Einstein's two postulates are simple: the laws of physics are the same in every inertialDescribes a non-accelerating frame of reference, in which the laws of physics take the same form. (non-accelerating) frame, and light in a vacuum travels at the same speed c = 299,792,458 m/s for every observer. Everything else follows from taking the second one seriously.
The key quantity is the Lorentz factorgamma = 1 / sqrt(1 - v^2/c^2); it is 1 at rest and grows without limit as the speed approaches c.:
beta = v / c
gamma = 1 / sqrt(1 - beta^2)gammais 1 at rest and grows without limit asvapproachesc.- Time dilationA moving clock ticks slowly: a process lasting the proper time t0 is measured as gamma * t0.: a clock moving at speed
vticks slowly. If a process takes the proper timeThe time measured by a clock at rest relative to the process; the dilated time is always longer.t0in its own rest frame, we measuret = gamma * t0. - Length contractionAn object of rest length L0 is measured as L0 / gamma along its direction of motion.: an object of rest length
L0is measured asL = L0 / gammaalong the direction of motion. - Energy: total energy is
E = gamma * m * c^2, and kinetic energy is(gamma - 1) * m * c^2.
At 60% of light speed, beta = 0.6, 1 - 0.36 = 0.64, sqrt(0.64) = 0.8, so gamma = 1.25. At 80%, gamma = 1 / 0.6 = 5/3.
Worked example: cosmic-ray muons
A muon has a mean lifetime of 2.197 µs in its own rest frame. Muons are created about 10 to 15 km up and many travel at around 0.995 c.
beta^2 = 0.995^2 = 0.990025
gamma = 1 / sqrt(0.009975) = 1 / 0.099875 = 10.01
t (lab) = 10.01 * 2.197 µs = 22.0 µs
distance in one lifetime = 0.995 * 2.998e8 m/s * 22.0e-6 s = 6.56 kmWithout time dilation they would travel only about 655 m in one lifetime, so almost none would reach a detector at sea level. In the muon's own frame the explanation is length contraction instead: the atmosphere is about ten times thinner. Both frames agree on what the detector counts.
Worked example: the round-off trap
GPS satellites move at about 3.9 km/s. Here beta^2 is about 1.7e-10, so gamma - 1 is about 8.5e-11. A double-precision float carries about 16 significant digits, and 1 - beta^2 sits so close to 1 that most of those digits are spent on the leading 1. Subtracting 1 from gamma afterwards throws away the digits you wanted.
import math
c = 299_792_458.0
v = 300.0 # an airliner, in m/s
b2 = (v / c) ** 2 # about 1.0e-12
naive = 1 / math.sqrt(1 - b2) - 1 # only a few correct digits
stable = math.expm1(-0.5 * math.log1p(-b2)) # full precision
series = b2 / 2 + 3 * b2**2 / 8 # Taylor series check
print(naive, stable, series)math.log1p(x) computes ln(1 + x) and math.expm1(x) computes e^x - 1, both accurately for tiny x. Since gamma = (1 - b2)^(-1/2) = exp(-0.5 * ln(1 - b2)), the stable form gives gamma - 1 directly. This pattern (rewrite to avoid subtracting nearly equal numbers) appears all over computational physics.
For scale: the satellite's speed makes its clock lose about 7 µs per day, while the weaker gravity at orbit (a general relativity effect) makes it gain about 45 µs per day. The net is about +38 µs per day, which would cause kilometres of position error a day if not corrected.
Common mistakes
- Mixing up which time is proper time. The proper time is measured by a clock at rest relative to the process (the muon's own clock). The dilated time is always the longer one.
- Forgetting units. Keep
vandcin the same units, or work inbetafrom the start. - Allowing
v >= c. A massive object can't reachc; your code should reject it rather than returninfor a complex number. - Using
gamma - 1computed naively for slow speeds, then trusting the digits. - Expecting contraction across the motion. Only lengths along the direction of motion contract.
Recap
gamma = 1 / sqrt(1 - v^2/c^2);t = gamma * t0;L = L0 / gamma;E = gamma * m * c^2.- Muons reaching the ground are direct evidence of time dilation.
- For small speeds, compute
gamma - 1withlog1p/expm1or a series, never by subtracting.
Try it
Open the Do tab and write a small relativity toolkit, including a precise gamma - 1 for slow speeds.
Key terms (5)
- Lorentz factor
- gamma = 1 / sqrt(1 - v^2/c^2); it is 1 at rest and grows without limit as the speed approaches c.
- time dilation
- A moving clock ticks slowly: a process lasting the proper time t0 is measured as gamma * t0.
- proper time
- The time measured by a clock at rest relative to the process; the dilated time is always longer.
- length contraction
- An object of rest length L0 is measured as L0 / gamma along its direction of motion.
- inertial
- Describes a non-accelerating frame of reference, in which the laws of physics take the same form.