Partial Derivatives

Published

Thu, Oct 9

In today’s lecture, we’re going to discuss partial derivatives and a couple of their applications.

What is a partial derivative?

A partial derivative tells you the rate of change of a function of several variables in one of the positively oriented cardinal directions. They’re a lot like the derivatives that you learn about for functions of one variable in Calc I.

Plain old ordinary derivatives

A derivative, as you probably know, measures the instantaneous rate of change of a function value with respect to its input variable. It is defined by the difference quotient: \[ f'(x) = \lim_{h\to0}\frac{f(x+h)-f(x)}{h}. \] The fraction that you see there is the difference quotient, which represents a good approximation to the slope of the function right at the point in question. The difference quotient also depends on the parameter \(h\); the smaller \(h\) is, the better the approximation. If we take the limit as \(h\to0\), we should get the exact slope. That’s the point!

This process is illustrated for the function \(f\left(x\right)=\sin\left(x\right)+x-\frac{x^{2}}{8}\) in Figure 1.

Figure 1: The 1D Difference Quotient

Of course, we don’t use the difference quotient to compute derivatives; we use the much more efficient differentiation rules. Thus, for the function at hand, we have \[ f'(x) = \cos(x) + 1 - \frac{1}{4}x. \] That’s where the exact slope of the tangent line in Figure 1 comes from.

Partial derivatives

Now, imagine that you’re sitting on a hillside whose elevation is described by the graph of a function \(z=f(x,y)\). There isn’t just one oriented direction anymore; rather, there are infinitely many. Later, you’ll talk about directional derivatives which really do measure the rate of change in any direction. The first step, though, is to consider what happens if you march in one of the two positively oriented cardinal directions - i.e. due North or due East.

This situation is illustrated as a contour plot for the hill \(f(x,y)=2-(x^2+y^2)/2\) in Figure 2.

Figure 2: The hill \(f(x,y)=2-(x^2+y^2)/2\)

We can also plot this same hill in 3D:

Partial derivatives conceptually

However you view it, these pictures motivate the concept of a partial derivative. A function \(f(x,y)\) that maps \(\mathbb R^2 \to \mathbb R\) can have two partial derivatives:

  • \(\displaystyle \frac{\partial f}{\partial x}\) or \(f_x(x,y)\) or just \(f_x\) denotes the partial derivative of \(f\) with respect to \(x\), which measures the rate of change of \(f\) in the positive \(x\) direction and
  • \(\displaystyle \frac{\partial f}{\partial y}\) or \(f_y(x,y)\) or just \(f_y\) denotes the partial derivative of \(f\) with respect to \(y\), which measures the rate of change of \(f\) in the positive \(y\) direction.

Figure 2 indicates that both \(f_x(1,1)\) and \(f_y(1,1)\) are both positive and have the same value, which looks to be about 1.

The definition of a partial derivative

Partial derivatives are defined using multi-variable difference quotients:

\[f_x(x,y) = \lim_{h\to0}\frac{f(x+h,y)-f(x,y)}{h}\] \[f_y(x,y) = \lim_{h\to0}\frac{f(x,y+h)-f(x,y)}{h}\]

The only difference between these two expressions is that the displacement (\(h\)) is applied to the \(x\)-coordinate for \(f_x\) and to the \(y\)-coordinate for \(f_y\).

Computing partial derivatives algebraically

Computing partial derivatives is fairly straightforward; you may have done it before! In a Calc I class, you might very well look at a function like \[ f(x) = \sin(\alpha \, x) \text{ and compute } f'(x) = \alpha\, \cos(\alpha\, x). \] The \(\alpha\) is a constant related to the frequency of the corresponding sine wave. Most importantly, \(\alpha\) is unspecified so it’s represented as a symbol. \[ f(x,y) = \sin(x\,y) \text{ and compute } f_x(x,y) = y\,\cos(x\,y). \] This works, because only \(x\) is affected by the \(h\). Put another way, \(y\) is constant when we move only in the \(x\)-direction.

Example

Let \(\displaystyle f(x,y) = x^2\,e^{x^2 + y^2}\)

\[ f_x(x,y) = 2 x \, e^{x^2+y^2} + x^2 \, e^{x^2+y^2}\,2x \] and \[ f_y(x,y) = 2 x^2 \, y \, e^{x^2+y^2}. \]

Estimating partial derivatives geometrically

In some applied situations, you might need to estimate partial derivatives from a contour diagram. Figure 3 shows the graph of an unknown function \(f\). Can you estimate \(f_x(1.54, 0.96)\), which is the point marked in the figure?

Unknown?? OK, the function is actually \(f(x,y)=x^2\,\sin(x+y^2)\), but that’s not the point.
Figure 3: A contour diagram for estimation

A couple extensions

We can extend the idea of a partial derivative of a bivariate function in a couple of ways.

Functions of more variables

There is no reason we cannot discuss functions of three or more variables. For example, \[ f(x,y,z) = (x^2 + 2y^2 + 3z^2)^2. \]

Then,

\[ \begin{aligned} \frac{\partial f}{\partial x} &= 2x \times 2(x^2 + 2y^2 + 3z^2) \\ \frac{\partial f}{\partial y} &= 4y \times 2(x^2 + 2y^2 + 3z^2) \\ \frac{\partial f}{\partial z} &= 6z \times 2(x^2 + 2y^2 + 3z^2). \end{aligned} \]

Second order derivatives

We can take higher order derivatives easily enough. A function of two variables has four second order partial derivatives. If \[ f(x,y) = x^2 y^3, \] Then, \[ \begin{aligned} \frac{\partial f}{\partial x} &= 2x y^3 \\ \frac{\partial f}{\partial y} &= 3x^2 y^2. \end{aligned} \] Thus, \[ \begin{aligned} \frac{\partial^2 f}{\partial x^2} &= 2 y^3 \\ \frac{\partial^2 f}{\partial y \partial x} &= 6x y^2 \\ \frac{\partial^2 f}{\partial x \partial y} &= 6x y^2 \\ \frac{\partial^2 f}{\partial y^2} &= 6x^2 y. \end{aligned} \]

You might notice, though, that the two middle terms are equal. This is a general fact called Clairaut’s Theorem.

Tangent planes

An important application in Calc I is the computation of a tangent line. In that context, we use the point slope formula \[ y = y_0 + m(x-x_0), \] where the point \(x_0\) is given, the value \(y_0=f(x_0)\), and the slope \(m=f'(x_0)\).

The corresponding problem in Calc III is to find the equation of a tangent plane: \[ z = z_0 + m_x(x-x_0) + m_y(y-y_0), \] where the slopes \(m_x\) and \(m_y\) in the \(x\) and \(y\) directions can be computed from the partial derivatives \(f_x\) and \(f_y\).

Example: Suppose that \(f(x,y) = 2-(x^2 + y^2/2)\). Find an equation of the plane that’s tangent the graph of \(f\) at the point \((1,2)\).

Solution: We have \[ f(x,y) = 2 - \left( x^2 + \frac{y^2}{2} \right) = 2 - x^2 - \frac{1}{2}y^2. \] Thus, \[ f_x(x,y) = -2x \text{ and } f_y(x,y) = -y. \] At \((1,2)\), we get \[ \begin{aligned} f(1,2) &= 2 - 1 - 2 = -1, \\ f_x(1,2) &= -2, \quad f_y(1,2) = -2. \end{aligned} \] Thus, our tangent plane is \[ \begin{aligned} z &= f(1,2) + f_x(1,2)(x - 1) + f_y(1,2)(y - 2) \\[6pt] &= -1 - 2(x - 1) - 2(y - 2) \\[6pt] &= 5 - 2x - 2y. \end{aligned} \]

An equation of the tangent plane is \[ z = 5 - 2x - 2y. \]

Optimization

Optimization is a fundamental application of calculus that is of tremendous importance. It’s possible that we’re getting slightly ahead of the game here, but if you see this more than once, that’s fine. We are only just starting the topic, too; there is much more to cover, including classification and constrained optimization.

Univariate optimization

In Calc I, you learn how to find maxima and minima of functions of a single variable. If you have a differentiable function \(f\) defined on \(\mathbb R\), the strategy is to solve the equation \(f'(x)=0\); these solutions are called critical points and they are candidates for where extremes might occur.

Once you have your critical points, it can be a bit tricky to determine which are maxima, which are minima, and which are neither. There’s a second derivative test that can help with this classification. The easiest thing to do, though, is to examine a graph, and that’s what we’ll do here.

Bivariate optimization

When studying the optimization of functions of two variables, both partial derivatives should be zero to obtain a critical point. That yields a system of equations to solve for the critical points. There’s again a second derivative test to help us classify the critical points, though we won’t get into that now. It’s generally pretty easy to tell what’s going on from a contour diagram.

Example 1

Let’s consider the function \(f(x,y) = x^2 - x y + 2 y^2 - 3 y\).

Judging from Figure 4, it appears there is a minimum value with small, positive coordinates.

Figure 4: A contour diagram for optimization

To find the minimum, we need to solve the system \[ \begin{aligned} \frac{\partial f}{\partial x} &= 2x - y = 0,\\ \frac{\partial f}{\partial y} &= -x + 4y - 3 = 0. \end{aligned} \]

Solving the first equation for \(y\) gives \(y = 2x\). Plugging this into the second, we get \[ -x + 4(2x) - 3 = 0 \quad\Longrightarrow\quad -x + 8x - 3 = 0 \quad\Longrightarrow\quad 7x - 3 = 0, \] so \(x = \dfrac{3}{7}\). Substituting back, we find \(y = 2x = \dfrac{6}{7}\).

Thus, the minimum value occurs at the critical point which is \[ \left(\frac{3}{7}, \frac{6}{7}\right). \]

Example 2

There can certainly be multiple critical points. Let’s illustrate that with \(f(x,y)=x^3 - 6xy - y^3\). We begin with a contour diagram:

Figure 5: A contour diagram for optimization

It certainly looks like there is a saddle point at the origin and a maximum in the second quadrant that is harder to pinpoint exactly.

To find these more precisely, we use the system

\[ \begin{aligned} \frac{\partial f}{\partial x} &= 3x^2 - 6y = 0 \\ \frac{\partial f}{\partial y} &= -6x - 3y^2 = 0. \end{aligned} \]

Solving for \(y\) in the first equation, we get \(y=x^2/2\). If we plug that into the second after dividing by \(-3\), we get \[ 2x + \left(\frac{x^2}{2}\right)^2 = 2x(1+x^3/8) = 0. \] Thus, \(x=0\) or \(x=-2\). You can plug those values back into either original equation to get the corresponding values of \(y=0\) and \(y=2\).