If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Second partial derivatives

A brief overview of second partial derivative, the symmetry of mixed partial derivatives, and higher order partial derivatives.

## Generalizing the second derivative

Consider a function with a two-dimensional input, such as
f, left parenthesis, x, comma, y, right parenthesis, equals, x, squared, y, cubed.
Its partial derivatives start fraction, \partial, f, divided by, \partial, x, end fraction and start fraction, \partial, f, divided by, \partial, y, end fraction take in that same two-dimensional input left parenthesis, x, comma, y, right parenthesis:
\begin{aligned} &\dfrac{\partial f}{\partial \blueE{x}} = \dfrac{\partial}{\partial \blueE{x}}(\blueE{x}^2 y^3) = 2\blueE{x} y^3 \\\\ &\dfrac{\partial f}{\partial \redE{y}} = \dfrac{\partial}{\partial \redE{y}}(x^2 \redE{y}^3) = 3x^2 \redE{y}^2 \end{aligned}
Therefore, we could also take the partial derivatives of the partial derivatives.
These are called second partial derivatives, and the notation is analogous to the start fraction, d, squared, f, divided by, d, x, squared, end fraction notation for the ordinary second derivative in single-variable calculus:
\begin{aligned} \dfrac{\partial}{\partial \blueE{x}} \left(\dfrac{\partial f}{\partial \blueE{x}} \right) &= \dfrac{\partial^2 f}{\partial \blueE{x}^2} \\\\ \dfrac{\partial}{\partial \blueE{x}} \left(\dfrac{\partial f}{\partial \redE{y}} \right) &= \dfrac{\partial^2 f}{\partial \blueE{x} \partial \redE{y}} \\\\ \dfrac{\partial}{\partial \redE{y}} \left(\dfrac{\partial f}{\partial \blueE{x}} \right) &= \dfrac{\partial^2 f}{\partial \redE{y} \partial \blueE{x}} \\\\ \dfrac{\partial}{\partial \redE{y}} \left(\dfrac{\partial f}{\partial \redE{y}} \right) &= \dfrac{\partial^2 f}{\partial \redE{y}^2} \end{aligned}
Using the f, start subscript, x, end subscript notation for the partial derivative (in this case with respect to x), you might also see these second partial derivatives written like this:
\begin{aligned} (f_\blueE{x})_\blueE{x} &= f_{\blueE{x}\blueE{x}} \\\\ (f_\redE{y})_\blueE{x} &= f_{\redE{y}\blueE{x}} \\\\ (f_\blueE{x})_\redE{y} &= f_{\blueE{x}\redE{y}} \\\\ (f_\redE{y})_\redE{y} &= f_{\redE{y}\redE{y}} \end{aligned}
The second partial derivatives which involve multiple distinct input variables, such as f, start subscript, start color #bc2612, y, end color #bc2612, start color #0c7f99, x, end color #0c7f99, end subscript and f, start subscript, start color #0c7f99, x, end color #0c7f99, start color #bc2612, y, end color #bc2612, end subscript, are called "mixed partial derivatives"

## Example 1: The full tree

Problem: Find all the second partial derivatives of f, left parenthesis, x, comma, y, right parenthesis, equals, sine, left parenthesis, x, right parenthesis, y, squared
Solution: First, find both partial derivatives:
\begin{aligned} \dfrac{\partial}{\partial \blueE{x}} (\sin(\blueE{x})y^2) &= \cos(\blueE{x})y^2 \\ \\ \dfrac{\partial}{\partial \redE{y}} (\sin(x)\redE{y}^2) &= 2\sin(x)\redE{y} \end{aligned}
Then for each one, write both partial derivatives:
\begin{aligned} \dfrac{\partial}{\partial \blueE{x}}\left( \dfrac{\partial}{\partial x}(\sin(x)y^2) \right) &= \dfrac{\partial}{\partial \blueE{x}}(\cos(\blueE{x})y^2) = -\sin(\blueE{x})y^2 \\\\ \dfrac{\partial}{\partial x}\left( \dfrac{\partial}{\partial y}(\sin(x)y^2) \right) &= \dfrac{\partial}{\partial \blueE{x}}(2\sin(\blueE{x})y) = 2\cos(\blueE{x})y \\\\ \dfrac{\partial}{\partial \redE{y}}\left( \dfrac{\partial}{\partial x}(\sin(x)y^2) \right) &= \dfrac{\partial}{\partial \redE{y}}(\cos(x)\redE{y}^2) = 2\cos(x)\redE{y} \\\\ \dfrac{\partial}{\partial \redE{y}}\left( \dfrac{\partial}{\partial y}(\sin(x)y^2) \right) &= \dfrac{\partial}{\partial \redE{y}}(2\sin(x)\redE{y}) = 2\sin(x) \end{aligned}
$\begin{array}{ccccccc} &\large\sin(x)y^2 \\\\ &\small\dfrac{\partial}{\partial x}\large\swarrow\quad\searrow\small\dfrac{\partial}{\partial y} \\\\ &\large\cos(x)y^2\qquad\qquad\qquad 2\sin(x)y \\\\ \small\dfrac{\partial}{\partial x}\large\swarrow&\large\searrow\small\dfrac{\partial}{\partial y}\qquad\qquad\qquad\dfrac{\partial}{\partial x}\large\swarrow&\large\searrow\small\dfrac{\partial}{\partial y} \\\\ \large\sin(x)y^2&\large\maroonD{\underbrace{\blueE{2\cos(x)y\qquad2\cos(x)y}}_{\text{Mixed partial derivatives are the same!}}}&\large2\sin(x) \end{array}$

## Symmetry of second derivatives

Notice, in the example above, the two mixed partial derivatives start fraction, \partial, squared, f, divided by, \partial, x, \partial, y, end fraction and start fraction, \partial, squared, f, divided by, \partial, y, \partial, x, end fraction are the same. This is not a coincidence; it happens for almost every function you encounter in practice. For example, look at what happens to a general polynomial term x, start superscript, n, end superscript, y, start superscript, k, end superscript:
\begin{aligned} \dfrac{\partial}{\partial \blueE{x}}\left( \dfrac{\partial}{\partial \redD{y}}(\blueE{x}^n \redD{y}^k) \right) &= \dfrac{\partial}{\partial \blueE{x}}(k \blueE{x}^n \redD{y}^{k-1}) = nk \blueE{x}^{n-1} \redD{y}^{k-1} \\\\ \dfrac{\partial}{\partial \redD{y}}\left( \dfrac{\partial}{\partial \blueE{x}}(\blueE{x}^n \redD{y}^k) \right) &= \dfrac{\partial}{\partial \redD{y}}(n \blueE{x}^{n-1} \redD{y}^k) = nk \blueE{x}^{n-1} \redD{y}^{k-1} \end{aligned}
Technically, the symmetry of second derivatives is not always true. There is a theorem, referred to variously as Schwarz's theorem or Clairaut's theorem, which states that symmetry of second derivatives will always hold at a point if the second partial derivatives are continuous around that point. To really get into the meat of this, we'd need some real analysis.
You should keep in the back of your mind that exceptions exist, but the symmetry of second derivatives work for just about every "normal" looking function that you will come across.

## Example 2: Higher order derivatives

Why stop at second partial derivatives? We could also take, say, five partial derivatives with respect to various input variables.
Problem: If f, left parenthesis, x, comma, y, comma, z, right parenthesis, equals, sine, left parenthesis, x, y, right parenthesis, e, start superscript, x, plus, z, end superscript, what is f, start subscript, z, y, z, y, x, end subscript?
Solution: The notation f, start subscript, z, y, z, y, x, end subscript is shorthand for left parenthesis, left parenthesis, left parenthesis, left parenthesis, f, start subscript, z, end subscript, right parenthesis, start subscript, y, end subscript, right parenthesis, start subscript, z, end subscript, right parenthesis, start subscript, y, end subscript, right parenthesis, start subscript, x, end subscript, so we differentiate with respect to z, then with respect to y, then z, then y, then x. That is, we read left to right.
It's worth pointing out that the order is different in the other notation:
\begin{aligned} \quad \dfrac{\partial}{\partial x} \dfrac{\partial}{\partial y} \dfrac{\partial}{\partial z} \dfrac{\partial}{\partial y} \dfrac{\partial f}{\partial z} = \dfrac{\partial^5 f}{ \underbrace{\partial x}_{5^{th}} \underbrace{\partial y}_{4^{th}} \underbrace{\partial z}_{3^{rd}} \underbrace{\partial y}_{2^{nd}} \underbrace{\partial z}_{1^{st}} } \end{aligned}
So the order of differentiation is indicated by the order of the terms in the denominator from right to left.
Anyway, back to the problem at hand. This is one of those tasks where you just have to roll up your sleeves and slog through it, but to help things let's color the variables start color #11accd, x, end color #11accd, comma, start color #e84d39, y, end color #e84d39, comma, start color #0d923f, z, end color #0d923f to keep track of where they all are:
\begin{aligned} \quad f(\blueD{x}, \redD{y}, \greenE{z}) &= \sin(\blueD{x}\redD{y})e^{\blueD{x} + \greenE{z}} \\\\ f_{\greenE{z}}(\blueD{x}, \redD{y}, \greenE{z}) &= \dfrac{\partial f}{\partial \greenE{z}} \left( \sin(\blueD{x}\redD{y})e^{\blueD{x} + \greenE{z}} \right) \\\\ &= \sin(\blueD{x}\redD{y})e^{\blueD{x} + \greenE{z}} \\\\ f_{\greenE{z}\redD{y}}(\blueD{x}, \redD{y}, \greenE{z}) &= \dfrac{\partial f}{\partial \redD{y}} \left( \sin(\blueD{x}\redD{y})e^{\blueD{x} + \greenE{z}} \right) \\\\ &= \cos(\blueD{x}\redD{y})\blueD{x}e^{\blueD{x} + \greenE{z}} \\\\ f_{\greenE{z}\redD{y}\greenE{z}}(\blueD{x}, \redD{y}, \greenE{z}) &= \dfrac{\partial f}{\partial \greenE{z}} \left( \cos(\blueD{x}\redD{y})\blueD{x}e^{\blueD{x} + \greenE{z}} \right) \\\\ &= \cos(\blueD{x}\redD{y})\blueD{x}e^{\blueD{x} + \greenE{z}} \\\\ f_{\greenE{z}\redD{y}\greenE{z}\redD{y}}(\blueD{x}, \redD{y}, \greenE{z}) &= \dfrac{\partial f}{\partial \redD{y}} \left( \cos(\blueD{x}\redD{y})\blueD{x}e^{\blueD{x} + \greenE{z}} \right) \\\\ &= -\sin(\blueD{x}\redD{y})\blueD{x}^2 e^{\blueD{x} + \greenE{z}} \\\\ f_{\greenE{z}\redD{y}\greenE{z}\redD{y}\blueD{x}}(\blueD{x}, \redD{y}, \greenE{z}) &= \dfrac{\partial f}{\partial \blueD{x}} \left( -\sin(\blueD{x}\redD{y})\blueD{x}^2 e^{\blueD{x} + \greenE{z}} \right) \\\\ &= \underbrace{-\cos(\blueD{x}\redD{y})\redD{y}}_{ \small\dfrac{\partial}{\partial x} (-\sin(\blueD{x}\redD{y})) }\blueD{x}^2 e^{\blueD{x} + \greenE{z}} \\\\ &\phantom{=}-\sin(\blueD{x}\redD{y}) \underbrace{2\blueD{x}}_{ \small\dfrac{\partial}{\partial x}\blueD{x}^2 }e^{\blueD{x} + \greenE{z}} \\\\ &\phantom{=}-\sin(\blueD{x}\redD{y})\blueD{x}^2 \underbrace{e^{\blueD{x} + \greenE{z}}}_{ \small\dfrac{\partial}{\partial x} e^{\blueD{x} + \greenE{z}} } \end{aligned}
This last step uses the extended product rule,
\begin{aligned} &\phantom{=} \dfrac{d}{dx}\Big(f(x)g(x)h(x)\Big) \\\\ &= f'(x)g(x)h(x) + f(x)g'(x)h(x) + f(x)g(x)h'(x) \end{aligned}
Man! That was a tedious example. But if you could follow all the way through, computing multiple partial derivatives should not be an issue for you. It's one of those things that just requires more bookkeeping than anything else.

## Want to join the conversation?

• In example 2 - step 4 (f_zyzy), why does e^(x+z) change to e^(x+y)?
• Typo in tree? f_xx = -sin(x).y^2
• f(x,y) = xy e^y , show that f_xy=fyx.
• f_x=(ye^y)1 and thus f_xy=(1e^y)+(ye^y)
f_y=x((1e^y)+(ye^y)) and thus f_yx= ((1e^y)+(ye^y))
Thus f_xy=f_yx
(1 vote)
• Why is e^x+z multiplied by x when we are taking a derivative with respect to y? Isn't x considered a constant and therefore the derivative of e^x+z be equal to e^x+z ?
• The x is coming from the derivative in respect to y of sin(xy) being cos(xy)x through the chain rule. It's confusing I know
(1 vote)
• sorry.... shouldn't the final solution include 2x, not x^2? Why did it change back to x^2?
• It does seem confusing but it's part of the power rule. The solution is a big equation
(-cos(xy)y(x^2)(e^x+z)) + (-sin(xy)2x(e^x+z)) + (-sin(xy)(x^2)(e^x+z))
(1 vote)
• f(x,y)=xy e^y , show that fxy=fyx.
(1 vote)
• I'm working through my old maths book.
It has a question on partial derivatives: If z=f(y/x) show that:
x^2(d^2z/dx^2) + 2xy(d^2z/dxdy) + Y^2(d^2z/dy^2) = 0
I found it to be true for any f(y/x), but I don't understand why this is?
(1 vote)
• What does x+X=2 mean?
(1 vote)
• What are some examples when you would take second partial derivatives with respect to different variables? I'm trying to get a hang of what that represents.