How many partials need to be continuous to imply differentiability?

Let $f:\mathbb{R}^n \to \mathbb{R}$. Let $x_0 \in \mathbb{R}^n$. Assume $n-1$ partials exist in some open ball containing $x_0$ and are continuous at $x_0$, and the remaining $1$ partial is assumed only to exist at $x_0$. A well known result states that this implies $f$ is differentiable at $x_0$.

My question is whether or not this can be strengthened. Can we replace "$n-1"$ in the above theorem with some function $g(n)$ "smaller" than $n-1$, and replace "remaining $1$ partial" with "remaining $n-g(n)$ partials"?

Feel free to play with assumptions slightly. For instance, you can replace "continuous at $x_0$" with "continuous at $x_0$ and in some open ball containing $x_0$".

• By looking at the proof of the theorem, I guess there are counterexamples showing that dropping the continuity of more than one partial in a neighborhood might lead to non-differentiability. – amsmath Aug 30 '18 at 22:59

For $n = 2$ it is not sufficient to assume that the 2 partial derivatives merely exist.
This generalizes to abitrary $n$. Assume we could take $g(n) = n-2$. Consider any function $f : \mathbb{R}^2 \to \mathbb{R}$ and define $F : \mathbb{R}^n \to \mathbb{R}, F(x_1,\ldots,x_n) = f(x_1,x_2)$. We have $\frac{\partial F}{\partial x_i}(\xi^0) = 0$ for $i= 3,\ldots,n$ and could therefore conclude that $F$ is differentiable at $\xi^0$ if the first two partials exist at $\xi^0$. But this would imply that $f$ is differentiable at $(\xi_1^0,\xi_2^0)$ which is not true in general.
It's been said that (i) in $\Bbb R^2$ the mere existence of both partials is not enough, (ii) it follows that continuity of $n-2$ partials in $\Bbb R^n$ is not enough.
The point being that by definition the existence and value of $f_x(0,0)$ depends only on $f(h,0)$, and similarly $f_y(0,0)$ depends only on $f(0,h)$, so the existence of $f_x(0,0)$ and $f_y(0,0)$ cannot possibly say anything about $f(x,y)$ when neither $x$ nor $y$ vanishes. To be explicit, let $$f(x,y)=\begin{cases}1,&(xy=0),\\0,&(xy\ne0).\end{cases}$$Then $f_x(0,0)=f_y(0,0)=0$ but $f$ is not continuous at the origin.
Hint for readers puzzled by some of the assertions above: I suspect you're taking "differentiate with respect to $x$, pretending $y$ is a constant" as the definition of $f_x$. That's a little fuzzy to use in proofs - a less fuzzy version of the definition is $$f_x(x_0,y_0)=\lim_{h\to0}\frac{f(x_0+h,y_0)-f(x_0,y_0)}h.$$