# Thread: A question about partial derivatives and directional derivative.

1. ## A question about partial derivatives and directional derivative.

Assume $\displaystyle f$ is a real-valued function defined on an open set $\displaystyle E$ of $\displaystyle \mathbb R^n$ and all partial derivatives of $\displaystyle f$ exist on $\displaystyle E$. Is it possible that there is some $\displaystyle {\bf {a}}\in E$ and $\displaystyle {\bf u}\in\mathbb R^n$ such that the directional derivative of $\displaystyle f$ in the direction of $\displaystyle \bf u$ at $\displaystyle \bf a$ does not exist?
Thanks!

2. Originally Posted by zzzhhh
Assume $\displaystyle f$ is a real-valued function defined on an open set $\displaystyle E$ of $\displaystyle \mathbb R^n$ and all partial derivatives of $\displaystyle f$ exist on $\displaystyle E$. Is it possible that there is some $\displaystyle {\bf {a}}\in E$ and $\displaystyle {\bf u}\in\mathbb R^n$ such that the directional derivative of $\displaystyle f$ in the direction of $\displaystyle \bf u$ at $\displaystyle \bf a$ does not exist?
On $\displaystyle \mathbb{R}^2$, let $\displaystyle f(x,y) = \begin{cases}\frac{xy}{x^2+y^2}&((x,y)\ne(0,0)),\\ 0&((x,y)=(0,0)).\end{cases}$

Then both partial derivatives of f exist at the origin (and everywhere else), but the directional derivatives in the directions of $\displaystyle (1,\pm1)$ do not exist.

3. If f is differentiable at a point, then the directional derivative in all directions exists. But, as Opalg showed, it may happen that has partial derivatives at a point but is not "differentiable" there.

Another example is
$\displaystyle f(x,y) = \begin{cases}1 &((x,y)\ne(0,0)),\\ 0&((x,y)=(0,0)).\end{cases}$

At (0,0) both partial derivatives exist and are 0. But the function is not differentiable and directional derivatives do not exist except in the directions of the axes.

4. Originally Posted by HallsofIvy
Another example is
$\displaystyle f(x,y) = \begin{cases}1 &((x,y)\ne(0,0)),\\ 0&((x,y)=(0,0)).\end{cases}$

At (0,0) both partial derivatives exist and are 0. But the function is not differentiable and directional derivatives do not exist except in the directions of the axes.
Umm, I hate to disagree, but that example does not have partial derivatives at the origin:

$\displaystyle \frac{\partial f}{\partial x}(0,0) = \lim_{h\to0}\frac{f(h,0)-f(0,0)}h = \lim_{h\to0}\frac{1-0}h =$ (ouch!)

I think you probably meant $\displaystyle f(x,y) = \begin{cases}1 &(xy\ne0),\\ 0&(x \text{ or }y =0).\end{cases}$ But no, on second thoughts that won't work either, because that function doesn't have partial derivatives on either of the axes (except at the origin). I have a feeling that the example I gave previously can't really be simplified.

5. Thank you! Now I have a further question: Assume the conditions in my first post still hold, that is, $\displaystyle f$ is a real-valued function defined on an open set $\displaystyle E$ of $\displaystyle \mathbb R^n$ and all partial derivatives of $\displaystyle f$ exist on $\displaystyle E$. If the directional derivative of $\displaystyle f$ in the direction of $\displaystyle {\bf u}=(u_1,...,u_n)$ at a point $\displaystyle {\bf a}\in E$ does exist, is it always true that the value of the directional derivative equals the inner product $\displaystyle (D_1f({\bf a}),...,D_nf({\bf a}))\cdot(u_1,...,u_n)$? Thanks!

6. Originally Posted by Opalg
I think you probably meant $\displaystyle f(x,y) = \begin{cases}1 &(xy\ne0),\\ 0&(x \text{ or }y =0).\end{cases}$ But no, on second thoughts that won't work either, because that function doesn't have partial derivatives on either of the axes (except at the origin). I have a feeling that the example I gave previously can't really be simplified.

Why does this not work?

f=0 everywhere on the x and y axis, and f=1 otherwise, so:

$\displaystyle \frac{\partial f}{\partial x}(x,0)=\lim\limits_{h\to0}\frac{f(x+h,0)-f(x,0)}{h}=\lim\limits_{h\to0}\frac{0-0}{h}=0$, for all $\displaystyle x\in\mathbb{R}$

7. Originally Posted by hjortur
Why does this not work?

f=0 everywhere on the x and y axis, and f=1 otherwise, so:

$\displaystyle \frac{\partial f}{\partial x}(x,0)=\lim\limits_{h\to0}\frac{f(x+h,0)-f(x,0)}{h}=\lim\limits_{h\to0}\frac{0-0}{h}=0$, for all $\displaystyle x\in\mathbb{R}$
This function has a partial x-derivative at points on the x-axis, but not a partial y-derivative. If $\displaystyle x\ne0$ then $\displaystyle \frac{\partial f}{\partial y}(x,0)=\lim_{k\to0}\frac{f(x,k)-f(x,0)}{k}=\lim_{k\to0}\frac{1-0}{k}$, which does not exist.

On the y-axis, the function has a partial y-derivative but not a partial x-derivative.

8. Originally Posted by Opalg
Umm, I hate to disagree, but that example does not have partial derivatives at the origin:

$\displaystyle \frac{\partial f}{\partial x}(0,0) = \lim_{h\to0}\frac{f(h,0)-f(0,0)}h = \lim_{h\to0}\frac{1-0}h =$ (ouch!)

I think you probably meant $\displaystyle f(x,y) = \begin{cases}1 &(xy\ne0),\\ 0&(x \text{ or }y =0).\end{cases}$ But no, on second thoughts that won't work either, because that function doesn't have partial derivatives on either of the axes (except at the origin). I have a feeling that the example I gave previously can't really be simplified.
Ouch! You are right. That is the example I meant to give. It does have partial derivatives at (0,0) but is not differentiable there. $\displaystyle \frac{\partial f}{\partial x}$ exists at (x, 0) but not $\displaystyle \frac{\partial f}{\partial y}$ and vice-versa at (0, y).

That is not a good example because the initial post asked for an example where the partial derivatives exist on some open set. Thank you.

9. Originally Posted by HallsofIvy
That is not a good example because the initial post asked for an example where the partial derivatives exist on some open set. Thank you.
I would still like to express my thanks for your consideration of my problem. I benefit a lot from you all.