Optics/Fermat's Principle
Derivation for Law of Reflection
The derivation of Law of Reflection using Fermat's principle is straightforward. The Law of Reflection can be derived using elementary calculus and trigonometry. The generalization of the Law of Reflection is Snell's law, which is derived bellow using the same principle.
The medium that light travels through doesn't change. In order to minimize the time for light travel between to points, we should minimize the path taken.

the angle of incidence equals the angle of reflection
1. Total path length of the light is given by
2. Using Pythagorean theorem from Euclidean Geometry we see that
- and
3. When we substitute both values of d1 and d2 for above, we get
4. In order to minimize the path traveled by light, we take the first derivative of L with respect to x.
5. Set both sides equal to each other.
6. We can now tell that the left side is nothing but and the right side means
7. Taking the inverse sine of both sides we see that the angle of incidense equals the angle of reflection
Derivation for Snell's Law
The derivation of Snell's Law using Fermat's Priciple is straightforward. Snell's Law can be derived using elementary calculus and trigonometry. Snell's Law is the generalization of the above in that it does not require the medium to be the same everywhere.

To mark the speed of light in different media refractive indices named n1 and n2 are used.
Here is the speed of light in the vaccuum and because all materials slow down light as it travels through them.
1. Time for the trip equals distance traveled divided by the speed.
2. Using the Pythagorean theorem from Euclidean Geometry we see that
- and
3. Substituting this result into equation (1) we get
4. We take the spacial derivative with respect to time. This may seem strange at first but if we then take the reciprocal of ,we end up with which is what we are looking for.
5. After careful examination the above equation we see that it is nothing but
6. Taking the reciprocal of both sides we get
7. Setting both sides equal to each other we get
8. Multiplying both sides by we get
9. Substituting for v1 and for we get
10. Simplifying both sides we get our final result