Why can't you take the limit of a 2-D function in every direction and call that the limit if they're equal?

In my second-year calculus class this term, one of the thing that the professor insisted was wrong was that the limit of a two-dimensional function as the input approached a certain point could not be calculated simply by taking the limit of the function in every direction and verifying that they were all equal.

I've taken her word for it, but why is this not true? Is there a counterexample to this proposition, and if so, what general principle does it violate?


Solution 1:

Consider the limit of the function $$f(x,y) = \begin{cases}\frac{x^4}{y^2} & \text{for } y \ne 0 \\ 0 & \text{for } y = 0\end{cases}$$ as $(x,y) \to (0,0)$. Clearly, along any line $y = ax$ passing through the origin, $$f(x,ax) = \begin{cases}\frac{x^2}{a^2} & \text{for } a \ne 0 \\ 0 & \text{for } a = 0,\end{cases}$$ and thus $\lim_{x \to 0} f(x,ax) = 0$. Indeed, $f(0,y)=0$ for all $y$ as well, so the same limit holds when approaching the origin along any line. Yet $f$ maps any open neighborhood of the origin to $[0,\infty)$, and so has no limit at the origin.