[Math] Differentiability of a scalar function of two variables — problems with Stewart’s definition.

derivativesmultivariable-calculuspartial derivative

I’m feeling uncomfortable about how Stewart’s Calculus makes the transition from differentiability of functions of one variable to differentiability of functions of two variables. Namely, Stewart gives the following definition:

Definition. A function $ f $ of two variables is said to be differentiable at $ (a,b) $ if the first-order partial derivatives of $ f $ at $ (a,b) $ exist and
\begin{align}
& ~ f(a + \Delta x,b + \Delta y) – f(a,b) \\
= & ~ {f_{\operatorname{x}}}(a,b) \Delta x +
{f_{\operatorname{y}}}(a,b) \Delta y +
{\epsilon_{1}}(\Delta x,\Delta y) \Delta x +
{\epsilon_{2}}(\Delta x,\Delta y) \Delta y,
\end{align}
where $ \displaystyle \lim_{(\Delta x,\Delta y) \to (0,0)} {\epsilon_{1}}(\Delta x,\Delta y) = \lim_{(\Delta x,\Delta y) \to (0,0)} {\epsilon_{2}}(\Delta x,\Delta y) = 0 $.

Note. Later on, he shows that this will follow if the partial derivatives exist and are continuous near $ (a,b) $, and I am fine with this.

What first irked me is that I didn’t remember learning this definition, so I spent a while trying to understand it. Moreover, the only functions that I’ve found to motivate the need for such a definition are those that are not continuous at the point in question. For example, consider the function $ f: \mathbb{R}^{2} \to \mathbb{R} $ defined by
$$
\forall (x,y) \in \mathbb{R}^{2}: \qquad
f(x,y) \stackrel{\text{df}}{=}
\begin{cases}
\dfrac{x y}{x^{2} + y^{2}} & \text{if $ (x,y) \neq (0,0) $}; \\
0 & \text{if $ (x,y) = (0,0) $}.
\end{cases}
$$
Then $ f_{\operatorname{x}} $ and $ f_{\operatorname{y}} $ are defined at $ (0,0) $, but $ f $ is not continuous there.

Here’s my quarrel. I don’t think that this is a natural extension from the one-dimensional case. In one dimension, differentiability at a point implies continuity at that point, but two dimensions, the existence of $ f_{\operatorname{x}} $ and $ f_{\operatorname{y}} $ at a point don’t imply the continuity of $ f $ at that point. My intuition, then, is that to extend the definition of differentiability to two dimensions, we should say that $ f_{\operatorname{x}} $ and $ f_{\operatorname{y}} $ exist and that $ f $ is continuous at the relevant point.

This seems nice and simple, so I can’t imagine why Stewart would go with the awkward definition given at the beginning of this post, if this was indeed the case. It therefore seems that I should be wrong. If I am, can you give me an example of a function $ f $ that is continuous at $ (a,b) $, and $ f_{\operatorname{x}} $ and $ f_{\operatorname{y}} $ are defined at $ (a,b) $, but it isn’t differentiable there?

Additionally, I have a rough outline of a proof in my head of why it should be true. The definition of a directional derivative gives
$$
{D_{\mathbf{u}} f}(a,b)
= \lim_{h \to 0} \frac{f(a + h \Delta x,b + h \Delta y) – f(a,b)}{h},
$$
but expressing it as a gradient implies that
$$
\lim_{h \to 0} \frac{f(a + h \Delta x,b + h \Delta y) – f(a,b)}{h}
= {f_{\operatorname{x}}}(a,b) \Delta x + {f_{\operatorname{y}}}(a,b) \Delta y.
$$
However, for this limit to be true, it seems like the original awkward definition must follow, i.e.,
$$
\frac{f(a + h \Delta x,b + h \Delta y) – f(a,b)}{h}
= {f_{\operatorname{x}}}(a,b)\Delta x + {f_{\operatorname{y}}}(a,b) \Delta y,
$$
which implies that
$$
f(a + h \Delta x,b + h \Delta y) – f(a,b)
= {f_{\operatorname{x}}}(a,b)h \Delta x + {f_{\operatorname{y}}}(a,b)h \Delta y
$$
without even the need for the functions $ \epsilon_{1} $ and $ \epsilon_{2} $.


Edit 1

zhw. has given a nice counter example below. However, I’d now like to alter my questions.

  1. Would an alternative definition be that all the directional derivatives of $ f $ exist and that $ f $ is continuous at a given point?

  2. What if I now extend my original approach to say that $ f $ is continuous on a neighborhood of $ (a,b) $ and that $ {f_{\operatorname{x}}}(a,b) $ and $ {f_{\operatorname{y}}}(a,b)$ exist? Could you give me a counterexample now?


Edit 2

zhw. has knocked down Question 2 of Edit 1 in his response to my comment to his original answer, so now I’m just wondering if

Would an alternative definition be that all the directional derivatives of $ f $ exist and that $ f $ is continuous at a given point?

I’m motivated to ask because (a) zhw.’s counter examples all have some directional derivatives that don’t work and (b) my attempted proof relied on the existence of directional derivatives.

Best Answer

There are functions for which all directional derivatives exist and are still not differentiable. A web search will turn up several examples such as this one, in which not only do they all exist but are equal. It fails to be differentiable because all paths need to be considered, not just the straight lines. Requiring continuity as well likely does the trick, but to me that seems like using a bigger and bigger hammer to deal with each issue as it arises.

I think the awkwardness in the text’s definition comes from treating $x$ and $y$ separately. If you formulate the definition of differentiability in terms of vectors, it doesn’t seem all that awkward to me: A function $f:\mathbb R^m\to\mathbb R^n$ is differentiable at $\mathbf v\in\mathbb R^m$ if there exists a linear map $L_{\mathbf v}:\mathbb R^m\to\mathbb R^n$ such that $f(\mathbf v+\mathbf h) = f(\mathbf v)+L_{\mathbf v}(\mathbf h)+o(\mathbf h)$. If such a map exists, it isn’t hard to show that it is unique. This linear map is the differential of $f$ at $\mathbf v$, often denoted by $\mathrm df_{\mathbf v}$ or simply $\mathrm df$. This captures the essential notion that a derivative/differential is the best linear approximation to the the change in function’s value near a given point.

Note that when $f:\mathbb R\to\mathbb R$ this definition reduces to that of the derivative from elementary calculus (in one dimension, a linear map is just multiplication by a scalar). In addition, gradient, directional derivative, &c can all be defined in terms of this differential.

Related Question