TITLE: Are partial derivatives always commutative? When is $\frac{\partial^2}{ \partial x\partial y}f(x,y)\neq\frac{\partial^2}{\partial y\partial x}f(x,y)$?
QUESTION [6 upvotes]: I learned in my Calculus 3 class that $\frac{\partial}{\partial x}\left(\frac{\partial}{\partial y}f(x,y)\right) = \frac{\partial}{\partial y}\left(\frac{\partial}{\partial x}f(x,y)\right)$ Are there any counter examples to this?

REPLY [4 votes]: A classical example of a function not satisfying $f_{xy}=f_{yx}$ is $$f(x,y) = \left\{ \matrix{\frac{xy(y^2-x^2)}{x^2+y^2} & (x,y) \not = 0\\ 0 & (x,y) = (0,0)}\right.$$ At the point $(x,y) = (0,0)$ we have $f_{xy}(0,0) = 1$, but  $f_{yx}(0,0) = -1$.