Skip to main content

Appendix D. Subtleties of Partial Derivatives

The existence of directional derivatives in every direction is still not enough to guarantee differentiability. The following standard example shows why.

Example D.0.1.

Define \(f \colon \R^2 \to \R\) by
\begin{equation*} f(x,y) = \begin{cases} \dfrac{x^3}{x^2+y^2}, & \langle x,y \rangle \ne \langle 0,0 \rangle, \\ 0, & \langle x,y \rangle = \langle 0,0 \rangle. \end{cases} \end{equation*}
Show that every directional derivative of \(f\) at \(\langle 0,0 \rangle\) exists, but \(f\) is not differentiable there.
Solution.
Let \(\vu=\langle a,b \rangle\) be a unit vector. For \(t \ne 0\text{,}\)
\begin{equation*} f(t\vu) = f(ta,tb) = \frac{t^3a^3}{t^2(a^2+b^2)} = t\,\frac{a^3}{a^2+b^2}. \end{equation*}
Therefore
\begin{equation*} D_{\vu}f(0,0) = \lim_{t \to 0}\frac{f(t\vu)-f(0,0)}{t} = \frac{a^3}{a^2+b^2}. \end{equation*}
Since \(\vu\) is a unit vector, \(a^2+b^2=1\text{,}\) so
\begin{equation*} D_{\vu}f(0,0)=a^3. \end{equation*}
Thus every directional derivative exists at the origin. If \(f\) were differentiable at \(\langle 0,0 \rangle\text{,}\) then the map \(\vu \mapsto D_{\vu}f(0,0)\) would have to be linear in \(\vu\text{.}\) But
\begin{equation*} D_{\langle 1,0 \rangle}f(0,0)=1, \qquad D_{\langle 0,1 \rangle}f(0,0)=0, \end{equation*}
while
\begin{equation*} D_{\frac{1}{\sqrt{2}}\langle 1,1 \rangle}f(0,0) = \left(\frac{1}{\sqrt{2}}\right)^3 = \frac{1}{2\sqrt{2}}. \end{equation*}
A linear map with the first two values above would send \(\frac{1}{\sqrt{2}}\langle 1,1 \rangle\) to \(\frac{1}{\sqrt{2}}\text{,}\) not to \(\frac{1}{2\sqrt{2}}\text{.}\) So \(\vu \mapsto D_{\vu}f(0,0)\) is not linear, and therefore \(f\) is not differentiable at the origin.
A second subtlety appears one order higher. Even when the mixed second partial derivatives \(f_{xy}(a,b)\) and \(f_{yx}(a,b)\) both exist, they need not be equal.

Example D.0.2.

Define \(g \colon \R^2 \to \R\) by
\begin{equation*} g(x,y) = \begin{cases} \dfrac{xy(x^2-y^2)}{x^2+y^2}, & \langle x,y \rangle \ne \langle 0,0 \rangle, \\ 0, & \langle x,y \rangle = \langle 0,0 \rangle. \end{cases} \end{equation*}
Show that the mixed partial derivatives of \(g\) at the origin exist but are not equal.
Solution.
First compute \(g_x(0,y)\text{.}\) For \(y \ne 0\text{,}\)
\begin{equation*} g_x(0,y) = \lim_{h \to 0}\frac{g(h,y)-g(0,y)}{h} = \lim_{h \to 0} y\,\frac{h^2-y^2}{h^2+y^2} = -y. \end{equation*}
Also \(g_x(0,0)=0\text{.}\) Therefore
\begin{equation*} g_{yx}(0,0) = \lim_{k \to 0}\frac{g_x(0,k)-g_x(0,0)}{k} = \lim_{k \to 0}\frac{-k}{k} = -1. \end{equation*}
Next compute \(g_y(x,0)\text{.}\) For \(x \ne 0\text{,}\)
\begin{equation*} g_y(x,0) = \lim_{k \to 0}\frac{g(x,k)-g(x,0)}{k} = \lim_{k \to 0} x\,\frac{x^2-k^2}{x^2+k^2} = x. \end{equation*}
Also \(g_y(0,0)=0\text{.}\) Hence
\begin{equation*} g_{xy}(0,0) = \lim_{h \to 0}\frac{g_y(h,0)-g_y(0,0)}{h} = \lim_{h \to 0}\frac{h}{h} = 1. \end{equation*}
Thus \(g_{xy}(0,0)=1\) while \(g_{yx}(0,0)=-1\text{,}\) so the mixed partial derivatives are not equal at the origin.

Proof.

Consider the rectangular increment
\begin{equation*} R(x,y) := f(x,y)-f(x,b)-f(a,y)+f(a,b). \end{equation*}
We will factor \(R(x,y)\) in two ways.
First fix \(x\) near \(a\text{.}\) Since \(R(x,b)=0\text{,}\) the one-variable Caratheodory factorization applied to the function \(y \mapsto R(x,y)\) at \(y=b\) gives
\begin{equation*} R(x,y)=A(x,y)(y-b), \end{equation*}
where \(A(x,b)=f_y(x,b)-f_y(a,b)\text{.}\) Now \(A(a,b)=0\text{,}\) and applying the same factorization to \(x \mapsto A(x,b)\) at \(x=a\) yields
\begin{equation*} A(x,b)=B(x)(x-a), \qquad B(a)=f_{yx}(a,b). \end{equation*}
Thus there is a function \(B_1(x,y)\text{,}\) continuous at \(\langle a,b \rangle\text{,}\) such that
\begin{equation*} R(x,y)=B_1(x,y)(x-a)(y-b), \qquad B_1(a,b)=f_{yx}(a,b). \end{equation*}
Reversing the roles of \(x\) and \(y\) gives another factorization
\begin{equation*} R(x,y)=B_2(x,y)(x-a)(y-b), \qquad B_2(a,b)=f_{xy}(a,b), \end{equation*}
where \(B_2\) is continuous at \(\langle a,b \rangle\text{.}\) For \(x \ne a\) and \(y \ne b\text{,}\) both factorizations represent the same quotient
\begin{equation*} \frac{R(x,y)}{(x-a)(y-b)}. \end{equation*}
Hence \(B_1(x,y)=B_2(x,y)\) away from the lines \(x=a\) and \(y=b\text{.}\) Taking the limit as \(\langle x,y \rangle \to \langle a,b \rangle\) and using continuity, we obtain
\begin{equation*} f_{yx}(a,b)=B_1(a,b)=B_2(a,b)=f_{xy}(a,b). \end{equation*}