Physic Labs
Step 1 of 4: Travel time of the broken path
Intuition

Light can be viewed as 'choosing' the kink point xx on the interface so that the total travel time is smallest — like a lifeguard who runs along the beach then swims diagonally: because running is faster than swimming, the optimal route is not a straight line.

T(x)=a2+x2v1+b2+(d−x)2v2T(x) = \frac{\sqrt{a^2 + x^2}}{v_1} + \frac{\sqrt{b^2 + (d - x)^2}}{v_2}
Analysis

Suppose the ray travels from point AA in medium 1 to point BB in medium 2, crossing the interface at position xx. The perpendicular distances of AA and BB to the interface are aa and bb, and the projected separation along the interface is dd. By the Pythagorean theorem the two legs have lengths a2+x2\sqrt{a^2+x^2} and b2+(d−x)2\sqrt{b^2+(d-x)^2}; dividing by the speeds v1v_1, v2v_2 in each medium and adding gives the total time T(x)T(x).