Fermat's principle states that light takes the path that requires the shortest time. Therefore, there is an analogy between the path taken by a particle under gravity and the path taken by a light ray and the problem can be modeled by a set of media bounded by parallel planes, each with a different index of refraction (leading to a different speed of light). Consequently, the path taken by a light in these media where light propagates at variable speeds is the answer to the problem. Because of the conservation of mechanical energy, the speed of the particle in a medium is constant along a horizontal plane and proportional to the square root of the height difference between the instantaneous position and the initial position of the particle. Fermat's principle yields Snell's law, which states that the ratio between the cosine of the angle between a ray and the boundary plane of a medium to the speed of the ray is constant.

In this Demonstration, parallel planes passing through the vertices of a regular polygon bound the media. The inradius of the polygon is 1. When you roll the polygon with the second slider, a particular vertex of the polygon moves along a path and passes through the boundary planes at the marked points. When a light ray follows these points, Snell's law is satisfied. You can see this by selecting "show angles".

Call the angle between the ray and boundary plane after refraction . The angle between the normal to the ray and vertical direction is . The speed of light in a medium is proportional to the square root of the height difference between the midpoint of the path in this medium and the initial position of the particle. This difference is equal to and . This proves that is constant.

The first slider "sides" controls the number of sides of the polygon. As the number of sides goes to infinity, the path taken by light approaches the cycloid, which is the answer to the brachistochrone problem.

[less]