# Differentiability of piecewise multivariable functions

1. May 2, 2014

### V0ODO0CH1LD

I guess my first questions is whether saying that a function is differentiable is the same as saying that its derivative is continuous. i.e. if

$$\lim_{x\rightarrow{}a}f'(x)=f'(a)$$
then the function is differentiable at $a$. Or is it just a matter of the value $f'(a)$ existing?

Now my second question is, if the limit definition is true, then a function $f:\mathbb{R}^n\rightarrow\mathbb{R}^m$ is going to be differentiable at a point $a$ if for all $i$

$$\lim_{x\rightarrow{}a}f_{x_i}(x)=f_{x_i}(a)$$
and the directions $i$ form a basis for $\mathbb{R}^{n-1}$, right? But is that the sufficient and necessary condition? In other words, is that a definition of differentiability?

2. May 2, 2014

### micromass

If the function is differentiable, then that only means that the values $f^\prime(a)$ exist for each $a$ in the domain.
If you want the derivative to be continuous, then we call this continuously differentiable. We also tend to call this $C^1$ functions.

3. May 2, 2014

### V0ODO0CH1LD

Okay, but then is the piecewise function
$$f(x,y) = \left\{ \begin{array}{lr} \frac{x^4}{x^2 + y^2} & (x,y)\neq{}0\\ a & (x,y)=0 \end{array} \right.$$

differentiable for all $a\in\mathbb{R}$? So that the fact that

$$\lim_{(x,y)\rightarrow{}(0,0)}f(x,y)\neq{}a$$
makes the function not continuously differentiable but still differentiable?

4. May 2, 2014

### micromass

No, a differentiable function must be continuous (this can actually be proven, so it's not an extra requirement).

But I'm confused now. Your OP talked about the continuity of the derivative, and now your talking about the continuity of the original function?

5. May 2, 2014

### V0ODO0CH1LD

Sorry, I confused the requirement for continuity of the derivative with the requirement for continuity of the actual function.. Forget that post.

I think I got it though, differentiability at a point implies continuity at that point, right? So the existence of f'(a) implies that the limit as x approaches a of f(x) = f(a). Is that it?

I guess my confusion started when piecewise functions were introduced in this, because the definition of the derivative of a piecewise function

$$f(x) = \left\{ \begin{array}{lr} y & x\neq{}0\\ a & x=0 \end{array} \right.$$
is
$$f'(x) = \left\{ \begin{array}{lr} dy/dx & x\neq{}0\\ \frac{d}{dx}a & x=0 \end{array} \right.$$

but then if say $\frac{d}{dx}a$ is defined the function should be differentiable at $0$, but it's definitely not continuous if the function is the one in the above post. Right?

6. May 2, 2014

### micromass

I don't agree with this derivative. To find $f^\prime(a)$, you need to work with the limit definition.

7. May 2, 2014

### Matterwave

The definition of a derivative is:

$$f'(x)\equiv\lim_{h\rightarrow 0}\frac{f(x+h)-f(x)}{h}$$

Taking your function at the point 0, we find:

$$f'(0)=\lim_{h\rightarrow 0}\frac{f(h)-a}{h}=\lim_{h\rightarrow 0}\frac{y-a}{h}=\infty,\quad y(x=0)\neq a$$

This limit does not exist if $y\neq a$ at x=0.

8. May 2, 2014

### V0ODO0CH1LD

Take this function for example:

$$f(x,y) = \left\{ \begin{array}{lr} \frac{x^2-y^2}{x^2 + y^2} & (x,y)\neq{}(0,0)\\ 0 & (x,y)=(0,0) \end{array} \right.$$
It is not continuous, right? Because
$$\lim_{(x,y)\rightarrow(0,0)}f(x,y)$$
is undefined and therefore different from $0$.

But both $f_x(0,0)=0$ and $f_y(0,0)=0$ from the definition of piecewise derivatives. So the derivatives do exist at $(0,0)$ but the function is not continuous at that point.

9. May 2, 2014

### micromass

Yes, this is a typical counterexample. But you should know that "differentiability" in two variables does not just mean that the two partial derivatives exist. If we only demanded that, then you're right that it's not enough to guarantee continuity.

Differentiability in several variables is a much stronger condition: http://en.wikipedia.org/wiki/Differentiable_function#Differentiability_in_higher_dimensions

10. May 2, 2014

### V0ODO0CH1LD

So for single variable functions the existence of the derivative at a point implies continuity (i.e. differentiability implies continuity), but for multivariable calculus it's not the existence of all partial derivatives that implies continuity, it's something stronger. Correct? Does differentiability still imply continuity for multivariable functions though? Also, does the existence plus continuity of all partial derivatives imply differentiability?

And one final question: what is the actual definition of continuity for multivariable functions?

11. May 2, 2014

### micromass

Correct.

Yes, if you take the stronger definition of differentiability. Existence of all partial derivatives is not enough.

Yes, this can be proven.

It's the same as the single-variable definition, but with absolute value changed by norms. So let $f:A\rightarrow \mathbb{R}^m$ be a function with $A\subseteq \mathbb{R}^n$. This is continuous in $a\in A$ if

$$\forall\varepsilon>0:~\exists \delta>0: \forall x\in A:~\|x-a\|<\delta~\Rightarrow~\|f(x) - f(a)\| <\varepsilon$$

It doesn't really matter which norm you use, all of the following norms on $x = (x_1,...,x_n) \in \mathbb{R}^n$ work:

$$\|x\|_1 = |x_1| + ... + |x_n|$$

$$\|x\|_2 = \sqrt{x_1^2 + ... + x_n^2}$$

$$\|x\|_\infty = \max\{|x_1|,...,|x_n|\}$$

All of these are useful norms depending on the application in mind. The notion of continuity will not change if you use different norms. For example, the statement

$$\forall\varepsilon>0:~\exists \delta>0: \forall x\in A:~\|x-a\|_2<\delta~\Rightarrow~\|f(x) - f(a)\|_2 <\varepsilon$$

and

$$\forall\varepsilon>0:~\exists \delta>0: \forall x\in A:~\|x-a\|_1<\delta~\Rightarrow~\|f(x) - f(a)\|_\infty <\varepsilon$$

are totally equivalent statements and both are suitable to characterize continuity in $a$.

12. May 3, 2014

### HallsofIvy

The definition of "differentiable" for a function of two variables that is given in most Calculus texts is:

"We say that a function, f(x,y), is differentiable at $(x_0, y_0)$ if and only if there exist a linear function, Ax+ By, and a function $\epsilon(x, y)$ such that
$$f(x,y)= A(x- x_0)+ B(y- y_0)+ \epsilon(x, y)$$
and
$$\lim_{x\to x_0, y\to y_0} \frac{\epsilon(x, y)}{\sqrt{(x- x_0)^2+ (y- y_0)^2}}= 0$$
(You can replace the square root in that with any of the norms that micromass mentioned.)

It can be shown that if f is differentiable, then its partial derivatives exist in some neighborhood of $(x_0, y_0)$ and that $\partial f/\partial x (x_0, y_0)= A$ and that $\partial f/\partial y(x_0,y_0)= B$.

While a derivative (even in a single variable) is not necessarily continuous itself, it must satisfy the "intermediate value property"- if f(a)= p and f(b)= q, then, for any r between p and q, there exist c, between a and b, such that f(c)= r. One consequence of that is that if a function is differentiable at $x_0$ and the two one-sided limits exist, those limits must be equal to the value of the derivative- a derivative cannot have any "jump" discontinuities.

Last edited by a moderator: May 3, 2014
13. May 3, 2014

### V0ODO0CH1LD

Actually I looked into it, I was wrong when I said that the function
$$f(x,y) = \left\{ \begin{array}{lr} \frac{x^2-y^2}{x^2 + y^2} & (x,y)\neq{}(0,0)\\ 0 & (x,y)=(0,0) \end{array} \right.$$
is not continuous at $(0,0)$ but the derivatives at that point exist. The function is not continuous at $(0,0)$ and therefore its derivatives at that point cannot exist. I'm not sure if it's some sort of convention or if it would violate something bigger if it did exist.

I think maybe the counter example you were thinking of is the function
$$f(x,y) = \left\{ \begin{array}{lr} \frac{x^3}{x^2 + y^2} & (x,y)\neq{}(0,0)\\ 0 & (x,y)=(0,0) \end{array} \right.$$
which is definitely continuous at the point $(0,0)$ but not differentiable. So the "counterintuitive" thing that happens is that functions may be continuous at a point and therefore its partial derivatives may exist there, but that doesn't mean that it is differentiable there. Not that the function is not continuous, its partial derivatives exist but it is not differentiable, that is not possible, right?

Also, are functions whose partial derivatives exist and are continuous a subset of differentiable functions? Or is it actually just another way to define differentiability? Is that also the case with existence of the derivative at a point and continuity for single variable functions?

14. May 3, 2014

### micromass

You're right. I ws thinking of the following:
$$f(x,y) = \left\{ \begin{array}{lr} \frac{xy}{x^2 + y^2} & (x,y)\neq{}(0,0)\\ 0 & (x,y)=(0,0) \end{array} \right.$$

This is discontinuous. But all the partial derivatives do exist.

See above, it is possible.

No, it's a proper subset. Saying that the partial derivatives exist and are continuous is called "continuously differentiable". It implies differentiable (which is defined with the strong definition, not just demanding the partials to exist), but it is not equivalent.

In single variables, existence of the derivative does imply continuity, but the derivative itself might not be continuous.

15. May 3, 2014

### V0ODO0CH1LD

So this is discontinuous because if you approach the point $(0,0)$ from different directions you get different values of the function, but its partial derivatives exist because the limits are defined in the directions $x= 0$ and $y=0$? Could this be generalized to the statement that if the limit exists in a particular direction then the directional derivative exists for that direction?

And in the case of
$$f(x,y) = \left\{ \begin{array}{lr} \frac{x^3}{x^2 + y^2} & (x,y)\neq{}(0,0)\\ 0 & (x,y)=(0,0) \end{array} \right.$$
the function is continuous, all its partial derivatives exist but I can prove that it isn't differentiable without going to the actual definition of continuity for multivariable functions by realizing that
$$\lim_{(x,y)\rightarrow{}(0,0)}f_y(x,y)$$
doesn't exist and therefore $f_y$ is not continuous? Right?

16. May 3, 2014

### micromass

I don't think you can prove it since it's not even true in single variables. For example, take $f(x)=|x|$, the limit exists in both directions, but the directional derivatives (= ordinary derivative) does not.

No, that's not correct. A function might be differentiable without the partial derivatives being continuous: http://mathinsight.org/differentiable_function_discontinuous_partial_derivatives
So just finding that $f_y$ is not continuous does not imply that $f$ is not differentiable.

17. May 3, 2014

### V0ODO0CH1LD

So how do I prove that this function isn't differentiable?

18. May 3, 2014

### micromass

First, find the two partial derivatives in $(0,0)$. If the function is differentiable in $(0,0)$ then by definition there is a linear map $J:\mathbb{R}^2\rightarrow \mathbb{R}^2$ such that

$$\lim_{\mathbf{h}\rightarrow 0} \frac{f(\mathbf{h}) - f(0,0) - J(\mathbf{h})}{\|\mathbf{h}\|} = 0$$

You can prove that the map $J$ satisfies

$$J(x,y) = x \frac{\partial f}{\partial x}(0,0) + y \frac{\partial f}{\partial y}(0,0)$$

So can you find the two partial derivatives to find an expression for $J$?

19. May 4, 2014

### V0ODO0CH1LD

In the example above f is a function $f:\mathbb{R}^2\rightarrow\mathbb{R}$, how can I add or subtract something from $\mathbb{R}^2$ with something from $\mathbb{R}$? Or is $J:\mathbb{R}^2\rightarrow \mathbb{R}$?

Also, I've just come across this example
$$f(x,y)=\frac{x^4y-y^5}{x^2 + y^2}$$
which is definitely not continuous at $(0,0)$ but its derivatives are. Does that mean that this function is differentiable at $(0,0)$ but not continuous there? Isn't that supposed to be impossible?

20. May 4, 2014

### micromass

Yes, you're right, that was a typo. The function is $J:\mathbb{R}^2\rightarrow \mathbb{R}$.

That function looks pretty continuous to me. At least, if you additionally define $f(0,0)=0$.