pdf version
See this Light Clock Simulation to understand this calculation.
See this Length Contraction Tutorial to see the derivation of the formula below.