Example of a differentiable function such that its partial derivatives are not continues at some point I am currently reviewing James Stewart's Multivariable Calculus. In it, we are given the following theorem regarding a function $f: \mathbb{R}^2 \to \mathbb{R}$.

If the partial derivatives $f_x$ and $f_y$ exists near $(a,b)$ and are continues at $(a,b)$, then $f$ is differentiable at $(a,b)$.

I tried to find a specific case where $f$ is differentiable at $(a,b)$, but its partials are not continuous at $(a,b)$. Does anyone know any examples where that is the case?
I am starting to suspect that this might be an if and only-if statement, but he chose only to highlight one direction.
 A: The differentiability theorem states that continuous partial derivatives are sufficient for a function to be differentiable. It's important to recognize, however, that the differentiability theorem does not allow you to make any conclusions just from the fact that a function has discontinuous partial derivatives. The converse of the differentiability theorem is not true. It is possible for a differentiable function to have discontinuous partial derivatives.
An example of such a strange function is
$$f(x,y)=\begin{cases}(x^2+y^2)\sin\left(\frac{1}{\sqrt{x^2+y^2}}\right) & \text{ if $(x,y) \ne (0,0)$}\\0 &  \text{ if $(x,y) = (0,0)$}.\end{cases}$$
Since the argument of the sinusoid approaches infinity as one approaches the origin, it oscillates wildy near the origin. But, the sinusoid is bounded between $−1$
and $1$, and the oscillations of the sinusoid are tempered by the quadratic term $x^2+y^2$. As both paraboloids have the same horizontal tangent plane at the origin $z=0$, we can infer that $f(x,y)$ has the same tangent plane at the origin. The function $f(x,y)$ is differentiable at the origin.
To verify that the partial derivatives of $f$
are zero at the origin, consistent with the horizontal tangent plane, one must use the limit definition. For example, the derivative with respect to $x$
can be calculated by
\begin{align*}
  f_x(0,0) &= \lim_{h \to 0}
  \frac{f(h,0)-f(0,0)}{h}\\
  &= \lim_{h \to 0}\frac{h^2 \sin (1/|h|)-0}{h} \\
  &= \lim_{h \to 0}h \sin (1/|h|) =0.
\end{align*}
A similar calculation shows that $f_y(0,0)=0$. Away from the origin, one can use the standard differentiation formulas to calculate that
\begin{align*}
  f_x(x,y) &= 2 x \sin
   \left(\frac{1}{\sqrt{x^2+y^2}}\right)-\frac{x \cos
   \left(\frac{1}{\sqrt{x^2+y^2}}\right)}{\sqrt{x^2+y^2}}\\
  f_y(x,y) &= 2 y \sin
   \left(\frac{1}{\sqrt{x^2+y^2}}\right)-\frac{y \cos
   \left(\frac{1}{\sqrt{x^2+y^2}}\right)}{\sqrt{x^2+y^2}}.
\end{align*}
Both of these derivatives oscillate wildly near the origin. For example, the derivative with respect to $x$ along the $x$-axis is
$$f_x(x,0) = 2 x \sin
   \left(1/|x|\right)-\text{sign}(x) \cos
   \left(1/|x|\right),$$
for $x≠0$, where $\text{sign}(x)$ is $±1$ depending on the sign of $x$. In this case, the sine term goes to zero near the origin but the cosine term oscillates rapidly between $1$ and $−1$, as it is not multiplied by anything small. As $f_x$
approaches both $1$ and $-1$
within any neighborhood of the origin, it is discontinuous there. In the same way, one can show that $f_y$ has wild oscillations and is discontinuous at the origin. This function should prevent you from misinterpreting the differentiability theorem, as you now know that continuous partial derivatives imply differentiability but not vice-versa.
