In single variable calculus we saw that the second derivative is often useful: in appropriate circumstances it measures acceleration; it can be used to identify maximum and minimum points; it tells us something about how sharply curved a graph is. Not surprisingly, second derivatives are also useful in the multi-variable case, but again not surprisingly, things are a bit more complicated.

It's easy to see where some complication is going to come from: with two variables there are four possible second derivatives. To take a "derivative,'' we must take a partial derivative with respect to $x$ or $y$, and there are four ways to do it: $x$ then $x$, $x$ then $y$, $y$ then $x$, $y$ then $y$.

Example 14.6.1 Compute all four second derivatives of $f(x,y)=x^2y^2$.

Using an obvious notation, we get: $$f_{xx}=2y^2\qquad f_{xy}=4xy\qquad f_{yx}=4xy\qquad f_{yy}=2x^2.$$ $\square$

You will have noticed that two of these are the same, the "mixed partials'' computed by taking partial derivatives with respect to both variables in the two possible orders. This is not an accident—as long as the function is reasonably nice, this will always be true.

Theorem 14.6.2 (Clairaut's Theorem) If the mixed partial derivatives are continuous, they are equal. $\qed$

Example 14.6.3 Compute the mixed partials of $\ds f=xy/(x^2+y^2)$. $$ f_x={y^3-x^2y\over(x^2+y^2)^2}\qquad f_{xy}=-{x^4-6x^2y^2+y^4\over (x^2+y^2)^3} $$ We leave $f_{yx}$ as an exercise. $\square$

## Exercises 14.6

To compute higher order derivatives in Sage, you can compute partial derivatives one at a time, or you can do multiple derivatives with a single command.

**Ex 14.6.1**
Find all first and second partial derivatives of
$\ds f=xy/(x^2+y^2)$.
(answer)

**Ex 14.6.2**
Find all first and second partial derivatives of
$x^3y^2+y^5$.
(answer)

**Ex 14.6.3**
Find all first and second partial derivatives of
$4x^3+xy^2+10$.
(answer)

**Ex 14.6.4**
Find all first and second partial derivatives of
$x\sin y$.
(answer)

**Ex 14.6.5**
Find all first and second partial derivatives of
$\sin(3x)\cos(2y)$.
(answer)

**Ex 14.6.6**
Find all first and second partial derivatives of
$e^{x+y^2}$.
(answer)

**Ex 14.6.7**
Find all first and second partial derivatives of
$\ln\sqrt{x^3+y^4}$.
(answer)

**Ex 14.6.8**
Find all first and second partial derivatives of
$z$ with respect to $x$ and $y$ if
$x^2+4y^2+16z^2-64=0$.
(answer)

**Ex 14.6.9**
Find all first and second partial derivatives of
$z$ with respect to $x$ and $y$ if
$xy+yz+xz=1$.
(answer)

**Ex 14.6.10**
Let $\alpha$ and $k$ be constants. Prove that the function
$u(x,t)=e^{-\alpha^2k^2t}\sin(kx)$
is a solution to the heat equation $u_t=\alpha^2u_{xx}$

**Ex 14.6.11**
Let $a$ be a constant. Prove that $u=\sin(x-at)+\ln(x+at)$ is
a solution to the wave equation $u_{tt}=a^2u_{xx}$.

**Ex 14.6.12**
How many third-order derivatives does a function of 2 variables
have? How many of these are distinct?

**Ex 14.6.13**
How many $n$th order derivatives does a function of 2 variables
have? How many of these are distinct?