Length contraction and time dilation in relativity