\(\def\ans#1{\bbox[border:1px solid green,6pt]{#1}}\)

Partial Derivatives

Introduction

On to derivatives! You know that derivatives describe slope, and in two dimensions, this means the amount that a function rises or falls as we travel back and forth in the x direction. When we get to three dimensions, though, we have to worry about which direction we're traveling in.


Consider a roofer laying tiles, like in the picture above. We can talk about the slope of the roof, by which we mean how quickly he will rise as he walks toward the ridge of the roof. What if he walks parallel to the ridge, though? In that case, the slope is 0, which means that the slope depends on the direction of travel.

We'll start with the slope (derivative) when we travel in the direction of x and in the direction of y, and then in the next section, we'll discuss the derivative in an arbitrary direction.

Partial Derivatives

The partial derivative with respect to x is the slope when we travel in the direction of x (y is constant). This is written \[\dfrac{\partial f}{\partial x} \textrm{ or } f_x.\] Similarly, the partial derivative with respect to y is the slope when we travel in the direction of y. It is written \[\dfrac{\partial f}{\partial y} \textrm{ or } f_y.\]

Finding Partial Derivatives

To find the partial derivative with respect to one variable, treat the other variable as a constant.

Find \(f_x\) and \(f_y\) if \(f(x,y)=2x^3-x^2y+2y^2-3x\).

Solution

To find \(f_x\), treat \(y\) as a constant. The first term gets differentiated as usual, the second term becomes \(-2xy\), because \(x^2\) gets differentiated as \(2x\) and \(y\) comes along for the ride as constant multiples do. The third term doesn't contain any \(x\)'s, so its derivative with respect to \(x\) is 0. And of course, the derivative of the final term is \(-3\).

\[\begin{align} \dfrac{\partial f}{\partial x} = f_x &= \dfrac{\partial}{\partial x} (2x^3) - \dfrac{\partial}{\partial x} (x^2y) + \dfrac{\partial}{\partial x}(2y^2) - \dfrac{\partial}{\partial x}(3x)\\ &= \ans{6x^2-2xy-3} \end{align}\]

Similarly, for \(f_y\), hold \(x\) constant:

\[\begin{align} \dfrac{\partial f}{\partial y} = f_y &= \dfrac{\partial}{\partial y} (2x^3) - \dfrac{\partial}{\partial y} (x^2y) + \dfrac{\partial}{\partial y}(2y^2) - \dfrac{\partial}{\partial y}(3x)\\ &= \ans{-x^2+4y} \end{align}\]

Let \(f(x,y)=x^3y-4x+\cos y\).

  1. Compute \(f_x\) and \(f_y\).
  2. Evaluate both at \((-1,0)\).

Solution

  1. The partial derivatives: \[\ans{\begin{align} f_x &= 3x^2y-4\\ f_y &= x^3-\sin y \end{align}}\]
  2. Evaluate at \((-1,0)\): \[\ans{\begin{align} f_x(-1,0) &= -4\\ f_y(-1,0) &= -1 \end{align}}\]

    This means that if we travel along this surface in the x direction from this point, the slope is \(-4\), and if we travel in the y direction from this point, the slope is \(-1\).

Let \(f(x,y)=\sin (xy)\). Compute \(f_x\) and \(f_y\).

Solution

For both of these partial derivatives, we'll need to use the Chain Rule. For instance, when differentiating with respect to x, the derivative of the inner function is y, and vice versa.

\[\ans{\begin{align} f_x &= \cos (xy) \cdot y\\ f_y &= \cos (xy) \cdot x \end{align}}\]

Let \(f(x,y)=x^2 e^{xy}\). Compute \(f_x\) and \(f_y\).

Solution

In this example, we'll need to use the Product Rule when differentiating with respect to x.

\[\ans{\begin{align} f_x &= 2x e^{xy} + x^2y e^{xy}\\ f_y &= x^3 e^{xy} \end{align}}\]

Try it yourself:

(click on a problem to show/hide its answer)

  1. Find \(f_x\) and \(f_y\) if \(f(x,y)=3x^2+4y^3\).
  2. \[\begin{align}f_x &= 6x\\ f_y &= 12y^2\end{align}\]

  3. Find \(f_x\) and \(f_y\) if \(f(x,y)=y^8+2x^6+2xy\).
  4. \[\begin{align}f_x &= 12x^5+2y\\ f_y &= 8y^7+2x\end{align}\]

  5. Find \(f_x\) and \(f_y\) if \(f(x,y)=\ln\left(\dfrac{x}{y}\right)\).
  6. \[\begin{align}f_x &= \dfrac{1}{x}\\ f_y &= -\dfrac{1}{y}\end{align}\]

  7. Find \(f_x\) and \(f_y\) if \(f(x,y)=\cos(2xy)\).
  8. \[\begin{align}f_x &= -2y\sin(2xy)\\ f_y &= -2x\sin(2xy)\end{align}\]

  9. Find \(f_x\) and \(f_y\) if \(f(x,y)=e^{x^2 y}\).
  10. \[\begin{align}f_x &= 2xy e^{x^2y}\\ f_y &= x^2 e^{x^2 y}\end{align}\]

  11. Find \(f_x\) and \(f_y\) if \(f(x,y)=\dfrac{x}{x^2+y^2}\).
  12. \[\begin{align}f_x &= \dfrac{-x^2+y^2}{(x^2+y^2)^2}\\ f_y &= \dfrac{-2xy}{(x^2+y^2)^2}\end{align}\]

  13. Find \(f_x\) and \(f_y\) if \(f(x,y)=\sqrt{xy}\).
  14. \[\begin{align}f_x &= \dfrac{y}{2\sqrt{xy}}\\ f_y &= \dfrac{x}{2\sqrt{xy}}\end{align}\]

Find all three partial derivatives of \(f(x,y,z) = 3x^2y + 2xz + 4yz^2\).

Solution

\[\ans{\begin{align} f_x &= 6xy+2z\\ f_y &= 3x^2+4z^2\\ f_z &= 2x+8yz \end{align}}\]

Find all four partial derivatives of \(f(w,x,y,z) = \cos (w+x)\ \sin (y-z)\).

Solution

\[\ans{\begin{align} f_w &= -\sin (w+x)\ \sin (y-z)\\ f_x &= -\sin (w+x)\ \sin (y-z)\\ f_y &= \cos (w+x)\ \cos (y-z)\\ f_z &= -\cos (w+x)\ \cos (y-z) \end{align}}\]

Implicit Differentiation

Finding partial derivatives using implicit differentiation works much as you'd expect.

Find \(\dfrac{\partial z}{\partial x}\) if \(x^3+y^3+z^3+6xyz=1\).

Solution

Hold \(y\) constant and differentiate each term with respect to \(x\); for the terms with \(z\) in them, tack on a \(\dfrac{\partial z}{\partial x}\), and solve for that at the end.

\[\begin{align} x^3+y^3+z^3+6xyz &= 1\\ \dfrac{\partial }{\partial x} (x^3) + \dfrac{\partial }{\partial x} (y^3) + \dfrac{\partial }{\partial x} (z^3) + \dfrac{\partial }{\partial x} (6xyz) &= \dfrac{\partial }{\partial x} (1)\\ 3x^2 + 0 + 3z^2 \cdot \dfrac{\partial z}{\partial x} + \left[(6xy)\left(\dfrac{\partial z}{\partial x}\right)+z(6y)\right] &= 0\\ \ans{\dfrac{\partial z}{\partial x} = \dfrac{-3x^2-6yz}{6xy+3z^2}} \end{align}\]

Try it yourself:

(click on the problem to show/hide the answer)

Find \(\dfrac{\partial z}{\partial x}\) and \(\dfrac{\partial z}{\partial x}\) if \(x^2y+\cos(xy)-z^3=4\).
\[\begin{align}\dfrac{\partial z}{\partial x} &= \dfrac{2xy-y\sin(xy)}{3z^2}\\ \dfrac{\partial z}{\partial y} &= \dfrac{x^2-x\sin(xy)}{3z^2}\end{align}\]

Higher-Order Derivatives

Again, higher-order partial derivatives are not that complicated; simply differentiate the derivative with respect to the appropriate variable.

\[\begin{align} f_{xx} &= \dfrac{\partial }{\partial x} \left(\dfrac{\partial f}{\partial x}\right) = \dfrac{\partial^2 f}{\partial x^2}\\ f_{yy} &= \dfrac{\partial^2 f}{\partial y^2} \textrm{, etc.}\\ \\ f_{xy} &= \dfrac{\partial }{\partial y} \left(\dfrac{\partial f}{\partial x}\right) = \dfrac{\partial^2 f}{\partial x\ \partial y}\\ f_{yx} &= \dfrac{\partial^2 f}{\partial y\ \partial x} \end{align}\]

The order in the subscript tells us in what order to differentiate.

\(f(x,y) = 3x^4y-2xy+5xy^3\).

Solution

\[\begin{align} f_x &= 12x^3y - 2y +5y^3\\ f_y &= 3x^4-2x+15xy^2 \end{align}\]

Second-order:

\[\begin{align} f_{xx} &= 36x^2y\\ f_{yy} &= 30xy\\ f_{xy} &= 12x^3-2+15y^2\\ f_{yx} &= 12x^3-2+15y^2 \end{align}\]

Third-order:

\[\begin{align} f_{xxx} &= 72xy\\ f_{xxy} &= 36x^2\\ f_{xyx} &= 36x^2\\ f_{yyx} &= 30y\\ f_{xyy} &= 30y\\ f_{yxx} &= 36x^2\\ f_{yyy} &= 30x\\ f_{yxy} &= 30y \end{align}\]

Try it yourself:

(click on a problem to show/hide its answer)

  1. Find the four second derivatives of \(f(x,y) = x^3+xy^2+1\).
  2. \[\begin{align}f_{xx} &= 6x\\ f_{xy} &= 2y\\ f_{yy} &= 2x\\ f_{yx} &= 2y\end{align}\]

  3. Find the four second derivatives of \(f(x,y) = x^2y^3\).
  4. \[\begin{align}f_{xx} &= 2y^3\\ f_{xy} &= 6xy^2\\ f_{yy} &= 6x^2y\\ f_{yx} &= 6xy^2\end{align}\]

  5. Find the four second derivatives of \(f(x,y) = (x+3y)^2\).
  6. \[\begin{align}f_{xx} &= 2\\ f_{xy} &= 6\\ f_{yy} &= 18\\ f_{yx} &= 6\end{align}\]

  7. Find the four second derivatives of \(f(x,y) = \cos (xy)\).
  8. \[\begin{align}f_{xx} &= -y^2 \cos(xy)\\ f_{xy} &= -\sin(xy)-xy\cos(xy)\\ f_{yy} &= -x^2\cos(xy)\\ f_{yx} &= -\sin(xy)-xy\cos(xy)\end{align}\]

  9. Find the four second derivatives of \(f(x,y) = xe^y\).
  10. \[\begin{align}f_{xx} &= 0\\ f_{xy} &= e^y\\ f_{yy} &= xe^y\\ f_{yx} &= e^y\end{align}\]