Surface that refracts all rays onto a single point I am trying to find the equation to the interface separating two optically different medium which will focus all rays coming from a point B(b,0) in medium 2 ($\mu$=m) to a single point A(a,0) in medium 1 ($\mu$=n) using the principle of least time.
I found the equation for the time it takes the rays to reach from B to A,
$$\left(\frac{n}{c}\right)\left(\sqrt{(x-a)^2+y^2}\right)+\left(\frac{m}{c}\right)\left(\sqrt{(x-b)^2+y^2}\right)$$
Now, according to POLT, this expression should be equal to something that is independent of the coordinates of the point (i.e. x and y) as it should be equal for all points on the interface for light to follow these paths.
Now i am pretty much stuck at finding the equation relating y to x for the surface.I tried differentiating this equation and setting that to zero since the other side is independent of x and is a constant but that became too complex to solve.
I need help in solving this equation for y(x)
The following image is an arbitrary visualization of such an interface (m>n)

 A: Take your expression and set it equal to some constant $C$.
Square both sides to get $$\left({n \over c}\right)^2 \left( (x-a)^2+y^2 \right)+\left({m \over c}\right)^2 \left( (x-b)^2+y^2 \right)+
2\left({nm \over c^2}\right)^2\sqrt{ \left( (x-a)^2+y^2 \right)}
\sqrt{  \left( (x-b)^2+y^2 \right)}=C^2$$
Rearrange
 $$\left({n \over c}\right)^2 \left( (x-a)^2+y^2 \right)+\left({m \over c}\right)^2 \left( (x-b)^2+y^2 \right)-C^2=
2\left({nm \over c^2}\right)^2\sqrt{ \left( (x-a)^2+y^2 \right)}
\sqrt{  \left( (x-b)^2+y^2 \right)}$$
Square both sides again to get rid of all the square root signs and collect terms. I'll let you do the hard work. This is technically a quartic but there are terms in $y^4$, $y^2$ and $y^0$ so this actually gives you a quadratic equation for $y^2$ in terms of $x,n,m,a,b$ and $C$, which is what you want. Then $y=\pm\sqrt{y^2}$ which gives you the obvious symmetry of the shape about the $y=0$ axis.
The solution is not unique, it depends on $C$. You can choose the point at which the curve crosses the axis. 
A: 
The closed curve for parameter values as shown in the Figure.

Not all curves for various values of $\:k\:$ correspond to acceptable solutions. In the second Figure above the blue curves are acceptable but the green curves must be rejected as "pushing" point $\:\rm A\:$ into medium 2.  

Proof that accepted curves obey Snell's law :
\begin{equation}
n_{1}\sqrt{(x\!-\!a)^{2}+y^{2}}+n_{2}\sqrt{(x\!-\!b)^{2}+y^{2}}=k=ct_{\rm AB}=\text{constant} \qquad \Longrightarrow 
\nonumber
\end{equation}
\begin{equation}
\mathrm d \left[n_{1}\sqrt{(x\!-\!a)^{2}+y^{2}}+n_{2}\sqrt{(x\!-\!b)^{2}+y^{2}}\right]=\mathrm d k=0 \qquad \Longrightarrow 
\nonumber
\end{equation}

\begin{equation} 
n_{1}\left[\dfrac{(x\!-\!a)}{\sqrt{(x\!-\!a)^{2}+y^{2}}}\mathrm d x +\dfrac{y}{\sqrt{(x\!-\!a)^{2}+y^{2}}}\mathrm d y\right]+n_{2}\left[\dfrac{(x\!-\!b)}{\sqrt{(x\!-\!b)^{2}+y^{2}}}\mathrm d x +\dfrac{y}{\sqrt{(x\!-\!b)^{2}+y^{2}}}\mathrm d y\right]=0 
\nonumber
\end{equation}
\begin{equation}
\qquad =\!=\!=\!=\!=\!=\!\Longrightarrow \hphantom{===================================================} 
\nonumber
\end{equation} 
\begin{equation} 
n_{1}\left[\dfrac{(x\!-\!a)}{\sqrt{(x\!-\!a)^{2}+y^{2}}} +\dfrac{y}{\sqrt{(x\!-\!a)^{2}+y^{2}}}\dfrac{\mathrm d y}{\mathrm d x}\right]+n_{2}\left[\dfrac{(x\!-\!b)}{\sqrt{(x\!-\!b)^{2}+y^{2}}}+\dfrac{y}{\sqrt{(x\!-\!b)^{2}+y^{2}}}\dfrac{\mathrm d y}{\mathrm d x}\right]=0 
\nonumber
\end{equation}
 
\begin{equation} 
\qquad \Longrightarrow \qquad n_{1}\left(\cos\omega_{1}  +\sin\omega_{1}\tan\phi\right)+n_{2}\left(-\cos\omega_{2}  +\sin\omega_{2}\tan\phi\right)=0 
\nonumber
\end{equation} 
\begin{equation} 
\qquad \Longrightarrow \qquad n_{1}\left(\cos\omega_{1}\cos\phi +\sin\omega_{1}\sin\phi\right)-n_{2}\left(\cos\omega_{2}\cos\phi  -\sin\omega_{2}\sin\phi\right)=0 
\nonumber
\end{equation}
\begin{equation}  
\qquad \Longrightarrow \qquad n_{1}\cos\left(\phi-\omega_{1}\right) -n_{2}\cos\left(\phi+\omega_{2}\right)=0  
\nonumber
\end{equation} 
\begin{equation}  
\qquad \Longrightarrow \qquad n_{1}\sin\underbrace{\left[\dfrac{\pi}{2}-\left(\phi-\omega_{1}\right)\right]}_{\theta_{1}} -n_{2}\sin\underbrace{\left[\dfrac{\pi}{2}-\left(\phi+\omega_{2}\right)\right]}_{\theta_{2}}=0  
\nonumber
\end{equation}
that is 
\begin{equation}  
 n_{1}\sin\theta_{1} =n_{2}\sin\theta_{2} \qquad \textbf{(Snell's law)} 
\nonumber
\end{equation}

$===================================================$

