One of the very important equations of geometrical optics, that follows directly from the Fermat principle. One one hand, we have the definition of optical path:

       /r
L(r) = |  n ds
       /r0

where bold denotes vector quantities, r being the position vector, n the index of refraction and ds an element along the light's trajectory between points r0 and r. On the other hand, we have the definition of the gradient of the optical path:

grad L = dL/dr

which we can rewrite:

dL = grad L.dr

where the dot in the previous equation denotes the dot product. We can easily see that dL can be associated with nds since, of course, the integral of dL along the light's path gives us the optical path L. Thus,

dL = nds = n(dr.u)

where u is a unitary vector along light's path. We then have:

n dr.u = grad L.dr

which immediatly leads to the iconal equation:

n u = grad L

or

n = ||grad L||

where ||.|| denotes the modulus. The iconal equation tells us that the index of refraction is the modulus of the gradient of the optical path, and that lights always bends towards regions of higher index.