Fermat's Principle
From bio-physics-wiki
Fermat's principle or the principle of least time, describes the way a beam of light takes through different media. The light chooses the path that takes the least time from one point to another. Consider a wave travelling through two different media $1,2$ with the corresponding speed $v_1$ and $v_2$ ($v_1>v_2$), respectiveley.
The time the light ray needs to travel from A to B is \begin{align} T&=\int_A^B dt = \int_1 \frac{ds}{v_1} + \int_2 \frac{ds}{v_2}\\ &=\frac{\sqrt{y_a^2+x^2}}{v_1}+\frac{\sqrt{y_b^2+(L-x)^2}}{v_1} \end{align} How does the time $T$ change if we vary $x$? \begin{align} \frac{dT}{dx}=\frac{2x}{2 \sqrt{y_a^2+x^2}} \frac{1}{v_1}-\frac{2(L-x)}{2 \sqrt{y_b^2+(L-x)^2}} \frac{1}{v_2} \end{align} We can find the shortest time $T$ by setting the above equation to zero. \begin{align} \frac{x}{\sqrt{y_a^2+x^2}} \frac{1}{v_1}-\frac{(L-x)}{\sqrt{y_b^2+(L-x)^2}} \frac{1}{v_2}=0 \end{align} Using the trigonometric relations \begin{align} sin(\theta _1)=\frac{x}{\sqrt{y_a^2+x^2}} \end{align} \begin{align} sin(\theta _2)=\frac{(L-x)}{\sqrt{y_b^2+(L-x)^2}} \end{align} easily derived from the graphic, we find \begin{align} sin(\theta _1)\frac{1}{v_1}-sin(\theta _2)\frac{1}{v_2}=0 \end{align} which rewritten in the form \begin{align} \frac{sin(\theta _1)}{sin(\theta _2)}=\frac{v_1}{v_2} \end{align} is known as Snell's Law. Notice, this formula is also true for $v_2>v_1$, but the corresponding graphic would look different with $\theta_1 < \theta_2$.