I came across this example, where $g = \sin\left(\frac{2x^3}{x^2+3y^2}\right)$ besides at the origin (where it's equal to $0$). To prove that $g$ wasn't differentiable at $(0,0)$ the following argument was used, where $g'(0;(1,1))$ is the directional derivative from the point $(0,0)$ along the vector $(1,1)$:
$$g'(0;(1,1)) = \lim_{t\to 0} \frac{g(t,t) - g(0)}{t} = \frac{1}{2}$$ and
$$\nabla g(0,0)\cdot (1,1) = 2 \neq g'(0;(1,1)).$$
Therefore, $g$ isn't differentiable at $(0,0)$.
Is this argument correct? If so, why? And, is it valid in general?
It’s important to remember that that second method of computing a directional derivative is not a definition of the directional derivative. It’s a consequence of the chain rule that’s only valid when $f$ is differentiable in the first place. That is, if $f$ is differentiable at $p$, then $D_vf(p) = \nabla f(p)\cdot v$. Since in this case the latter expression doesn’t produce the correct value, it must be the case that $f$ is not differentiable at $p$.
Note, though, that if it did produce the correct value, we couldn’t really conclude anything about differentiability: the converse isn’t true. There are standard examples of functions for which all directional derivatives exist and are consistent in the sense that $D_vf(p)=\nabla f(p)\cdot v$, but still fail to be differentiable at $p$.