To understand why this happens, we can look at
the picture to the left. Let's say we are in a train and had a
laser shining off of a mirror and reflecting back. The light would
travel a certain distance. Now, let's say the train is moving
fast compared to the ground. Someone looking into the train from
the ground would see the light travel similar to the second diagram;
however someone inside the train sees the light travel similar
to the first diagram. The distance the light travels in the perspective
of someone on the ground is greater than the distance it travels
from the perspective of someone in the train. Because we know
that light always travels at a constant speed, c, so the light
cannot be speeding up or slowing down. So how could the light
travel two distances in the same amount of time?

The answer is time dilation. When the train is moving fast,
time slows down for it relative to someone on the ground. Likewise,
for the person in the train, the ground is moving fast relative
to the train. Therefore, with respect to someone on the ground,
time is moving slower for the person in the train. This is what
allows the light to appear to travel two different distances
in the same interval of time, relative to a single reference
point, of course.

To calculate how slow time is going for some other inertial
frame, we must make the calculation below. In the final equation
below, To is the "proper time" or the time that the
moving body reads. This is multiplied by gamma, which is defined
as one over the square root of one minus the square of the velocity
another inertial reference frame is reading the body divided
by the speed of light squared.