# An example of differentiability in $\mathbb{R}^n$ everywhere but not at origin.

I came across such problem:

$g:\mathbb{R}\rightarrow \mathbb{R}$ is a $C^1$-function with $g(\theta+\pi)=-g(\theta)$ for all $x$. Define a function $f: \mathbb{R}^2\rightarrow \mathbb{R}$ as $$f(x,y)=f(r\cos{\theta},r\sin{\theta})=r\cdot g(\theta).$$

Show that $f$ is differentiable everywhere in $\mathbb{R}^2$ except possibly at $(x,y)=(0,0)$ and also that all the directional derivatives of $f$ exist at $(0,0)$

Can anyone show me the differentiability here just by the definition that

$\displaystyle \lim_{||h||\rightarrow 0}{ \frac{||f(x_0+h)-f(x_0)-J\cdot h||}{||h||}}=0$

Since there is change of variable involved as well and I don't know what the use of the periodicity of $g$ here, I am confused even more about the question.

I'll really appreciate if someone can show me the computation process, because I really need a concrete example to understand this well. Thanks :)

• Just rotate the function $\|x\|$ through the $z$-axis. – Pedro Tamaroff Apr 25 '13 at 1:31
• What do you mean by this? Could please explain more explicitly? – Cancan Apr 25 '13 at 1:43
• Look at the cone with vertex at the origin (or any point on the $z$ axis) and growing upwards (or downwards). It's like looking at the surface of revolution of $\|x\|$. – Pedro Tamaroff Apr 25 '13 at 1:56

You don't need a computation away from 0, because it is the product of differentiate functions. The function $r$ is not differentiable by itself at 0, so you have to try something else there. Along each line through the origin, $\theta$ is almst constant (it changes by $\pi$ at the origin), so taking the derivative is the same thing as finding the derivative of $mx$, where $m=g(\theta)$. This function is clearly differentiable.
An easy example is if $g=\sin(\theta)$. Then $f(x,y)=y$, and as I said above, the function is just a linear function $mx$ along each line through the origin.
• Try $g=\sin^3(\theta)$. Then the derivative along $\theta=\frac{\pi}{4}$ is not the product of the gradient and $(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}})$. So, for your explicit calculation, assume the derivative exists and take your limit in the vertical and horizontal directions to find $J$ explicitly, then go in the diagonal direction to show the limit is non zero. – Brian Rushton Apr 25 '13 at 1:53
• Which gradient do you mean here? with respect to $x,y$ or $\theta , r$? and why do you set $h=(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}})$ – Cancan Apr 25 '13 at 1:58
• If the function is differentiable, then any directional derivative can be found by taking the product of a direction vector with the $x,y$ gradient. So the fact this doesn't hold for my example shows it is not differentiable. – Brian Rushton Apr 25 '13 at 2:00