# Compute the directional derivative, check if the function is differentiable

I need to compute the directional derivative of the function:

$$f(x,y)=|x-y|$$

at (0,0) in the direction $[\frac{1}{2}, -\frac{\sqrt{3}}{2}]$.

Well, I've been thinking to check if the function is differentiable at $(0,0)$ first, as it seems to be some "critical" point:

$f(x,y)=x-y$ for $x - y \ge 0$
$f(x,y)=y-x$ for $x - y < 0$

I'd like to do this using the definition, so:

$\lim\limits_{x->0} \frac{f(x_{0} + x, y_{0}) - f(x_{0}, y_{0})}{x}$
$\lim\limits_{y->0} \frac{f(x_{0}, y_{0} + y) - f(x_{0}, y_{0})}{x}$

If they are the same then the function is differentiable at (0,0)...but what function should I use, $x-y$ or $y-x$...?

The same problem appears when I need to evaluate derivatives of this function to use them in the directional derivative formula...how can I handle that?

## 2 Answers

By the definition of directional derivative $$\frac{\partial{f}}{\partial{\vec{l}}}=\lim\limits_{t\to{+0}}{\frac{f(x_0+t\cos{\alpha},\ y_0+t\sin{\alpha})-f(x_0,\ y_0)}{t}}=\\ =\lim\limits_{t\to{+0}}{\frac{|t\cdot\frac{1}{2}+t\cdot\frac{\sqrt{3}}{2}|}{t}}=\lim\limits_{t\to{+0}}{\frac{t|\frac{1}{2}+\frac{\sqrt{3}}{2}|}{t}}=\frac{1}{2}+\frac{\sqrt{3}}{2}.$$ I thank Nadiyka for noticed inaccuracies.

parameterize it.

$t=(\frac{1}{2},\frac{\sqrt3}{2})$

$\lim_{t\rightarrow+0}\frac{f(0+\frac{t}{2},0+\frac{t\sqrt3}{2})-f(0,0)}{t}$

I have defined to such that it is of unit length. That part is important.

• $\lim_{t\rightarrow0}\frac{f(0+\frac{t}{2},0+\frac{t\sqrt3}{2})-f(0,0)}{t}=\lim_{t\rightarrow0}\frac{|\frac{t-t\sqrt3}{2}|}{t}$ – f00d Sep 4 '13 at 20:03