Exercise 1.3: Fermat optics
This problem has us exploring some consequences for optics of the principle of least time. Exercise 1.3 states:
Fermat observed that the laws of reflection and refraction could be accounted for by the following facts: Light travels in a straight line in any particular medium with a velocity that depends upon the medium. The path taken by a ray from a source to a destination through any sequence of media is a path of least total time, compared to neighboring paths. Show that these facts imply the laws of reflection and refraction.
Law of Reflection
(require [sicmutils.env :refer :all])
The law of reflection is described in the footnote:
For reflection the angle of incidence is equal to the angle of reflection.
Here's the setup. The horizontal line is a mirror. The law states that inline_formula not implemented.
We have to show that if we consider all possible paths from a given starting point to a given endpoint, the path of minimum time will give us the law of reflection.
The actual path of minimum time is the straight line that avoids the mirror, of course. If we force the light to bounce off of the mirror, then we have to figure out where it will hit, where inline_formula not implemented is, to minimize the time between the start and end points.
There are two ways to solve this problem. We can use geometry and visual intuition, or we can use calculus.
Geometry
First, recall this fact from the problem text:
Light travels in a straight line in any particular medium with a velocity that depends upon the medium.
There's no medium change, so if there were no mirror in its path, the light beam would continue in a straight line. Instead of figuring out what the beam will do when it hits the mirror, reflect the endpoint across the mirror and draw a straight line between the start and "end" points:
The angle that the beam makes with the plane of the mirror is the same on both sides of the mirror.
Now reflect the the "end" point and the segment of the beam that's crossed the mirror back up. By symmetry, inline_formula not implemented, and we've proved the law of reflection.
Calculus
We can also solve this with calculus. Because the beam doesn't change media, its speed inline_formula not implemented stays constant, so minimizing the total distance inline_formula not implemented is equivalent to minimizing the time inline_formula not implemented.
Set inline_formula not implemented for convenience, and write the total distance the light travels as a function of inline_formula not implemented:
formula not implementedFor practice, we can also define this function in Scheme.
(defn total-distance [x1 y1 x2 y2]
(fn [xp]
(+ (sqrt (+ (square (+ x1 xp))
(square y1)))
(sqrt (+ (square (- x2 (+ x1 xp)))
(square y2))))))
Here's the function again, generated from code, with general inline_formula not implemented:
((total-distance x_1 y_1 x_2 y_2) x_p)
To find the inline_formula not implemented that minimizes the total distance,
take the derivative with respect to inline_formula not implemented,
set it equal to 0 and
solve for inline_formula not implemented.
The derivative will look cleaner in code if we keep the components of the sum separate and prevent Scheme from "simplifying". Redefine the function to return a tuple:
(defn total-distance* [x1 y1 x2 y2]
(fn [xp]
(up (sqrt (+ (square (+ x1 xp))
(square y1)))
(sqrt (+ (square (- x2 (+ x1 xp)))
(square y2))))))
Here are the sum components:
((total-distance* 0 y_1 x_2 y_2) x_p)
Taking a derivative is easy with scmutils
. Just wrap the function in D
:
(let [distance-fn (total-distance* 0 y_1 x_2 y_2)
derivative (D distance-fn)]
(derivative x_p))
The first component is the base of base inline_formula not implemented of the left triangle over the total length. This ratio is equal to inline_formula not implemented:
The bottom component is inline_formula not implemented, or inline_formula not implemented over the length of the right segment. Add these terms together, set them equal to 0 and rearrange:
formula not implementedThis description in terms of the two incident angles isn't so obvious from the Scheme code. Still, you can use Scheme to check this result.
If the two angles are equal, then the left and right triangles are similar, and the ratio of each base to height is equal:
formula not implementedSolve for inline_formula not implemented and rearrange:
formula not implementedPlug this in to the derivative of the original total-distance
function, and we find that the derivative equals 0, as expected:
(let [distance-fn (total-distance 0 y_1 x_2 y_2)
derivative (D distance-fn)]
(derivative (/ (* y_1 x_2) (+ y_1 y_2))))
If a beam of light travels in a way that minimizes total distance (and therefore time in a constant medium), then it will reflect off of a mirror with the same angle at which it arrived. The law of reflection holds.
Law of Refraction
The law of refraction is also called Snell's law. Here's the description from the footnote:
Refraction is described by Snell's law: when light passes from one medium to another, the ratio of the sines of the angles made to the normal to the interface is the inverse of the ratio of the refractive indices of the media. The refractive index is the ratio of the speed of light in the vacuum to the speed of light in the medium.
First we'll tackle this with calculus.
Calculus
The setup here is slightly different. We have a light beam traveling from one medium to another and changing speeds at a boundary located inline_formula not implemented to the right of the starting point. The goal is to figure out the point where the light will hit the boundary, if we assume that the light will take the path of least time.
The refractive index inline_formula not implemented, the speed of light inline_formula not implemented in a vacuum over the speed in the material. Rearranging, inline_formula not implemented.
Time is distance over speed, so the total time that the beam spends between the start and end points as a function of inline_formula not implemented, the point of contact with the boundary, is:
formula not implementedTake the derivative:
formula not implementedSet the derivative equal to 0 and split terms:
formula not implementedSimilar to the law of reflection's result, each term (up to its inline_formula not implemented multiple) is equal to the height of the left or right triangle over the length of the beam's path on the left or right of the boundary.
Equation \eqref{eq:almost-snell} simplifies to:
formula not implementedRearranging yields Snell's law:
formula not implementedGeometry
I won't recreate this here, but the Feynman Lectures on Physics, in Lecture 26, has a fantastic discussion about, and derivation of, the law of refraction using no calculus, just geometry. I highly recommend you check out that lecture. Feynman lays out a number of examples of how the principle of least time is not just a restatement of the optical rules we already knew.
You can use the idea to guess what shape of mirror you'd want to build to focus many light rays on a single point (a parabola), or how you might force all light rays coming out of a single point to meet up again at another point (build a converging lens).
This whole area of optics and least time has obsessed scientists for hundreds of years. Spend a few minutes poking around and see what you find.