Here is an example, where a function of two variables
f[x_,y_]:=Sqrt[RealAbs[x^2 - x*y]]
is not differentiable at the origin, but its directional derivative at the origin for many directions exists.
We consider the restriction of the function f[x,y]
on the ray from the origin along a vector {a,b}
, preserving the scale by
g[t] := f[x, y] /. {x -> a/Norm[{a, b}]*t, y -> b/Norm[{a, b}]*t}
assuming t>=0
. Now
D[g[t],t]
(*(((2 a^2 t)/(Abs[a]^2 + Abs[b]^2) - (2 a b t)/( Abs[a]^2 + Abs[b]^2)) ((a^2 t^2)/
(Abs[a]^2 + Abs[b]^2) - (a b t^2)/(Abs[a]^2 + Abs[b]^2)))/(2 RealAbs[(a^2 t^2)/
( Abs[a]^2 + Abs[b]^2) - (a b t^2)/(Abs[a]^2 + Abs[b]^2)]^(3/2))*)
and
Limit[%, t -> 0, Direction -> "FromAbove"] // Simplify
$$
\begin{cases}
\sqrt{-\frac{a (a-b)}{a^2+b^2}} & a\neq 0\land a^2<a b
\\
\sqrt{\frac{a (a-b)}{a^2+b^2}} & (b=0\land a\neq
0)\lor (b<0\land (a\geq 0\lor a\leq b))\lor
(b>0\land (a\geq b\lor a\leq 0)) \\
\text{Indeterminate} & \text{True} \\
\end{cases}
$$
It should be noticed that
ResourceFunction["DirectionalD"][Sqrt[RealAbs[x^2 - x*y]], {a, b}, {x, y}]
(*-((b x (x^2 - x y))/(2 RealAbs[x^2 - x y]^(3/2))) +(a (2 x - y) (x^2 - x y))/(2 RealAbs[x^2 - x y]^(3/2))*)
, but
Limit[%, {x, y} -> {0, 0}]
(*Indeterminate*)
{D[Sqrt[RealAbs[x^2 - x*y]], x], D[Sqrt[RealAbs[x^2 - x*y]], y]} /. {x -> 0, y -> 0}
produces{Indeterminate, Indeterminate}
andD[Sqrt[RealAbs[x^2 - x*y]] /. {x -> t, y -> sqrt[2]*t}, t] /. t -> 0
performsIndeterminate
too. $\endgroup$DirectionalD
$\endgroup$(Grad[x^3/3 - x*y^2 - x/8 + y^2, {x, y}] /. {x -> 1, y -> 1}).Normalize[{Sqrt[3]/2, 1/2}]
. $\endgroup$