Time dilation, length contraction and the relativity of simultaneity are three faces of one rule: the Lorentz transformation. It converts the coordinates $(x, t)$ of any event in frame $S$ to its coordinates $(x', t')$ in a frame $S'$ moving at $v$ along $x$, with the origins together at $t = t' = 0$.
🔑 Key idea
$$x' = \gamma(x - vt),\qquad t' = \gamma\left(t - \frac{vx}{c^2}\right).$$ To go back, swap the primes and change the sign of $v$: $x = \gamma(x' + vt')$, $t = \gamma\left(t' + \frac{vx'}{c^2}\right)$. With distances in light-years and times in years, $c = 1$ ly/yr and $v$ is just $\beta$.
💡 Why it works
Start from Galileo's $x' = x - vt$ and allow a stretch factor: $x' = \gamma(x - vt)$. By postulate 1, $S$ sees $S'$ move at $-v$ in the same way: $x = \gamma(x' + vt')$. Now use postulate 2. A flash from the shared origin at $t = 0$ moves as $x = ct$ in $S$ and $x' = ct'$ in $S'$. Substituting gives $ct' = \gamma(c - v)t$ and $ct = \gamma(c + v)t'$. Multiply: $c^2tt' = \gamma^2(c^2 - v^2)tt'$, so $\gamma = 1/\sqrt{1 - v^2/c^2}$. Finally, solve the two $x$ equations for $t'$: $$t' = \gamma\left(t - \frac{vx}{c^2}\right).$$ The $-\frac{vx}{c^2}$ term is the new part: clocks spread along $x$ disagree, which is the relativity of simultaneity.
A spacetime diagram with the moving frame's axes drawn in. Each event's $x'$ and $t'$ are read along the tilted axes; the dashed lines of equal $t'$ are tilted, so events level with each other in $S$ are not level in $S'$.
Worked examples
✏️ Worked example: Transform an event
In frame $S$ an event happens at $x = 4.0$ ly, $t = 2.0$ yr. Find its coordinates in a frame moving at $0.60c$ along $+x$.
$\gamma = 1.25$, and with $c = 1$ ly/yr, $v = 0.60$ ly/yr.
Two quick checks for any answer. A light flash moving as $x = ct$ in $S$ must come out as $x' = ct'$ in $S'$: try it, and the $\gamma$'s and $\beta$'s cancel. And at everyday speeds $\gamma \approx 1$ and $\frac{vx}{c^2}$ is tiny, so the transformation becomes Galileo's $x' = x - vt$ and $t' = t$, as it must.
⚠️ Common mistake
Dropping the $vx/c^2$ term and writing $t' = \gamma t$. That is time dilation for a clock at $x = 0$ only. For events elsewhere, the $-\frac{vx}{c^2}$ term carries the relativity of simultaneity, and leaving it out gives wrong times, even the wrong order of events. Check: two events with the same $t$ but different $x$ must get different $t'$.
Practice
Pass with 3 right answers, the last 2 in a row. Each right answer earns 3 XP.