In mechanics, we usually derive the equations for special relativity by considering the reflecting of lights between mirrors in different reference frames. However, in Classical Electrodynamics, we derive with a different method.
The following derivation is based on an important fact, that the speed of light is a constant, which equals to $c = \frac{1}{\sqrt{\epsilon \mu}}$, in any reference frame. This means that no matter where you are and how fast you are moving, the light is always travling with the speed $c$ at approximately 300,000,000 m/s in the vaccum. Thus, even if we look from a partical travling at 99.99999999% the light speed $c$, the light speed is still c.
After acknowledging this seemingly rediculous fact, we now can imagine the following situation: Two coordinates $O$ and $O’$, both moving only along their x-axis at a constant speed of $v$, have each of their clock set to zero exactly when their origins coincide. Also, at the time they share the origin, there goes a flash of light at the origin, sending light waves to all the directions. After time $t$ in $O$ coordinate, one beam of light reaches the point $P(x,y,z)$ in $O$ coordinate. In another coordinate $O’$, $t’$ is the time for light to travel from origin $O’$ to the point $P’(x’,y’,z’)$, where $P’$ and $P$ is the same point in space. Then, we define a physical quantity called “Interval” as $s^2$, which represents the interval between two events in the time and space. In frame $O$, the interval between two events, the light flash and light reaching point $P$ is $s^2 = c^2(t-0)^2 - (x-0)^2 - (y-0)^2 -(z-0)^2 $. The same way, the interval in frame $O’$ is $s’^2 = c^2(t’-0)^2 - (x’-0)^2 - (y’-0)^2 - (z’-0)^2 $.