To prove the time dilation formula consider the following observers.

The observer on the right is stationary in his reference frame, and the observer on the left sees the other moving to the right with speed

The observer on the right bounces a light signal between the ceiling and the floor. It takes a timeto return to the floor, so that

The observer on the left sees the moving framer of reference moving to the right, and will see the ray of light travel a distancein a timewhereHe will observe the ray of light to take a timeto return to the floor, so that

Substituteandinto

Square both sides to give

hence

Move the last term to the left.

Divide byto give

Factorise withto give

Hence