# 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.

• $f$ may not be continuous even if partial derivatives exist. – daulomb Dec 16 '17 at 21:14
• No, $f_x=0$ except on the $x$ axis, furthermore $f_y$ exists nowhere on the $x$ axis if $x\ne 0.$ – zhw. Dec 16 '17 at 22:05
• What is stopping you from taking a function in $\mathbb{R}^1?$ Its partial derivative would then just be its regular derivative. – Jbag1212 Dec 21 '17 at 5:29

## 4 Answers

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$.

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

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

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).$

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$.