Suppose all partial derivatives of $f$ exist at $x_0$; is $f$ continuous at $x_0$? Consider $f : C \to \mathbb{R}$ with $C \subset \mathbb{R}^n$ being open:


*

*Suppose $f$ is differentiable at $\mathbf{x}_0 \in C$. Is $f$ continuous at $\mathbf{x}_0$? Why?

*Suppose all partial derivatives of $f$ exist at $\mathbf{x}_0 \in C$ but $\nabla f = 0$. Is $f$ continuous at $\mathbf{x}_0$? Why?

*Suppose all partial derivatives of $f$ exist at $\mathbf{x}_0 \in C$ and $\nabla f \ne 0$. Is $f$ continuous at $\mathbf{x}_0$? Why?
The answer to (1) is clear: yes, because differentiability is sufficient for continuity. This follows from the definition of differentiability (is this a sufficient answer?).
For (2) and (3) however, I am stumped. I remember from real analysis that when all partial derivatives exist and are continuous, then the function is differentiable (and differentiability implies continuity). However, I don't know if the partials are continuous. I only know that in one case $\nabla f \ne 0$ and in another case $\nabla f = 0$.
Thanks for your help!

Edit: From taking a look at this question, it seems like some counterexamples (where the directional derivatives exist and equal $0$) show the answers to (2) and (3) are no and no. I have produced some counterexamples and posted them as an answer below. Please let me know if they're OK. Thanks!
Edit 2: Marc van Leeuwen mentioned my answer may not be correct because of some technicalities regarding the gradient. Please take a look and let us know what you think. Thanks!
 A: *

*Yes, since differentiability is sufficient for continuity.

*Not necessarily. Consider the function
\begin{equation}
f(x,y)=\left\{
     \begin{array}{lr}
       0 & x=0\textrm{ or }y=0\\
       1 & otherwise
     \end{array}
   \right.
\end{equation}
Since $\frac{\partial f}{\partial x}(0,0)= \lim_{h \to 0} \frac{f(h,0)-f(0,0)}{h}=\lim_{h \to 0} \frac{0}{h}=0$ and similarly $\frac{\partial f}{\partial y}(0,0)=0$, then
\begin{equation}
\nabla f(0,0) = \left(\frac{\partial f}{\partial x}(0,0),\frac{\partial f}{\partial y}(0,0)\right)=(0,0)
\end{equation}
However, since $\lim_{x \to 0} f(x,x) = 1 \ne 0=f(0,0)$, then $f$ is not continuous at $(0,0)$.

*Not necessarily. Consider the function
\begin{equation}
f(x,y)=\left\{
     \begin{array}{lr}
       x+y & x=0\textrm{ or }y=0\\
       1 & otherwise
     \end{array}
   \right.
\end{equation}
Since $\frac{\partial f}{\partial x}(0,0)= \lim_{h \to 0} \frac{f(h,0)-f(0,0)}{h}=\lim_{h \to 0} \frac{h}{h}=1$ and similarly $\frac{\partial f}{\partial y}(0,0)=1$, then
\begin{equation}
\nabla f(0,0) = \left(\frac{\partial f}{\partial x}(0,0),\frac{\partial f}{\partial y}(0,0)\right)=(1,1)
\end{equation}
However, since $\lim_{x \to 0} f(x,x) = 1 \ne 0=f(0,0)$, then $f$ is not continuous at $(0,0)$.
