Oddball question: say I want to travel from $(a, b)$ where $b > 0$ to $(c, d)$ where $d < 0$ using the shortest path, where I can travel at velocity $v\_1$ in the upper half-plane and at velocity $v\_2$ in the lower half-plane. (E.g., a light ray would take this path.) Where should I cross the $x$ axis? I want an explicit formula in terms of $a$, $b$, $c$, $d$, $v\_1$ and $v\_2$.


On the surface this is a "stupid calculus question" (take the derivative and set to zero) but the calculus approach led me to the fourth-degree equation


$$V\_1^2((x−c)^2 +d^2)(x−a)^2 =V\_2^2((x−a)^2 +b^2)(x−c)^2$$


where $V\_1 = 1/v\_1$, $V\_2 = 1/v\_2$. (Seems to be more convenient to work with the inverse velocities, $V\_1$ and $V\_2$ than with $v\_1$ and $v\_2$.) A fourth-degree equation can theoretically be solved but I didn't have the heart to do it... I'm hoping that either: (a) someone has already done it; (b) there's a simplification that I'm overlooking; or (c) someone has a computer algebra package that will crunch through it and deliver a nice analytic solution.


Thanks!


PS: I'm aware that the above equation can be used to prove the law of refraction, but that's not what I want; I want to find the actual solution $x$.



Computing a point of refraction
By scaling and translation, you can assume WLOG that $a=0$ and $c=1$. Also let $r = (V\_2/V\_1)^2$. You are left with a quartic polynomial in $x$ having $3$ independent parameters. Yes, a computer algebra system can solve it, but the result will be 
"wallpaper": a very complicated expression that I won't even try to write here. 
However, common-subexpression elimination can produce the result in several more reasonable-looking steps. This is using Maple's codegen:-optimize:



```
t1 = 3^(1/2)
t2 = r-1
t3 = 1/t2
t4 = b^2
t5 = t4+1
t7 = d^2
t9 = (r*t5-t7-1)^2
t12 = t5^2
t14 = r^2
t16 = t14*r*t12*t5
t17 = -t7-1
t18 = t4^2
t19 = 3*t18*t17
t20 = 21*t7
t23 = 3*t7
t26 = t7^2
t27 = 3*t26
t30 = t17^2
t31 = 3*t30
t34 = t30*t17
t38 = (t3*r*(t16+t14*(t19+t4*(t20-6)-t23-3)+r*(t4*(t27-t20+3)+t31)+t34))^(1/2)
t42 = 48*t7
t52 = (6*t38*t2*t1*b*d+t16+t14*(t19+t4*(t42-6)-t23-3)+r*(t4*(t27-t42+3)+t31)+t34)^(1/3)
t53 = 1/t52
t55 = r*t4
t60 = ((t53*t9+r+t52-2*t55+2*t7-1)*t3)^(1/2)
t63 = 4*t2^2
t64 = t2^2
t65 = 1/t64
t68 = t55-t7+r-1
t73 = t68^2
t92 = (1/2*t65*t63-4/3*t3*t68-1/3*t52*t3-1/3*t53*t3*t73+1/t60*t1*(-2*t2*t65*t68+4*t3*t55+1/2/t64*t63))^(1/2)
t96 = 1/6*t60*t1-1/2*t92+1/2

```

The final answer is t96.


