Math Insight

Non-differentiable functions must have discontinuous partial derivatives

According to the differentiability theorem, any non-differentiable function with partial derivatives must have discontinuous partial derivatives. (Otherwise, by the theorem, the function must be differentiable.) For one of the example non-differentiable functions, let's see if we can visualize that indeed these partial derivatives were the problem.

The function we'll examine is \begin{align*} f(x,y) = \begin{cases} \displaystyle \frac{x^2y}{x^2+y^2} & \text{if } (x,y) \ne (0,0)\\ 0 & \text{if } (x,y) = (0.0). \end{cases} \end{align*} Its graph is shown below.

If you stare at the above plot, you might be able to convince yourself that the partial derivatives are discontinuous at the origin. For example, along the line $y=0$ but away from the origin, the slope $\pdiff{f}{y}$ is a positive constant (in fact $\pdiff{f}{y}(x,0)=1$ for $x \ne 0$). But, along the line $x=0$, the slope $\pdiff{f}{y}$ is zero. These two values clash at the origin, leading to a discontinuity of $\pdiff{f}{y}(x,y)$ at the origin $(0,0)$. The partial derivative with respect to $x$, $\pdiff{f}{x}$, on the other hand, switches sign as you cross the line $x=0$. As you approach the origin, the switch happens faster, eventually switching with an instantaneous jump at the origin.

The following applet allows you visualize the partial derivatives as slopes. If you drag the point around the origin, you will see that the slopes jump, reflecting the fact that they are discontinuous.

An even better demonstration that the partial derivatives are indeed discontinuous is a plot of the partial derivative. Below is a plot of partial derivative of $f(x,y)$ with respect to $x$.

How can we be 100% sure that the $\pdiff{f}{x}$ is discontinuous at the origin? Of course, such visualization are imperfect, and you never know if you are being mislead. But, we can back up the picture with a calculation. The partial derivatives of $f(x,y)$ are \begin{align*} \pdiff{f}{x}(x,y) &= \begin{cases} \displaystyle \frac{2 x y}{x^2+y^2}-\frac{2 x^3 y}{\left(x^2+y^2\right)^2} \ & \text{if } (x,y) \ne (0,0)\\ 0 & \text{if } (x,y) = (0.0). \end{cases} \\ \pdiff{f}{y}(x,y) &= \begin{cases} \displaystyle \frac{x^2}{x^2+y^2}-\frac{2 x^2 y^2}{\left(x^2+y^2\right)^2} \ & \text{if } (x,y) \ne (0,0)\\ 0 & \text{if } (x,y) = (0.0). \end{cases}. \end{align*} To calculate the partial derivatives away from the origin, we just used the usual rules for differentiation. At the origin, we had to use the limit definition of partial derivatives, as shown on another page.

It's easy to see that the partial derivatives are zero along the $x$ and $y$ axes, as setting either $x=0$ or $y=0$ makes all the above expressions disappear. Focusing on the $x$-derivative, you can show that setting $y=x\sqrt{3}$ leads to a positive constant, $$\pdiff{f}{x}(x,x\sqrt{3}) = \frac{3\sqrt{3}}{8} \approx 0.65,$$ as long as you stay away from the origin. On the other hand, setting $y=-x\sqrt{3}$ lead to a negative constant $$\pdiff{f}{x}(x,-x\sqrt{3}) = -\frac{3\sqrt{3}}{8} \approx -0.65.$$

These four lines along which $\pdiff{f}{x}(x,y)$ is constant are overlaid on the graph shown below. Since all the lines go to the origin, they are a convincing demonstration that within any neighborhood of the origin, $\pdiff{f}{x}(x,y)$ takes on the values $0$, $\frac{3\sqrt{3}}{8}$, and $-\frac{3\sqrt{3}}{8}$. We've obtained different values for the limit of $\pdiff{f}{x}(x,y)$ along paths going to the origin, demonstrating that $\pdiff{f}{x}(x,y)$ is discontinuous at the origin.

It's a good thing that the partial derivatives of $f(x,y)$ are discontinuous at the origin. Otherwise, since $f(x,y)$ is non-differentiable at the origin, it would have contradicted the differentiability theorem. Be sure to keep your logic straight, though, as the differentiability theorem does not imply that all differentiable functions have continuous partial derivatives, as shown by this example.