Reflection law
To find out the optimal path of light, we must first assume that \( A \) and \( B \) lie over the \(x\)-axis, as depicted in the image below:
The path length from \( A \) to \( B \) is:
$$L \left( x \right) = \sqrt{a^{2} + x^{2}} + \sqrt{b^{2} + \left( c - x \right)^{2}}$$
Since the velocity is constant, the path in minimum time is simply the path of minimum distance. This can be calculated by taking the derivative of \( L \) with respect to \(x\), and setting it equal to zero.
$$\begin{split}L^{\prime} \left( x \right) &= \frac{1}{2} \frac{2x}{\sqrt{a^{2} + x^{2}}} + \frac{1}{2} \frac{2 \left( c - x \right) \left( -1 \right)}{\sqrt{b^{2} + \left( c - x \right)^{2}}} \\ & = \frac{x}{\sqrt{a^{2} + x^{2}}} - \frac{ \left( c - x \right) }{\sqrt{b^{2} + \left( c - x \right)^{2}}} = 0 \end{split}$$
But we can notice in the previous image
$$ \begin{split} \sin\theta_{i} &= \frac{x}{\sqrt{ a^{2} + x^{2} }} \\ \sin\theta_{r} &= \frac{c - x}{\sqrt{b^{2} + \left(c - x\right)^{2}}} \end{split} $$
that way we can rewrite the above equation as
$$\begin{split}&\sin\theta_{i} - \sin\theta_{2} = 0 \\ \Leftrightarrow &\sin\theta_{i} = \sin\theta_{2}, \end{split}$$
equivalently it is
$$\theta_{i} = \theta_{r},$$
which is the Reflection Law.
Instructions
Move the green slider to change angle of incidence.