The phenomenon of light taking the path of least distance is explained by Fermat's principle of least time, also known as the principle of least action. This principle, proposed by the French mathematician and physicist Pierre de Fermat in the 17th century, states that light follows the path that minimizes the time taken to travel between two points.
Light tends to follow the path of least time because it travels at different speeds through different mediums. When light transitions from one medium to another, such as from air to water or from air to glass, it changes its speed and direction. This change in speed is described by Snell's law, which states that the ratio of the sines of the angles of incidence and refraction is equal to the ratio of the speeds of light in the two media.
When light travels between two points, it explores various possible paths. However, according to Fermat's principle, only the path that minimizes the time taken will be chosen by the light. This principle can be understood intuitively by considering that light will take the fastest route to reach its destination.
In essence, the principle of least time explains why light tends to take the path of least distance. By minimizing the time taken, light optimizes its path based on the different speeds at which it can travel through various media.