In this example we study the behaviour of the function
\begin{equation*}
f(x,y)=\begin{cases}
\frac{(2x-y)^2}{x-y} & \text{if } x\ne y\\
0 & \text{if } x=y
\end{cases}
\end{equation*}
as \((x,y)\rightarrow (0,0)\text{.}\) Here is a graph of the level curve, \(f(x,y)=-3\text{,}\) for this function.
Here is a larger graph of level curves, \(f(x,y)=c\text{,}\) for various values of the constant \(c\text{.}\)
As before, it helps to convert to polar coordinates — it is a good approach. In polar coordinates
\begin{equation*}
f(r\cos\theta,r\sin\theta)
=\begin{cases}
r\frac{(2\cos\theta-\sin\theta)^2}{\cos\theta-\sin\theta} &
\text{if } \cos\theta\ne\sin\theta
\\
0 & \text{if } \cos\theta=\sin\theta
\end{cases}
\end{equation*}
If we approach the origin along any fixed ray \(\theta=\text{const}\text{,}\) then \(f(r\cos\theta,r\sin\theta)\) is the constant \(\frac{(2\cos\theta-\sin\theta)^2}{\cos\theta-\sin\theta}\) (or \(0\) if \(\cos\theta=\sin\theta\)) times \(r\) and so approaches zero as \(r\) approaches zero. You can see this in the figure below, which shows the level curves again, with the rays \(\theta=\frac{1}{8}\pi\) and \(\theta=\frac{3}{16}\pi\) superimposed.
If you move towards the origin on either of those rays, you first cross the \(f=3\) level curve, then the \(f=2\) level curve, then the \(f=1\) level curve, then the \(f=\frac{1}{2}\) level curve, and so on.
That \(f(x,y)\rightarrow 0\) as \((x,y)\rightarrow (0,0)\) along any fixed ray is suggestive, but does not imply that the limit exists and is zero. Recall that to have \(\lim_{(x,y)\rightarrow(0,0)}f(x,y)=0\text{,}\) we need \(f(x,y)\rightarrow 0\) no matter how \((x,y)\rightarrow (0,0)\text{.}\) It is not sufficient to check only straight line approaches.
In fact, the limit of \(f(x,y)\) as \((x,y)\rightarrow (0,0)\) does not exist. A good way to see this is to observe that if you fix any \(r \gt 0\text{,}\) no matter how small, \(f(x,y)\) takes all values from \(-\infty\) to \(+\infty\) on the circle \(x^2+y^2=r^2\text{.}\) You can see this in the figure below, which shows the level curves yet again, with a circle \(x^2+y^2=r^2\) superimposed. For every single \(-\infty \lt c \lt \infty\text{,}\) the level curve \(f(x,y)=c\) crosses the circle.
Consequently there is no one number \(L\) such that \(f(x,y)\) is close to \(L\) whenever \((x,y)\) is sufficiently close to \((0,0)\text{.}\) The limit \(\lim_{(x,y)\rightarrow(0,0)} f(x,y)\) does not exist.
Another way to see that \(f(x,y)\) does not have any limit as \((x,y)\rightarrow (0,0)\) is to show that \(f(x,y)\) does not have a limit as \((x,y)\) approaches \((0,0)\) along some specific curve. This can be done by picking a curve that makes the denominator, \(x-y\text{,}\) tend to zero very quickly. One such curve is \(x-y=x^3\) or, equivalently, \(y=x-x^3\text{.}\) Along this curve, for \(x\ne 0\text{,}\)
\begin{align*}
f(x,x-x^3)&=\frac{{(2x-x+x^3)}^2}{x-x+x^3}
=\frac{{(x+x^3)}^2}{x^3}\\
&=\frac{{(1+x^2)}^2}{x}\longrightarrow
\begin{cases}+\infty & \text{as $x\rightarrow 0$ with } x \gt 0
\\
-\infty & \text{as $x\rightarrow 0$ with } x \lt 0
\end{cases}
\end{align*}
The choice of the specific power \(x^3\) is not important. Any power \(x^p\) with \(p \gt 2\) will have the same effect.
If we send \((x,y)\) to \((0,0)\) along the curve \(x-y=ax^2\) or, equivalently, \(y=x-ax^2\text{,}\) where \(a\) is a nonzero constant,
\begin{align*}
\lim_{x\rightarrow 0}f(x,x-ax^2)
&=\lim_{x\rightarrow 0}\frac{{(2x-x+ax^2)}^2}{x-x+ax^2}
=\lim_{x\rightarrow 0}\frac{{(x+ax^2)}^2}{ax^2}\\
&=\lim_{x\rightarrow 0}\frac{{(1+ax)}^2}{a}
=\frac{1}{a}
\end{align*}
This limit depends on the choice of the constant \(a\text{.}\) Once again, this proves that \(f(x,y)\) does not have a limit as \((x,y)\rightarrow (0,0)\text{.}\)