A light ray is traveling from one point in one medium to another point in another medium. The light ray bends at the interface of the two media by the phenomenon of Refraction. In one medium the light rays travel in a straight line.
The principle of Pierre de Fermat is that light rays travel from a point A in medium 1 to a point B in medium 2, bending at the interface, in path that optimizes the time to reach point 2.
Let μ₁ and μ₂ be the refractive indices of the two media respectively. Let c = speed of light in vacuum, v₁ = speed of light in medium 1 and v₂ = speed of light in medium 2.
μ₁ = c / v₁ and, μ₂ = c / v₂
let Point A = (-x₁, -y₁) the origin of the light ray. let N(0,0) be the point of incidence on medium 2. let B(x₂, y₂) be the destination point. The direct distance AB = is minimum distance. The time taken to go from A to B is different from minimum along this path.
Let i and r be the angles of incidence and refraction respectively. The path length of the rays AN + NB =
let y₁ = y and y₁+ y₂ = Y.
The time taken by light ray from A to B = T = AN / v₁ + NB / v₂
T = √(x₁²+y²) / v₁ + √(x₂²+(Y-y)² / v₂
here x₁, x₂, X, Y, v₁ and v₂ are constants. we are trying to find a relation between i and r so that the total time taken is minimum. We need to find the point N, at y. We have to find y.
dT/dy = 2y/[2√(x₁²+y²) v₁] + (2y - 2Y )/[2 √(x₂²+(Y-y)² v₂] = 0
= y / [√(x₁²+y²) v₁] - (Y - y) / [√(x₂²+(Y-y)² v₂] = 0
= Sin i / v₁ - Sin r / v₂ = 0
=> Sin i / Sin r = v₂ / v₁
This is the Snell's law of refraction. It is derived from the principle of Fermat.