Let's see about the mess.
I'll change the notation a little bit since I don't know exactly which is which in your question.
Let $A(x_1,y_1)$, $B(x_2,y_2)$ two points in two media, with an interface at $y=0$. Assume $y_1>0$ and $y_2<0$. You want to find a ray (or a guy, or anything), such that in the first medium its speed if $\nu_1$, while in the second medium its speed is $\nu_2$. You want to minimize the time to go from $A$ to $B$.
In a homogeneous medium, the shortest path is a line, so we are really looking for a path made of two lines, which both intersect the interface at some point $I(a,0)$. The unknown is $a$.
Let $d_1=AI$ and $d_2=IB$.
What's the time spent?
$$t(a)=\frac{d_1}{\nu_1}+\frac{d_2}{\nu_2}=\frac{1}{\nu_1} \sqrt{(a-x_1)^2+y_1^2}+\frac{1}{\nu_2} \sqrt{(x_2-a)^2+y_2^2}$$
We first see that $t$ is positive, $C^{\infty}$, and $t(a)\to+\infty$ as $a\to\pm\infty$, so there must be a minimum, and the first order condition means that at the minimum $t'(a)=0$. Also, geometrically, it's obvious that $a\in[x_1,x_2]$, otherwise there is a point in $[x_1,x_2]$ which would take less time (if $a_{min}<x_1$ take $a=x_1$, and if $a_{min}>x_2$ take $a=x_2$).
Here,
$$t'(a)=\frac{1}{\nu_1} \frac{a-x_1}{\sqrt{(a-x_1)^2+y_1^2}}+\frac{1}{\nu_2} \frac{a-x_2}{\sqrt{(x_2-a)^2+y_2^2}}=\frac{1}{\nu_1}\frac{a-x_1}{d_1}+\frac{1}{\nu_2}\frac{a-x_2}{d_2}$$
The equation to solve is thus
$$\frac{1}{\nu_1} \frac{a-x_1}{d_1}=\frac{1}{\nu_2} \frac{x_2-a}{d_2}$$
Let's have a look at what it means. In the right triangle $AIP$ with $P(a,y_1)$, the angle $\theta_1=AIP$ has sine:
$$\sin \theta_1=\frac{a-x_1}{d_1}$$
Likewise, in the right triangle $BIQ$ with $Q(a,y_2)$, the sine of $\theta_2=\widehat{BIQ}$ is:
$$\sin \theta_2=\frac{x_2-a}{d_2}$$
That is, at any local minimum of $t$, we must have
$$\frac{\sin\theta_1}{\nu_1}=\frac{\sin\theta_2}{\nu_2}$$
Which also proves that there is a unique local minimum (hence it's a global minimum), since $\sin\theta_1$ is an increasing function of $a\in[x_1,x_2]$, while $\sin\theta_2$ is a decreasing function of $a$.