Fermat’s theorem states that the path taken between two points by a ray of light is the path that can be travelled in the least time. Hence light always takes the quickest path. It is to be noted that the shortest path may not be the quickest path in some cases.