# All directional derivatives exist for function $f(x,y)=0$ except when $y=x^2$ and $x\neq 0$

I am struggling to show that all directional derivatives exist for the function

$$f(x,y)=\begin{cases} 1 & \mathrm{if\:} x=y^2 \land x \neq 0 \\ 0 & \mathrm{otherwise} \\ \end{cases}$$

using the formula $$D_vf(0,0)=\lim_{h\to 0}\frac{1}{h}[f(hv_1,hv_2)-f(0,0)]$$.

If we choose $$x\neq y^2 \lor x=0$$ obviously $$\lim_{h\to 0}\frac{1}{h}[f(hv_1,hv_2)-f(0,0)] = 0$$ since $$f(hv_1,hv_2)=0$$ in this case.

In the other case I will agree, that $$\lim_{h\to 0}\frac{1}{h}[f(hv_1,hv_2)-f(0,0)] = 0$$ for all $$h\neq 1$$.

But if our arbitrary $$h \in \mathbb{R}\setminus \{0\}$$ is $$1$$ as we insert $$hv_1$$ and $$hv_2$$ in $$f$$ we surely get $$\lim_{h\to 0}1/h=\infty$$.

I would be pleased if someone could help me clear things up and provide me a solution how to show that all directional derivatives exist.

• How does what happens at $h=1$ have any relevance to the limit as $h\to0$? It doesn’t matter if the line along which you’re computing the derivative intersects the curve $x=y^2$ at some point besides the origin. For any fixed direction, once $h$ is sufficiently small, the line and parabola won’t intersect and the value of $f$ will remain $0$. – amd Dec 8 '19 at 19:40
• So doesn't the value of $f(hv_1, hv_2)$ depend on h? If $hv_1=h^2v_2^2$ than $f(hv_1, hv_2)=1$ and $0$ otherwise. And after that we apply the limit. So I got some serious problems to write that down rigorously. @amd – lambda Dec 8 '19 at 20:16
• For any fixed direction vector $(v_1,v_2)$, there is at most one $h_0\ne0$ for which $h_0v_1=h_0^2v_2^2$. If $\lvert h\rvert\lt \lvert h_0\rvert$, then the value of $f$ along this line must be identically $0$. Now recall the $\epsilon$-$\delta$ definition of a limit. – amd Dec 8 '19 at 23:10
• Got it. Thanks a lot! – lambda Dec 9 '19 at 19:18

The key observation here is that for any fixed direction vector $$(v_1,v_2)$$, the line $$(hv_1,hv_2)$$ has at most two intersections with $$x=y^2$$: there’s always one at the origin, which we don’t care about, and there might be another for some value $$h_0$$ of $$h$$. If there’s only one intersection, then the value of $$f$$ along the line is identically zero, so we’re done. If this $$h_0$$ exists, on the other hand, then for any $$h\lt h_0$$, $$f(hv_1,hv_2)=0$$. So, going back to the $$\epsilon$$-$$\delta$$ definition of a limit, for any $$\epsilon\gt0$$ we need only take $$\delta\lt h_0$$; the limit of the difference quotient is also equal to $$0$$ in this case. To put it a different way, what happens at a single point away from the origin is irrelevant since we can always restrict our attention to neighborhoods of the origin that don’t contain this point when computing the limit.
Of course, this function is not differentiable at the origin since it’s not even continuous there. This is a fairly standard example of how the existence of all directional derivatives, and moreover, that they are consistent in the sense that the derivative in the direction of $$\mathbf v$$ is equal to $$\mathbf v\cdot\nabla f$$, is not sufficient for $$f$$ to be differentiable.