TITLE: A function whose partial derivatives exist at a point but is not continuous
QUESTION [11 upvotes]: I am asked to determine whether or not a function can have all of its partial derivatives exist at a point but not be continuous at that point. I have tried to construct a counterexample but am unsure whether or not I have succeeded.
Consider the following function:
$$ f(x,y) = \left\{ \begin{array}{cc}
x & y=0 \\
0 & \text{otherwise}
\end{array}\right.
$$
Let $(x_0,y_0) \not= 0$ then we can compute the partials of $f$ at this point. Doing so is not difficult we just have to make sure we are careful about the partials with respect to $y$.
$$
\begin{align*}
f_x(x_0,y_0) &= \lim_{h\rightarrow 0} \frac{f(x_0+h,y_0)-f(x_0,y_0)}{h} \\ 
\text{if $y_0=0$} & \implies \lim_{h\rightarrow 0} \frac{x_0+h-x_0}{h} = 1 \\
\text{if $y_0\not=0$} &\implies \lim_{h\rightarrow 0} \frac{0}{h} = 0 \\
f_y(x_0,y_0) &= \lim_{h\rightarrow 0} \frac{f(x_0,y_0+h)-f(x_0,y_0)}{h} \\
\text{if $y_0=0$} &\implies \lim_{h\rightarrow 0}\frac{x_0-x_0}{h} = 0 \\
\text{if $y_0\not=0$} &\implies \lim_{h\rightarrow 0} \frac{0}h = 0
\end{align*}
$$
In all of these cases the partials of $f$ exist, however it is clear that for $x_0\not=0$ we will have that $f$ is not continuous at $(x_0,0)$. Becuase along any path where $y\not=0$ we will have that the limit is $0$, but along the path $y=0$ we obtain the limit being $x_0$. So $f$ is not continuous, but its partials exist.
Is this a valid construction? It felt kind of fishy, any advice would be appreciated.

REPLY [2 votes]: You might also consider the following (fishier) example. Let $f(x,y)=0$ except on points of the form $(x,x^2)$, with $x>0$, where $f$ takes the value $1$. Then the directional derivatives of $f$ along any ray exist and vanish everywhere, but the function is not continuous at every point of the form $(x,x^2)$ with $x\geq 0$.