One rule to convert between observers
So far each surprise — time dilation, length contraction, the slipping of clocks — has come from its own little thought experiment. The Lorentz transformation gathers them all into a single master rule. Give it the place and time of an event as *you* measure them, tell it how fast a friend is gliding past at speed v, and it hands back the place and time *they* measure for the very same event. Every earlier result is just one special case of this one formula.
You measure an event at position x, time t.
A friend glides past in the +x direction at speed v.
They measure the SAME event at x', t':
x' = gamma * ( x - v * t )
t' = gamma * ( t - v * x / c^2 )
with gamma = 1 / sqrt(1 - v^2/c^2)
(Old common sense said simply x' = x - v*t and t' = t.
That is what you get when v is tiny, so gamma -> 1.)Speeds don't simply add — and light always wins
Here is a puzzle the master rule must solve. You are on a train doing 0.6c, and you fire a ball forward at 0.6c relative to the train. Old arithmetic says 0.6c + 0.6c = 1.2c — faster than light! That cannot be right. The Lorentz transformation replaces plain addition with relativistic velocity addition:
Train moves at u = 0.6c. Ball thrown at w = 0.6c (relative to train).
Ground speed is NOT u + w, but:
u + w 0.6c + 0.6c 1.2c
V = ------------- = ----------------- = ------ = 0.882c
1 + u*w/c^2 1 + (0.6)(0.6) 1.36
Now shine a flashlight instead (w = c):
u + c 0.6c + c 1.6c
V = ----------- = -------------- = ------ = c
1 + u*c/c^2 1 + 0.6 1.6
Light comes out at c. It always does.The twin paradox: who really ages less?
Two twins, Alice and Bob. Alice rockets off to a star at high speed and comes back; Bob stays home. Time dilation says Alice's moving clock ran slow, so she returns younger than Bob. But — and this is the famous twin paradox — from Alice's seat it was *Bob* who flew away and came back, so shouldn't *Bob* be the younger one? They can't both be right when they stand face to face. Someone really is younger.
The cleanest way to see who wins is proper time — the time an actual clock carried along a path records. Bob's path through spacetime is a single straight run from parting to reunion. Alice's path bends in the middle. Of all paths between the same two meeting-events, the straight one always logs the most time. So Bob, the stay-at-home, ages more; Alice, who took the bent path, comes back younger. No paradox — just two different routes between the same two points.
Putting numbers on the trip
Let's make it concrete. Alice travels to a star 8 light-years away and back at v = 0.8c. By Bob's clock the round trip takes 16 / 0.8 = 20 years. At 0.8c the Lorentz factor is gamma = 1/sqrt(1 - 0.64) = 1.667, so Alice's onboard clock — her proper time — logs only 20 / 1.667 = 12 years. Both numbers are facts they can compare the instant they hug again.
import math
v = 0.8 # in units of c
dist = 8.0 # light-years to the star (one way)
gamma = 1 / math.sqrt(1 - v**2)
bob_years = 2 * dist / v # stay-at-home, the straight path
alice_years = bob_years / gamma # traveler's proper time
print(f"gamma = {gamma:.3f}") # gamma = 1.667
print(f"Bob ages = {bob_years:.1f} years") # Bob ages = 20.0 years
print(f"Alice ages = {alice_years:.1f} years") # Alice ages = 12.0 years
print(f"Difference = {bob_years - alice_years:.1f} years") # 8.0 years