Chapter 14. Partial derivatives
§14.1 [TEXT] The point of differentiation is linear approximation
In 18.01, when , you defined a derivative at each input , which you thought of as the slope of the tangent line at . Think . This slope roughly tells you, if you move a slight distance away from the input , this is how fast you expect to change. To drill the point home again, in 18.01, we had
See figure below.
The 18.01 derivative had type “scalar”. But for a two-variable function, that’s not enough. For concreteness, let’s take
as our example function (for which we have drawn level curves before), and consider some point , so that .
Then, what would a point “close” to mean? The point is close, but so is . For that matter, so is — that’s also a point at distance away! So having a single number isn’t enough to describe the rate of change anymore.
For a two-variable function, we would really want two numbers, in the sense that we want to fill in the blanks in the equation
The first blank corresponds to what happens if you imagine is held in place at , and we’re just changing the -value to . The second blank is similar. So we need a way to calculate these; the answer to our wish is what’s called a partial derivative.
§14.2 [TEXT] Computing partial derivatives is actually just 18.01
The good news about partial derivatives is that they’re actually really easy to calculate. You pretty much just need to do what you were taught in 18.01 with one variable changing while pretending the others are constants.
Here’s the definition:
Suppose is a two-variable function. Then the partial derivative with respect to , which we denote either or , is the result if we differentiate while treating as a variable and as a constant. The partial derivative is defined the same way.
Similarly, if is a three-variable function, we write for the derivative when and are fixed.
Each partial derivative has the same type signature as . That is:
- Given which accepts points in and outputs scalars.
- Then the partial derivative also accepts points in and outputs scalars.
But that’s a lot of words. I think this is actually better explained by example. In fact you could probably just read the examples and ignore the definition above.
Let .
Let’s compute . Again, pretend is a constant, so look at the function
If we differentiate with respect to , then becomes , and goes to (it doesn’t have any stuff in it). So
Similarly, let’s compute . This time we pretend is a constant, and look at
This time becomes , and has derivative . So
Let for a three-variable example. To compute , think of the function
where we pretend and are constants. Then the derivative is with respect to is just (just like how the derivative of is ). In other words,
For analogous reasons:
Let’s go back to
which we used in our earlier example as motivation, at the point .
Let’s fill in the numbers for the example we chose. By now, you should be able to compute that
Now, let’s zoom in on just the point . We know that
So our approximation equation can be written as
(10)
If you manually expand both sides, you can see this looks true. The two sides differ only by and , and the intuition is that if and were small numbers, then their squares will be negligibly small.
We’ll return to Equation 10 later when we introduce the gradient.
§14.3 [RECIPE] Computing partial derivatives
You probably can already figure out the recipe from the sections above, but let’s write it here just for completeness.
To compute the partial derivative of a function or or with respect to one of its input variables,
- Pretend all the other variables are constants, and focus on just the variable you’re taking the partial derivative to.
- Calculate the derivative of with respect to just that variable like in 18.01.
- Output the derivative you got.
This is easy, and only requires 18.01 material.
We just saw three examples where we computed the partials for , , and . Here are a bunch more examples that you can try to follow along:
Solution. The partial derivative with respect to is obtained by differentiating
Since we pretend and are constants, we just differentiate to get . The same thing happens with and . Hence
Solution. We differentiate with respect to first, where we view as the function
pretending that and are constants. This gives derivative . Similarly, and . So
Solution. If we view as a constant and as a variable, then
is differentiated by the “power rule” to get . However, if we view as constant and as a variable, then
ends up with derivative . (Remember, in this book denotes the natural log.) Hence
§14.4 [EXER] Exercises
Exercise 14.1. Compute all the partial derivatives of the following functions, defined for :
- .