You need to learn about the Eikonal equation and the equivalent ray path equation, which I talk about in my answer to the question Physics SE question "Ray tracing in a inhomogeneous media", and, if you need to know how it comes as the *slowly varying envelope approximation" from Maxwell's Equations, I talk about this in my answer to the question , "Optics: Derivation of $\nabla n=\mathrm{d}_s n(s) \hat{u}(s)$".
Basically the equation you need is describes the the parametric equation for the position vector $\vec{r}(s)$ (where $s$ is a parameter for the path traced out by $\vec{r}:\mathbb{R}\to\mathbb{R}^3$) and it is:
$$\frac{\mathrm{d}}{\mathrm{d}\,s}\left(n\left( \mathbf{r}\left(s\right)\right)\,\frac{\mathrm{d}}{\mathrm{d}\,s} \mathbf{r}\left(s\right)\right) = \left.\nabla n\left( \mathbf{r}\right)\right|_{\mathbf{r}\left(s\right)}\tag{1}$$
where $n$ is the refractive index as a function of the position $\vec{r}(s)$. This is equivalent to Snell's law and Fermat's principle of least time. If $s$ is the pathlength along the curve, then $\mathrm{d}_s\vec{r}(s)$ reduces to the unit vector tangent to the path.
In your case, we're confined to a 2D plane, so you'll use two equations for $x(s)$ and $y(s)$ and $\nabla n = 2(x(s), y(s))$. So you need to subsitute these expressions into (1) and see how you fare. You'll get two coupled DEs for $x(s)$ and $y(s)$, which you should be able to eliminate $s$ from.