1. Introduction
The ray equation constitutes a fundamental approach to determine the path of a light ray (or a ray of any electromagnetic wave) given the local light speed [
1] and reads
where
n is the index of refraction at any point in the propagating medium,
is the position vector of the light ray and
s is the arc length along the ray trajectory. Solutions to the ray equation embody the answer to the problem in geometrical optics of calculating the trajectory of a light ray given the optical properties of the medium and the initial conditions. The equation has applications ranging from light paths through steady-state non-homogeneous atmosphere, like mirages, to the design of gradient-index materials [
2]. The ray equation is analogous to the Euler–Lagrange equation. The former is deduced [
3,
4,
5] from Fermat’s principle [
6], a variational principle which plays in optics the role that the principle of least action plays in classical mechanics. Fermat’s principle states that the actual path travelled by a light ray between any two points is that for which the optical path length (and equivalently the transit time) between those points is an extremum, generally a minimum.
A former approach to describe the light trajectory in more restricted situations is Snell’s law, which relates the angles of incidence and transmittance (refraction) of a ray propagating across an infinitely sharp interface separating two media with different indices of refraction. Snell’s law was initially deduced by Ibn Sahl in 984 (see, e.g., [
7]) but took its name after Willebrord Snellius who rediscovered it in 1621 [
8].
This paper presents a pedagogically motivated derivation of the ray equation from Snell’s law. While it is well established that Snell’s law can be derived from the ray equation, as can be encountered in the literature [
9,
10], our approach reverses this path by deducing the continuous ray equation from Snell’s law in the discrete case. This reversed construction, to the best of our knowledge, has not been reported in the academic literature and can serve as an accessible conceptual bridge for students in pedagogical contexts. The derivation, though restricted to the one-dimensional form of the ray equation, is significant because Snell’s law is a less-general principle compared to the ray equation, which governs the trajectory of light in continuous media with varying refractive indices. The purpose of this paper is strictly educational: to provide an alternative approach that is accessible to undergraduate students with knowledge in geometric optics and circumvents the use of variational calculus. While standard treatments derive the ray equation via Fermat’s principle and variational methods [
3], approaches that are elegant but often abstract, the consideration in this paper focuses on a concrete construction using layered media and limiting procedures.
The connection between Fermat’s principle and Snell’s law is classical: Snell’s law follows as a direct result when extremizing or minimizing the time taken by a light ray between two points in media with different refractive indices. Moreover, more general derivations of ray equations under smooth, non-linear boundaries and higher dimensions have been presented [
9].
We present two methods to accomplish the task. In the first method, we obtain a differential equation relating the derivative of the Cartesian coordinates and the index of refraction field, an equation obtained earlier by Peter Dyson via a different approach [
11]. Instead, we follow a detailed derivation considering a two-dimensional stratified medium composed of layers with different indices of refraction. By making infinitesimal the layer width, we develop a continuous description. From the equation obtained, called throughout the Dyson’s expression, we deduce the ray equation. In the second method, we generalize Snell’s law by means of a differential equation relating the refractive index field and the refraction angle with its derivative. The expression obtained is the differential analogous to Snell’s law so its integration brings back to Snell’s law. Then, from this expression, we get the ray equation.
Snell’s law predicts that the product
, where
is the refraction angle, remains constant when a light ray passes from one medium to another. In Ref. [
12], it was demonstrated that, for the general case where the refractive properties of the medium are determined by a variable index field, this assertion only holds when the gradient of the refraction index is unidirectional. This is equivalent to the refractive index being a continuous function of a single spatial variable. The approach used here naturally reproduces the known result that
remains constant along the ray path when the gradient of the refractive index is unidirectional and is consistent with the findings of Ref. [
12]. However, let us emphasize that the current study does not attempt to verify the results of Ref. [
12] in the more general case of multidirectional gradients which are beyond the scope of the present study.
David Allwright obtained Fermat’s principle from Snell’s law when the propagation region is free from caustics [
13]. This bears resemblance to the current study as the ray equation is commonly deduced from Fermat’s principle. With this in mind, let us emphasize key differences. Fermat’s principle connects a local refraction condition to a global variational principle governing light propagation but does not explicitly describe how rays evolve in a specific medium or situation. On the other hand, the ray equation offers a concrete mathematical tool aimed at providing a quantitative description of ray dynamics.
In the final part of this paper—in
Section 3—we use Dyson’s expression to obtain an analytical solution to the path followed by a light ray in an inferior mirage. This problem is solved starting from the ray equation [
14]. Although Dyson’s expression is less general than the ray equation, the Dyson’s expression can be applied more straightforwardly to the problem, this being the reason why the Dyson’s approach is chosen.
3. Analytical Solution of Mirage Ray-Path
Equation (
8) is a differential equation of more natural interpretation and implementation than the one-dimensional ray Equation (
17). Equation (
8) allows the calculation of ray trajectory in a medium where the index of refraction is a continuous function of the spatial position. Despite its simplicity and elementary of deduction, Equation (
8) is not taught in undergraduate courses and textbooks on optics (see, e.g., Refs. [
1,
15,
16,
17]). Let us apply Equation (
8) to calculate the light path in an inferior mirage.
Inferior mirages form when light rays are refracted by a gradient of hot air which develops right above heating ground, typically sand or asphalt. As height increases, air becomes cooler and, in the absence of convection currents, denser, which produces an increasing index of refraction. An intuitive conclusion based on geometrical optics considerations leads to a belief that rays should remain horizontal when reaching the minimum and not bend; however, this has been discussed and solved [
11,
18,
19,
20].
According to Robert Fleagle, the air temperature profile decays exponentially with height [
21], so the index of refraction can be exppressed as follows [
14,
22]:
where
is the air index of refraction at the ground surface, and
and
are constants. Note that, in the description given here, the
x-coordinate corresponds to the height over the ground and a refractive index is chosen increasing as
x increases, opposed to what is depicted in
Figure 1; see
Figure 2 for reference. Substitution of Equation (
23) into Equation (
8) gives
where
,
, and
. Equation (
24) can be solved by basic integration methods; then, one gets
where
is the integration constant determined by the initial conditions. In Equation (
25), we explicitly show the plus–minus sign that appears in the radical of Equation (
5) to obtain both branches of the solution.
Given the construction of the frame of reference in the consideration here, the slope of the minimum in Equation (
8) is vertical, that is, parallel to the
y axis, so with the aim to determine the position of the minimum, we express Equation (
8) as
. Hence, one finds out the condition that the index of refraction meets at the minimum of the ray path:
Here
is the index of refraction at the minimum. Then,
Let us substitute
(
27) into Equation (
23) to obtain the height
over the ground of the minimum:
and thus,
Substitution of Equation (
29) into Equation (
25) gives the position
of the minimum, which can be related to the distance from the observer.
Figure 2 shows the light path of an inferior mirage, given by Equation (
25) with
and all other constants being set to 1. In this case, if the index of refraction at the ground meets the condition of Equation (
27), the logarithm argument in Equation (
29) is 1 and the height of the minimum is 0 what is represented in
Figure 2.
4. Conclusions
Snell’s law constitutes a theoretical description aimed at addressing the change in direction of a light ray when passing through a sharp interface separating two media where light speed is different but constant at each side. Thus, it is not applicable to the calculation of the ray trajectory, when light velocity is a continuous function of position. The ray equation, derived from Fermat’s principle, stands as the appropriate framework for this general case. We deduce the ray equation in one dimension directly from Snell’s law using two methods: from a differential equation in terms of the Cartesian coordinates and the refractive index (Dyson’s expression) (method 1) and from the differential equivalent of Snell’s law (method 2), both obtained from Snell’s law.
In
Section 3, we use Dyson’s expression to find an analytical solution for the light path in an inferior mirage. The application of Dyson’s expression to this problem is straightforward and provides a more natural approach compared to the ray equation. Throughout this study, we consider an index gradient along the
x coordinate. When applied to the mirage problem, we get directly
and the curve rotated in contrast to Ref. [
14].
Let us make two final remarks. This study is strictly limited to a one-dimensional derivation of the ray equation under the assumption of a unidirectional refractive index gradient; thus, the quantity remains constant in accordance with Snell’s law. The goal here is pedagogical with the aim to show how Snell’s law, typically taught as a discrete boundary condition, can lead to the ray equation when applied in the continuous limit of a stratified medium, method 1, or in the differential version of Snell’s law, method 2.