A function whose partial derivatives exist at a point but is not continuous

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.


Solution 1:

You may also consider this function: $$ f(x,y) = \left\{ \begin{array}{cc} \displaystyle\frac{xy}{x^2+y^2} & (x, y)\neq (0,0) \\ 0 & \text{otherwise.} \end{array}\right. $$ If you check, you see that this function is not continuous at $(0,0)$ but both partials exist and equal zero, that is, $f_x(0,0)=f_y(0,0)=0$.

Solution 2:

On $\mathbb R^2,$ define $f=1$ except on the axes, where we define $f=0.$ Then $f_x(0,0)= f_y(0,0) = 0,$ but $f$ is not continuous at $(0,0).$

Solution 3:

Hint: this is the graph of $f(x,y)=\frac{(2x^2-3y^2)^2}{(x^2+y^2)^2}$ over $[-1,1]^2$:

enter image description here

To consider functions which are constant over lines through the origin is a very good idea.