existence of certain Second-order partial derivatives The function $f(x,y)=|y|$ is an example for the following conditions:

*

*$f$ is defined on the whole $\mathbb{R}^2$


*$\dfrac{\partial^2 f}{\partial x\,\partial x}$ and $\dfrac{\partial^2 f}{\partial x\,\partial y}$ do exist at any point $(x_0,y_0)\in\mathbb{R}^2$


*$\dfrac{\partial^2 f}{\partial y\,\partial x}$ and $\dfrac{\partial^2 f}{\partial y\,\partial y}$ don't exist at some point $(x_0,y_0)$

Now I would like to find an example for slightly changed conditions:

*

*$f$ is defined on the whole $\mathbb{R}^2$


*$\dfrac{\partial^2 f}{\partial x\,\partial x}$ and $\dfrac{\partial^2 f}{\partial y\,\partial x}$ do exist at any point $(x_0,y_0)\in\mathbb{R}^2$


*$\dfrac{\partial^2 f}{\partial y\,\partial y}$ and $\dfrac{\partial^2 f}{\partial x\,\partial y}$ don't exist at some point $(x_0,y_0)$
and I'm not able to do this. Is this possible?
 A: I tried to find a counterexample using the sine function which varies with increasing speed when it approaches $(0,0)$. As $(x,y) \rightarrow y^2 \sin(1/(x^2+y^2))$ turned out to be too simple, here is what I came up with:
Consider
$$ f: \mathbb{R}^2 \rightarrow \mathbb{R}, \quad
(x,y) \rightarrow \begin{cases} {y^2} \sin \left( \exp\left({1 \over x^2+y^2} + x \right)\right) = y^2 \sin( h(x,y) ), &(x,y) \neq (0,0) \\
0, &(x,y) = (0,0) \end{cases} $$
with $h(x,y) = \exp\left({1 \over x^2+y^2} + x \right)$.
The first partial derivatives of $f$
Outside of $(0, 0)$ one computes the derivatives
$$ \begin{align*}
f_x(x,y) 
&:= {\partial f \over \partial x} (x,y)
= y^2 \, h_x(x,y) \, \cos ( h(x,y)) \\
&= y^2 \cdot \left[ \left( -{2x \over (x^2+y^2)^2 }+ 1 \right) \exp\left({1 \over x^2+y^2} + x\right) \right] \cos\left(\exp\left({1 \over x^2+y^2} + x\right)\right) 
\end{align*}$$
and
$$ \begin{align*}
f_y(x,y) 
&:= {\partial f \over \partial y} (x,y)
= y^2 \, h_y(x,y) \cos(h(x,y)) + 2y \, \sin(h(x,y)) \\ 
&= y^2 \left[ -{2y \over (x^2+y^2)^2} \exp\left({1 \over x^2+y^2} + x\right) \right] \cos\left(\exp\left({1 \over x^2+y^2} + x\right)\right) \\
&\quad + 2y \, \sin\left(\exp\left({1 \over x^2+y^2} + x\right)\right)
\end{align*} $$
We have to analyze the behavior of $f$ in $(0,0)$ separately.

*

*For every $x \in \mathbb{R}$ it is $f(x, 0) = 0$. Therefore, on the x-axis $f_x(x,0)=0$ and in particular $f_x(0,0) = 0$. The derivative $f_x$ exists everywhere.

*For every $y \in \mathbb{R}$ it is $f(0,y) = y^2 \sin(h(0,y))$. Thus $-y^2 \leq f(0,y) \leq y^2$ and it can be seen from the limit of the difference quotient that $f$ is differentiable w.r.t. $y$ in $(0,0)$ with $f_y(0,0) = 0$. Thus the derivative w.r.t. y exists everywhere as well.

The second partial derivatives of $f$
Again outside of $(0,0)$ both $f_x$ and $f_y$ are differentiable along the x- and y-axis and the derivatives can be computed with the usual rules.
First, let's analyze $f_x$ in $(0,0)$.

*

*On the x-axis, $f_x$ is constantly zero. Therefore, the derivative ${\partial f_x \over \partial x}(0,0)$ exists and is zero.

*For every $y \in \mathbb{R}$ it is
$$f_x(0,y) = y^2 \, \exp \left({1 \over y^2}\right) \, \cos\left( \exp\left({1 \over y^2}\right)\right).$$
Thus
$${\partial f_x \over \partial y}(0,0) = \lim_{y \rightarrow 0} y \, \exp \left({1 \over y^2}\right) \, \cos\left( \exp\left({1 \over y^2}\right)\right).$$
But as $y$ tends to zero, $y \, \exp(1/y^2)$ tends to infinity and $\cos\left( \exp\left({1 / y^2}\right)\right)$ takes the value $1$ for arbitrarily small $y$. Therefore, the limit does not exist and neither does ${\partial f_x \over \partial y}(0,0)$.

Now, it remains to show that ${\partial f_y \over \partial x}(0,0)$ exists but ${\partial f_y \over \partial y}(0,0)$ does not.

*

*For every $x \in \mathbb{R}$ it is $f_y(x,0) = 0$. As above it follows that ${\partial f_y \over \partial x}(0,0) = 0$.

*For every $y \in \mathbb{R}$ we have
$$ \begin{align*}
f_y(0,y) 
&= y^2 \left[ -{2y \over y^4} \exp\left({1 \over y^2}\right) \right] \cos\left(\exp\left({1 \over y^2}\right)\right)
+ 2y \, \sin\left(\exp\left({1 \over y^2}\right)\right) \\
&= -{2 \over y} \, \exp\left({1 \over y^2}\right) \cos\left(\exp\left({1 \over y^2}\right)\right) + 2y \, \sin\left(\exp\left({1 \over y^2}\right)\right)
\end{align*} $$
With the same argumentation as above one shows that ${\partial f_y \over \partial y}(0,0)$ does not exist.

A: Looking again over the answer I gave yesterday, I realized that the function can be slightly simplified. As I might be mistaken, I add this as another answer instead of editing the old one.
Consider
$$ f: \mathbb{R}^2 \rightarrow \mathbb{R}, \quad
(x,y) \mapsto 
\begin{cases}
0 &\text{if }y=0, \\
y^2 \sin\left( \exp\left( {1 \over y} + x \right)\right) &\text{else}.
\end{cases} $$
The first derivatives outside of the x-axis
Outside of the x-axis one computes the derivatives
$$
f_x(x,y) = y^2 \, \exp\left( {1 \over y} + x \right) \, \cos\left( \exp\left( {1 \over y} + x \right)\right) 
$$
and
$$ \begin{align*}
f_y(x,y) 
&= y^2 \, \left[ - {1 \over y^2} \exp\left( {1 \over y} + x \right) \right] \cos\left( \exp\left( {1 \over y} + x \right)\right) \\
&\quad + 2y \sin\left( \exp\left( {1 \over y} + x \right)\right) \\
&= - \exp\left( {1 \over y} + x \right) \cos\left( \exp\left( {1 \over y} + x \right)\right) + 2y \sin\left( \exp\left( {1 \over y} + x \right)\right).
\end{align*} $$
The first derivatives on the $x$-axis
For every $x \in \mathbb{R}$ it is $f(x,0) = 0$. Therefore, the derivative of $f$ w.r.t. $x$ exists on the x-axis and is $f_x(x,0) = 0$ for every $x \in \mathbb{R}$.
For every $x \in \mathbb{R}$ it is
$$ f_y(x,0) = \lim_{y \rightarrow 0} {y^2 \sin\left( \exp\left( {1 \over y} + x \right)\right) \over y} = \lim_{y \rightarrow 0} y \sin\left( \exp\left( {1 \over y} + x \right)\right) = 0 $$
as the sine function is bounded. Hence, the derivative of $f$ w.r.t. $y$ exists on the $x$-axis as well.
The second derivatives of $f_x$
Outside of the $x$-axis the usual rules allow to compute the derivative of $f_x$ w.r.t. $x$ and $y$.
On the x-axis we have $f_x(x,0) = 0$ for every $x \in \mathbb{R}$. Thus, ${\partial f_x \over \partial x}(x,0)$ exists and is zero for every $x \in \mathbb{R}$.
The derivative of $f_x$ w.r.t. to $y$ in $(x,0)$ is defined as
$$ \begin{align*}
{\partial f_x \over \partial y}(x,0) 
&= \lim_{y \rightarrow 0} \; {y^2 \, \exp\left( {1 \over y} + x \right) \, \cos\left( \exp\left( {1 \over y} + x \right)\right) \over y} \\
&= \lim_{y \rightarrow 0} \; y \, \exp\left( {1 \over y} + x \right) \, \cos\left( \exp\left( {1 \over y} + x \right)\right).
\end{align*}
$$
This limit does not exist since for $y$ approaching $0$ from above $y \exp(1/y+x)$ tends to infinity and $\cos(\dots)$ assumes the value $1$ for arbitrary small $y$.
The second derivatives of $f_y$
Again, outside of the $x$-axis $f_y$ is differentiable with respect to both $x$ and $y$.
For every $x \in \mathbb{0}$ it is $f_y(x,0) = 0$ and it follows ${\partial f_y \over \partial y}(x,0) = 0$. In particular, the derivative of $f_y$ w.r.t. $x$ exists on the $x$-axis.
For fixed $x \in \mathbb{R}$ it can be seen easily that the function $y \mapsto f_y(x,y)$ is not even continuous in $0$. Therefore, the derivative ${\partial f_y \over \partial y}(x,0)$ does not exist for any $x \in \mathbb{R}$.
Summary
To summarize, we have seen that outside of the $x$-axis $f$ is twice differntiable w.r.t. $x$ and $y$. In every point $(x,0)$ on the $x$-axis we have the following derivatives:
\begin{array}{c || c | c }
\text{derivative w.r.t ...} & x &y \\
\hline
f & 0 & 0 \\
f_x & 0 & \text{does not exist} \\
f_y & 0 & \text{does not exist}
\end{array}
