# Directional derivative for a piece-wise function

Consider the function $f:\mathbb{R}^2 \rightarrow \mathbb{R}$ given by $$f(x,y)=\begin{cases} \frac{xy}{x^2+y^2} &\text{if} (x,y)\neq (0,0)\\ 0 &\text{if} (x,y)=(0,0) \end{cases}$$ For which vectors $v=(v_1,v_2)\neq(0,0)\in\mathbb{R}^2$ does the directional derivative $D_vf(0,0)$ exist? Evaluate the directional derivative wherever it exists.

I've managed to get this down to $$D_vf(0,0)=\lim_{h\to 0}\frac{v_1v_2}{h(v_1^2+v_2^2)}$$ and as far as I'm aware this can only exist if one of $v_1$ or $v_2$ is $0$, but not both by the original condition. If this is the case does that mean the directional derivative only exits for $v=(v_1,0) \; \text{or} \; v=(0,v_2)$? If that is the case, how would I find the value of the directional derivative as it comes down to $D_vf(0,0)=\frac{0}{0}$?

• simply observe that for $v=(v_1,0) \; \text{or} \; v=(0,v_2)$ we have $\frac{v_1v_2}{h(v_1^2+v_2^2)}=0$ then $D_vf(0,0)=\lim_{h\to 0}\frac{v_1v_2}{h(v_1^2+v_2^2)}=0$
– user
Apr 1, 2018 at 6:55

If this is the case does that mean the directional derivative only exits for $v=(v_1,0)$ or $v=(0,v_2)$?

Yes, you are right. Because the limit doesn't exists for $v_1\neq 0\neq v_2$, the directional derivate of $f$ doesn't exists to for $v_1\neq 0\neq v_2$.

If that is the case, how would I find the value of the directional derivative as it comes down to $D_vf(0,0)=\frac00$?

Where does $\frac00$ appear? Consider $v\neq 0$. Therefore, if $v_1=0$, then $v_2\neq 0$ and $$\frac{v_1v_2}{h(v_1^2+v_2^2)}=\frac{0\cdot v_2}{h(0^2+v_2^2)}=\frac{0}{hv_2^2}=0.$$

The result is less surprising if we consider for $(x,y)\neq (0,0)$ and $r>0$. $$f(rx,ry)=\frac{rxry}{(rx)^2+(ry)^2}=\frac{xy}{x^2+y^2}.$$ So $f$ is constant along the rays starting from the orgin. If $x=0$ xor $y=0$, then $f$ goes continuously to $0$ for $r\to 0$. Since $f$ is constant on the ray, the directional derivative is obviously $0$. But if $x\neq 0\neq y$, the function $f$ is constant $\frac{xy}{x^2+y^2}\neq 0$ for $r>0$ and $0$ for $r=0$. Hence $f$ has a jump here. Therefore, the directional derivative becomes $\pm\infty$ depending if the jump goes up or down.

Note that for $v=(v_1,0) \; \text{or} \; v=(0,v_2)$

$$\frac{v_1v_2}{h(v_1^2+v_2^2)}=0$$