# Refraction of light in medium

Given that the plane $y=0$ separates the vacuum ($y>0$) from the optical medium ($y<0$), I would like to calculate the trajectory of a light ray starting at the point $(x_1,y_1)$ and ending in $(x_2,y_2)$ where $x_2>x_1$ and $y_1>0>y_2$. Specifically, I would like to find the point $(x,0)$ at which the light enters the medium. However, using Snell's law, I obtain an equation of fourth degree in $x$. Is there a smarter way of doing this?

• It would be great if you shared your work here :) – Pranav Hosangadi Nov 2 '13 at 19:10
• Squaring the Snell's law $\sin \theta_1 = n \sin \theta_2$ leads to $$\frac{(x-x_1)^2}{(x-x_1)^2 + y_1^2} = n^2 \frac{(x_2-x)^2}{(x_2-x)^2+y_2^2}$$ which is the quartic equation for $x$. It seems to me that the problem is so simple that it should be able to find $x$. However, I have never seen it being solved for $x$ and am skeptical wheter it can, in fact, be done. – user17116 Nov 2 '13 at 21:52
• It's a quartic problem, but it has just one variable. Should be fairly simple to solve, compared to many other problems one might encounter... – Pranav Hosangadi Nov 3 '13 at 2:14

You're right - this sounds simple but its much trickier than it looks. Actually the quartic nature of the equation shouldn't be too surprising: ray tracing softares have to use iterative ray aiming methods to get a ray to go through two fixed endpoints. It's not the standard problem to have fixed enpoints like this.

Your approach is sound but I can't simplify it either and Mathematica gives birth to a monster! I had more joy with the following approach:

Instead of $x$, make the length $\ell$ of the first ray segment (from the beginning point to the medium) your independent variable. Then Snell's law is:

$$\frac{1}{\ell} \sqrt{\ell^2-y_1^2}=\frac{n}{\ell_2}\,\sqrt{\ell_2^2-y_2^2}\quad\quad\quad(1)$$

where $\ell_2$ is the length of the second ray segment. The "width" of the problem $w = x_2-x_1$ is:

$$w = \sqrt{\ell^2-y_1^2} + \sqrt{\ell_2^2-y_2^2}\quad\quad\quad(2)$$

Now the total optical path length is $\ell + n\,\ell_2$, so it is tempting at this point to use Fermat's principle with this simple expression and minimize including constraint (2) with a Lagrange multiplier so that we get $1 + \lambda \partial_\ell w = n + \lambda \partial_{\ell_2} w = 0$ and solve for $\ell$ and $\ell_2$. This comes out easy enough: the trouble begins when you put your solutions back into (2) to solve for the Lagrange multiplier.

So, instead of using a Lagrange multiplier, I tried substituting (1) straight into (2), yielding:

$$w = \sqrt{\ell^2-y_1^2}\,\left(1+\frac{\ell_2}{n\,\ell}\right)\quad\quad\quad(3)$$

then solving (3) for $\ell_2$, thus deriving an expression for the total optical path length in terms of $\ell$ alone:

$$L = n\, \ell_2 + \ell = \ell\left(1-n^2+\frac{n^2\,w}{\sqrt{\ell^2-y_1^2}}\right)$$

and then solving ${\rm d}_\ell L = 0$. This is still a fairly thorny quartic, but with one positive real root, which is:

$$\ell = \sqrt{\frac{\left(n^2-1\right)^2 y_1^2+\sqrt[3]{n^4 \left(n^2-1\right)^4 w^2 y_1^4}}{\left(n^2-1\right)^2}}$$

whence:

$$x = \frac{(n\,y_1)^{\frac{2}{3}}\,w^{\frac{1}{3}}}{(n^2-1)^{\frac{1}{3}}} + x_1 = \frac{(n\,y_1)^{\frac{2}{3}}\,(x_2-x_1)^{\frac{1}{3}}}{(n^2-1)^{\frac{1}{3}}} + x_1$$

• Very nice! How did you solve your quartic equation? – user17116 Nov 3 '13 at 16:59
• With my superior algebraic powers - got out a credit card and bought Mathematica! – WetSavannaAnimal Nov 3 '13 at 18:29

Well, why not use Fermat's principle to solve it, by calculating the optical distance (s x N) between the start and end points, and solving for a minimum ??

• Hi George, this is exactly what I thought, but it's not that simple. Sure it works "in principle", but you end up with precisely @Pranav's equation, i.e. you "simply" end up proving Snell's law. I also tried with two independent lengths for the total optical path equal to $\ell_1 + n \ell_2$ and then minimizing this quantity with a Lagrange multiplier for the constraint of the system's "width" $x_2-x_1$: sure that "works" too, but the strife begins when you substitute your solution back into the constraint to work out the Lagrange multiplier. – WetSavannaAnimal Nov 6 '13 at 2:15