# Find an anti-example of Clairaut's theorem

Here is a quote from Calculus: Early Transcendentals written by James Stewart

Clairaut’s Theorem：Suppose $$f$$ is defined on a disk $$D$$ that contains the point $$(a, b)$$. If the functions $$f_{xy}$$ and $$f_{yx}$$ are both continuous on $$D$$, then $$f_{xy} = f_{yx}$$

Where $$f_{xy} \equiv \frac{\partial}{\partial y} \left( \frac{\partial f}{\partial x} \right)$$

I don't know how to compose a function that $$f_{xy}$$ or $$f_{yx}$$ are not continuous on $$(a, b)$$. Can you give me an example?

For example take $$f(x,y)= xy\frac{x^2-y^2}{x^2+y^2} \quad ((x,y)\not=(0,0)), \quad \quad f(0,0)=0.$$ Here $$f_x$$ and $$f_y$$ both exist and are even continuous on $$\mathbb{R}^2$$, and $$f_{xy}(0,0)=-1,\quad f_{yx}(0,0)=1.$$ The continuity of $$f_x$$ and $$f_y$$ in $$(0,0)$$ is a bit tricky, but it is easy to show that $$f_x(0,y)=-y$$ for all $$y$$ and $$f_y(x,0)=x$$ for all $$x$$.

Edit: You can see directly that $$f_{xy}$$ and $$f_{yx}$$ are not continuous in $$(0,0)$$. You have calculated $$f_{xy}(x,y)=f_{yx}(x,y)=\frac{x^6+9x^4y^2-9x^2y^4-y^6}{(x^2+y^2)^3} \quad ((x,y) \not= (0,0)).$$ Inserting $$(1/n,1/n)$$ leads to $$f_{xy}(1/n,1/n)= 0 \to 0$$ $$(n \to \infty)$$. Inserting $$(1/n,0)$$ leads to $$f_{xy}(1/n,0)= 1 \to 1$$ $$(n \to \infty)$$. Thus $$\lim_{(x,y)\to (0,0)} f_{xy}(x,y)$$ does not exist.

• I try to calculate $f_{xy}$ and $f_{yx}$. They are the same. $$f_{xy} = \frac{x^2 - y^2}{x^2 + y^2} + 8xyf \frac{x^2 + y^2}{(x^2 + y^2)^3} = \frac{x^6 + 9x^4y^2 -9x^2y^4 - y^6}{(x^2 + y^2)^3} = f_{yx}$$
– gyro
Dec 22, 2022 at 8:04
• Of course they are the same on $\mathbb{R}^2 \setminus \{(0,0)\}$ according to Clairaut's Theorem. But $f_{xy}(0,0)$ and $f_{yx}(0,0)$ are different and have to be calculated by the definition of partial derivatives. This shows that $f_{xy}$ and $f_{yx}$ cannot both be continuous in an neighborhood of $(0,0)$.
– Gerd
Dec 22, 2022 at 8:23
• I see. Thank you!
– gyro
Dec 22, 2022 at 11:52

Just pick any function which isn't continuous and integrate it twice.

For example, let $$D=(-1,1)\times (-1,1)$$. Consider $$g(x,y)=\operatorname{sgn}(x)\operatorname{sgn}(y)$$ Which is not continuous on $$D$$. Now let $$f(x,y)=\int_0^y\int_0^x g(x',y')\mathrm dx'\mathrm dy' \\ =\int_0^y\int_0^x \operatorname{sgn}(x')\operatorname{sgn}(y')\mathrm dx'\mathrm dy' \\ =\int_0^y|x|\operatorname{sgn}(y')\mathrm dy' \\ =|xy|$$

Note that $$f$$ is continuous on $$D$$.

• I should add: $\operatorname{sgn}(x)=|x|/x$ and $\operatorname{sgn}(0)=0$ is the sign function. Dec 21, 2022 at 14:44
• How are $f_{xy}$ and $f_{yx}$ defined on a neighborhood of the origin? Dec 21, 2022 at 15:45
• @TedShifrin That wasn't stated as a requirement. Dec 21, 2022 at 23:02
• The hypothesis was “$f_{xy}$ and $f_{yx}$ are both continuous on the disk $D$,” so I believe you are in error. Dec 22, 2022 at 0:26
• Yes, OK, I responded to the wrong issue. You're claiming the equality of $f_{xy}(0)$ and $f_{yx}(0)$ fails to hold because neither is defined? Perhaps you win on a logical technicality, but I don't think you're enhancing the OP's understanding of the theorem. Dec 22, 2022 at 3:44