Gradients – composition | MIT 18.02SC Multivariable Calculus, Fall 2010
Articles Blog

Gradients – composition | MIT 18.02SC Multivariable Calculus, Fall 2010

October 1, 2019


DAVID JORDAN: Hello, and
welcome back to recitation. So in this problem, we’re
considering a function f of three variables, f of x,
y, z, and it’s differentiable. And we’re not told
a formula for f. We just know that it’s
differentiable at this point P, which is 1, minus
1, 1, and we’re told that the gradient
of f at that point is this particular vector 2i
plus j minus 3k, at that point P. So all we understand
about f is how it looks around the point P. Now, we also have this
relation between the variables, so x, y and z aren’t unrelated. They’re related
by this constraint that z is x squared
plus y plus 1. So with this
information, we want to compute the gradient
of a new function g, and the new function g is a
function of two variables, and this function g is obtained
from f by just plugging in our relation for y. So we can use our
constraint to solve for y, and then this function g is just
f with that constraint applied. And what we really
want to do is we want to find the gradient
of g at the point (1, 1). So notice that when
g is equal to 1, 1, that means that–
sorry, when the input of g is 1, 1, that means the
input of f is P. OK? So why don’t you pause the video
and work this out for yourself. Check back with me and
we’ll work it out together. OK, welcome back. So let’s get started. So this problem may
not look like it’s a problem about partial
derivatives with constraints, but that’s what it’s really
going to boil down to, which is to say that when
we want to compute– so when we want to answer
this question by computing the gradient, the first thing
we’re going to want to do is compute the partial
derivative of g and its variable x. And from the way we
set up the problem, that’s just the
same as computing the partial derivative
of f with respect to x and keeping z constant. Now, remember, when we
do partial derivatives with constraints, what’s
important about the notation is what’s missing. The variable y is
missing, and that’s because we are going to use the
constraint to get rid of it, and that’s exactly
how we define g, so this is the key observation. So computing the
gradient of g is just going to be computing
these partial derivatives with constraints. So we’ll do that in a moment,
and I’ll also just write that the partial derivative
of g in the z-direction is partial f partial z,
now keeping x constrained. All right, so we need to compute
these partial derivatives with constraints. And so you remember
how this goes. The way that I
prefer to do this is to compute the
total differentials. So let’s compute over here. The total differential df
is– the total differential of f is just the partials
of f in the x-direction, f in the y-direction, f in the
z-direction, and each of these is multiplied by the
corresponding differential. And we don’t know f, so we can’t
compute the partial derivatives of it in general, but we do
know these partial derivatives at this point. And so in the problem,
we were given that this is 2dx plus dy minus 3dz. So this is just using the
fact that the gradient of f we were given is 2, 1 minus 3, OK? So that’s the total
differential of f, and now we have this constraint. And remember, when we do
these partial derivatives with constraints, the trick
is to take the differential of the constraint. So we had this equation z
equals x squared plus y plus 1, and what we need to do
is take its differential. So we have dz is 2x dx plus dy. So that’s our constraint. Now here we have
this variable x, but we’re not varying
x in this problem. We’re only focused on the point
P, and at the point P, x is 1. So, in fact, dz is
just 2dx plus dy, OK? So now what we need to do is we
need to combine the constraint equation and the
total differential for f into one
equation, and so this is just linear algebra now. So I’ll just come over here. So we can rewrite our total
differential for the constraint as saying that dy is
equal to dz minus 2dx, and then we can plug that back
into our total differential for f. And so we get that df
is equal to 2dx plus– now I plug in dy here–
so dz minus 2dx, and then finally, minus 3dz. So altogether, I
get a minus 2dz, because this and this cancel. OK. We get a minus 2dz. So what does that tell
us about the gradient? So remember that
the differential now of g and its variables
is partial g partial x dx plus partial g partial z dz. And remember, the trick
about partial derivatives and their relation to
total differentials is that the partial derivative
is just this coefficient. So the fact that we
computed df and we found that it was minus
2dz, that tells us that dg– so the thing
that we need to use is that g, remember, is just
the specialization of f. So dg is equal to
df in this case, because g is just a special
case of f with constraints. So when we computed
df here, we were imposing exactly the constraints
that we used to define dg, and so what this tells
us is that we can just compare the coefficients
here and so our gradient is 0, minus 2. So the 0 is because there
is no dependence anymore on x at this point. There wasn’t a dx term. There could have been
and there wasn’t. And the minus 2 is because
that’s the dependence on z. OK, so this is a
bit complicated, so why don’t we
review what we did. So going back over to
the problem statement, we first needed to
realize that saying that g was a special case of f where
we use our constraints to solve for y, that’s what put us
in the context of problems with constraints. So the fact that
the dependence on y was so simple that we could
just use the constraint. OK. So then, what that
allowed us to do is it allowed us to say that
the partial derivative of g in the x-direction is just
the partial derivative in the x-direction
subject to the constraint, and that’s what we did here. And so then, the next
steps that we did are the same steps
that we would always do to compute partial
derivatives with constraints, and so we finally got
a relationship that said that, subject
to these constraints, df is equal to minus 2dz. And the point is that
g is just the function f with those
constraints imposed, and so dg and df are the same,
and so, in particular, dg is minus 2dz. And then, we remember
that you can always read off partial derivatives
from the total differential. They’re just the coefficients. And so in the end, we got that
the gradient was 0 minus 2. And I think I’ll
leave it at that.

Leave a Reply

Your email address will not be published. Required fields are marked *