We saw for $z=f(x,y)$ that its partial derivatives $f_x(x,y)$ and $f_y(x,y)$ are functions of $x$ and $y$. Therefore we can consider their partial derivatives $(f_x)_x(x,y)$, $(f_x)_y(x,y)$, $(f_y)_x(x,y)$, and $(f_y)_y(x,y)$. These partial derivatives are called the second partial derivatives of $f$.

• Note that $\frac{\partial^2 f}{\partial y\partial x}$ means we first differentiate with respect to $x$ and then with respect to $y$, while for $\frac{\partial^2 f}{\partial x\partial y}$ we first differentiate with respect to $y$ and then with respect to $x$.

#### Read more on common notations and higher than two partial derivaitves

• Common notations for the second partial derivatives of $z=f(x,y)$ are:
\begin{align*}
&(f_x)_x=f_{xx}=f_{11}=D_{11}f=\partial_{xx}f=\partial_{xx}z=\frac{\partial}{\partial x}\left(\frac{\partial f}{\partial x}\right)=\frac{\partial^2 f}{\partial x^2}=\frac{\partial^2 z}{\partial x^2}\\
&(f_x)_y=f_{xy}=f_{12}=D_{12}f=\partial_{xy}f=\partial_{xy}z=\frac{\partial}{\partial y}\left(\frac{\partial f}{\partial x}\right)=\frac{\partial^2 f}{\partial y \partial x}=\frac{\partial^2 z}{\partial y\partial x}\\
&(f_y)_x=f_{yx}=f_{21}=D_{21}f=\partial_{yx}f=\partial_{yx}z=\frac{\partial}{\partial x}\left(\frac{\partial f}{\partial y}\right)=\frac{\partial^2 f}{\partial x \partial y}=\frac{\partial^2 z}{\partial x\partial y}\\
&(f_y)_y=f_{yy}=f_{22}=D_{22}f=\partial_{yy}f=\partial_{yy}z=\frac{\partial}{\partial y}\left(\frac{\partial f}{\partial y}\right)=\frac{\partial^2 f}{\partial y^2}=\frac{\partial^2 z}{\partial y^2}\\
\end{align*}

•  If $u=g(x,y,z)$, then the second partial derivatives of $g$ are:
$$g_{xx},\ g_{xy},\ g_{xz},\ g_{yx},\ g_{yy},\ g_{yz},\ g_{zx},\ g_{zy},\ g_{zz}$$

•  If $z=f(x,y)$, in a similar way, we can form its third partial derivatives:
\begin{align*}
&f_{xxx}=\frac{\partial^3 f}{\partial x^3},\ f_{xxy}=\frac{\partial^3 f}{\partial y\partial x^2},\ f_{xyx}=\frac{\partial^3 f}{\partial x\partial y\partial x},\ f_{xyy}=\frac{\partial^3 f}{\partial y^2 \partial x},\\
&f_{yxx}=\frac{\partial^3 f}{\partial x^2 \partial y},\ f_{yxy}=\frac{\partial f}{\partial y\partial x \partial y},\ f_{yyx}=\frac{\partial^3 f}{\partial x\partial y^2},\ f_{yyy}=\frac{\partial^3 f}{\partial y^3}
\end{align*}

• In general, the $n$-th partial derivatives of $y=f(x,y)$ are given by:
\begin{align*}
\frac{\partial}{\partial x}\left(\frac{\partial^{n-1} f}{\partial x^{n-1} f}\right)&=\frac{\partial^n f}{\partial x^n}=f_{\underbrace{xx\cdots x}_{n \text{ times}}}\\
\frac{\partial}{\partial y}\left(\frac{\partial^{n-1} f}{\partial x^{n-1} f}\right)&=\frac{\partial^n f}{\partial y \partial x^{n-1}}=f_{\underbrace{x\cdots x}_{(n-1) \text{ times}}y}\\
&\vdots
\end{align*}

• Note that we differentiate in the order of the symbols $\partial x$ and $\partial y$ in the denominator from right to left. For example, $f_{xxyyx}=\frac{\partial^5 f}{\partial x\partial y^2\partial x^2}$ means
$$f_{xxyyx}=\frac{\partial^5 f}{\partial x\partial y^2\partial x^2}=\frac{\partial}{\partial x}\left(\frac{\partial}{\partial y}\left(\frac{\partial}{\partial y}\left(\frac{\partial}{\partial x}\left(\frac{\partial f}{\partial x}\right)\right)\right)\right)$$
However we will learn that the order we carry out differentiations does not matter in  almost all cases.

Example 1
If $f(x,y)=x^2y^3$, find its second partial derivatives
Solution
$$\frac{\partial f}{\partial x}=2xy^3\Rightarrow \frac{\partial^2 f}{\partial x^2}=2y^3,\quad \frac{\partial^2 f}{\partial y \partial x}=6xy^2,$$
$$\frac{\partial f}{\partial y}=3x^2y^2\Rightarrow \frac{\partial^2 f}{\partial x \partial y}=6 x y^2,\quad \frac{\partial^2 f}{\partial y^2}=6x^2y.$$
As we can see $\frac{\partial^2 f}{\partial x \partial y}=\frac{\partial^2 f}{\partial y \partial x}$.
Example 2
Find $f_{xxz}$, $f_{xzx}$ and $f_{zxx}$ if $f(x,y,z)=\cos x\ e^{y-2z}$.
Solution
\begin{align*}
f_{xxz}&=\frac{\partial}{\partial z}\frac{\partial}{\partial x}\frac{\partial}{\partial x}\left(\cos x\ e^{y-2z}\right)\\
&=\frac{\partial}{\partial z}\frac{\partial}{\partial x}\left(-\sin x\ e^{y-2z}\right)\\
&=\frac{\partial}{\partial z}\left(-\cos x\ e^{y-2z}\right)\\
&=2\cos x\ e^{y-2z}
\end{align*}
\begin{align*}
f_{xzx}&=\frac{\partial}{\partial x}\frac{\partial}{\partial z}\frac{\partial}{\partial x}\left(\cos x\ e^{y-2z}\right)\\
&=\frac{\partial}{\partial x}\frac{\partial}{\partial z}\left(-\sin x\ e^{y-2z}\right)\\
&=\frac{\partial}{\partial x}\left(2\sin x\ e^{y-2z}\right)\\
&=2\cos x\ e^{y-2z}
\end{align*}
\begin{align*}
f_{zxx}&=\frac{\partial}{\partial x}\frac{\partial}{\partial x}\frac{\partial}{\partial z}\left(\cos x\ e^{y-2z}\right)\\
&=\frac{\partial}{\partial x}\frac{\partial}{\partial x}\left(-2\cos x\ e^{y-2z}\right)\\
&=\frac{\partial}{\partial x}\left(2\sin x\ e^{y-2z}\right)\\
&=2\cos x\ e^{y-2z}
\end{align*}

As we can see:
$$\frac{\partial^3 f}{\partial z \partial x^2}=\frac{\partial^3 f}{\partial x\partial z \partial x}=\frac{\partial^3 f}{\partial x^2\partial z}$$

The equality of $f_{xy}$ and $f_{yx}$ in Example 1, and equality of $f_{xxz}$, $f_{xzx}$ and $f_{zxx}$ in Example 2 are not coincidence:

Theorem 1 (Symmetry of Second Derivatives): If the mixed partial derivatives $\frac{\partial^2 f}{\partial x \partial y}$ and $\frac{\partial^2 f}{\partial y \partial x}$ of a function $f(x,y)$ are continuous on an open set $U$, then for every $(x,y)\in U$:
$$\frac{\partial^2 f}{\partial x \partial y}(x,y)=\frac{\partial^2 f}{\partial y \partial x}(x,y)$$

The above theorem leads to this result that for any number of differentiations or variables involved the order of differentiation is immaterial provided the assumption of the continuity of the functions holds true.

#### Read more on equality of mixed partial derivatives

For example, for $z=f(x,y)$ we know:
$$\frac{\partial}{\partial y}\left(\frac{\partial}{\partial x}f\right)=\frac{\partial}{\partial x}\left(\frac{\partial}{\partial y}f\right)$$
If we replace $f$ by $f_x=\frac{\partial f}{\partial x}$, we will obtain
$$\frac{\partial}{\partial y}\left(\frac{\partial}{\partial x}f_x\right)=\frac{\partial}{\partial x}\left(\frac{\partial}{\partial y}f_x\right)\quad \text{or}\quad \frac{\partial}{\partial y}\left(\frac{\partial}{\partial x}\left(\frac{\partial}{\partial x}f\right)\right)=\frac{\partial}{\partial x}\left(\frac{\partial}{\partial y}\left(\frac{\partial}{\partial x}f\right)\right)$$
and by interchanging the order of two differentiations:
$$\frac{\partial}{\partial x}\left(\frac{\partial}{\partial {\color{red}y}}\left(\frac{\partial}{\partial {\color{red}x}}f\right)\right)=\frac{\partial}{\partial x}\left(\frac{\partial}{\partial {\color{red} x}}\left(\frac{\partial}{\partial {\color{red} y}}f\right)\right).$$
So we can conclude:
$$\frac{\partial^3 f}{\partial y \partial x^2}=\frac{\partial^3 f}{\partial x \partial y \partial x}=\frac{\partial^3 f}{\partial x^2 \partial y}.$$

• If the assumption of continuity of the partial derivatives is not satisfied, the symmetry of partial derivatives may be broken. The following is an example of non-symmetry situation.

Example 3
Find $f_{xy}(0,0)$ and $f_{yx}(0,0)$ if $f(x,y)$ is given by:
$$f(x,y)=\begin{cases} \dfrac{xy(x^2-y^2)}{x^2+y^2} & (x,y)\neq(0,0)\\ \\ 0 & (x,y)=(0,0) \end{cases}$$
Solution
Note that $f(x,y)$ is continuous everywhere (see Fig. 1(a)). The continuity of $f$ at $(0,0)$ can be shown, for example, by using polar coordinates.

To calculate $f_{xy}(0,0)$ and $f_{yx}(0,0)$, we need to use the definition
\begin{align*}
f_{xy}(0,0)=\frac{\partial f_x}{\partial y}(0,0)=\lim_{k\rightarrow 0}\frac{f_x(0,0+k)-f_x(0,0)}{k}\\
f_{yx}(0,0)=\frac{\partial f_y}{\partial x}(0,0)=\lim_{h\rightarrow 0}\frac{f_y(0+h,0)-f_y(0,0)}{k}
\end{align*}
So we need to know $f_x(0,y)$ and $f_y(x,0)$:
\begin{align*}
f_x(0,y)&=\lim_{h\rightarrow 0}\frac{f(h,y)-f(0,y)}{h}\\
&=\lim_{h\rightarrow 0}\frac{hy\frac{h^2-y^2}{h^2+y^2}-0}{h} \\
&=\lim_{h\rightarrow 0}y \frac{h^2-y^2}{h^2+y^2}=-y,
\end{align*}

\begin{align*}
f_y(x,0)&=\lim_{k\rightarrow 0}\frac{f(x,k)-f(x,0)}{k}\\
&=\lim_{k\rightarrow 0}\frac{xk\frac{x^2-k^2}{x^2+k^2}-0}{k} \\
&=\lim_{k\rightarrow 0}x\frac{x^2-k^2}{x^2+k^2}=x.
\end{align*}
As special cases, it is easy to show that $f_x(0,0)=0$ and $f_y(0,0)=0$.  It can be shown that $f_x$ and $f_y$ are continuous functions everywhere (see Fig. 1(b) and (c)). Now we are ready to calculate $f_{xy}(0,0)$ and $f_{yx}(0,0)$:
\begin{align*}
f_{xy}(0,0)=&\frac{\partial f_x}{\partial y}(0,0)=\lim_{k\rightarrow 0}\frac{f_x(0,k)-f_x(0,0)}{k}\\
=&\lim_{k\rightarrow 0}\frac{-k-0}{k}=-1\\
f_{yx}(0,0)=&\frac{\partial f_y}{\partial x}(0,0)=\lim_{h\rightarrow 0}\frac{f_y(h,0)-f_y(0,0)}{k}\\
=&\lim_{h\rightarrow 0}\frac{h-0}{h}=1.
\end{align*}
So $f_{xy}(0,0)\neq f_{yx}(0,0)$ which is caused by the discontinuity of $f_{xy}$ at $(0,0)$. At every other point, $f_{xy}(x,y)=f_{yx}(x,y)$. Functions $f_{xy}$ and $f_{yx}$ are graphed in Fig. 1(d))

 (a) Graph of $f(x,y)$ (b) Graph of $f_x(x,y)$ (c) Graph of $f_y(x,y)$ (d) Graph of $f_{xy}(x,y)$ or $f_{yx}(x,y)$ when $(x,y)\neq (0,0)$

Figure 1