1 00:00:00,000 --> 00:00:09,980 DAVID JORDAN: Hello, and welcome back to recitation. 2 00:00:09,980 --> 00:00:14,110 So in this problem, we're considering a function f of 3 00:00:14,110 --> 00:00:20,910 three variables f of x, y, z, and it's differentiable, and 4 00:00:20,910 --> 00:00:22,820 we're not told a formula for f. 5 00:00:22,820 --> 00:00:26,010 We just know that it's differential at this point P, 6 00:00:26,010 --> 00:00:30,650 which is 1 minus 1, 1, and we're told that the gradient 7 00:00:30,650 --> 00:00:34,410 of f at that point is this particular vector 2i plus j 8 00:00:34,410 --> 00:00:39,170 minus 3k at that point P. So all we understand about f is 9 00:00:39,170 --> 00:00:42,960 how it looks around the point P. 10 00:00:42,960 --> 00:00:45,300 Now, we also have this relation between the 11 00:00:45,300 --> 00:00:48,280 variables, so x, y and z aren't unrelated. 12 00:00:48,280 --> 00:00:51,460 They're related by this constraint that z is x squared 13 00:00:51,460 --> 00:00:53,750 plus y plus 1. 14 00:00:53,750 --> 00:00:57,640 So with this information, we want to compute the gradient 15 00:00:57,640 --> 00:01:01,520 of a new function g, and the new function g is a function 16 00:01:01,520 --> 00:01:06,590 of two variables, and this function g is obtained from f 17 00:01:06,590 --> 00:01:09,590 by just plugging in our relation for y. 18 00:01:09,590 --> 00:01:14,380 So we can use our constraint to solve for y, and then this 19 00:01:14,380 --> 00:01:19,730 function g is just f with that constraint applied. 20 00:01:19,730 --> 00:01:21,690 And what we really want to do is we want to find the 21 00:01:21,690 --> 00:01:27,750 gradient of g at the point 1, 1. 22 00:01:27,750 --> 00:01:33,410 So notice that when g is equal to 1, 1, that means that-- 23 00:01:33,410 --> 00:01:37,070 sorry, when the input of g is 1, 1, that means the input of 24 00:01:37,070 --> 00:01:40,350 f is P. OK? 25 00:01:40,350 --> 00:01:42,680 So why don't you pause the video and work 26 00:01:42,680 --> 00:01:44,150 this out for yourself. 27 00:01:44,150 --> 00:01:45,920 Check back with me and we'll work it out together. 28 00:01:45,920 --> 00:01:54,000 29 00:01:54,000 --> 00:01:54,670 OK, welcome back. 30 00:01:54,670 --> 00:01:55,920 So let's get started. 31 00:01:55,920 --> 00:01:59,590 32 00:01:59,590 --> 00:02:04,840 So this problem may not look like it's a problem about 33 00:02:04,840 --> 00:02:07,410 partial derivatives with constraints, but that's what 34 00:02:07,410 --> 00:02:11,370 it's really going to boil down to, which is to say that when 35 00:02:11,370 --> 00:02:12,620 we want to compute-- 36 00:02:12,620 --> 00:02:18,500 37 00:02:18,500 --> 00:02:20,800 so when we want to answer this question by computing the 38 00:02:20,800 --> 00:02:22,870 gradient, the first thing we're going to want to do is 39 00:02:22,870 --> 00:02:26,180 compute the partial derivative of g and its variable x. 40 00:02:26,180 --> 00:02:29,760 And from the way we set up the problem, that's just the same 41 00:02:29,760 --> 00:02:39,120 as computing the partial derivative of f with respect 42 00:02:39,120 --> 00:02:44,810 to x and keeping z constant. 43 00:02:44,810 --> 00:02:46,560 Now, remember, when we do partial derivatives with 44 00:02:46,560 --> 00:02:48,800 constraints, what's important about the 45 00:02:48,800 --> 00:02:49,950 notation is what's missing. 46 00:02:49,950 --> 00:02:53,110 The variable y is missing, and that's because we are going to 47 00:02:53,110 --> 00:02:56,430 use the constraint to get rid of it, and that's exactly how 48 00:02:56,430 --> 00:03:00,710 we define g, so this is the key observation. 49 00:03:00,710 --> 00:03:04,100 So computing the gradient of g is just going to be computing 50 00:03:04,100 --> 00:03:06,095 these partial derivatives with constraints. 51 00:03:06,095 --> 00:03:09,080 52 00:03:09,080 --> 00:03:16,320 So we'll do that in a moment, and I'll also just write that 53 00:03:16,320 --> 00:03:21,080 the partial derivative of g in the z-direction is partial f 54 00:03:21,080 --> 00:03:26,970 partial z, now keeping x constrained. 55 00:03:26,970 --> 00:03:30,900 All right, so we need to compute these partial 56 00:03:30,900 --> 00:03:32,150 derivatives with constraints. 57 00:03:32,150 --> 00:03:34,820 58 00:03:34,820 --> 00:03:37,560 And so you remember how this goes. 59 00:03:37,560 --> 00:03:39,680 The way that I prefer to do this is to compute the total 60 00:03:39,680 --> 00:03:40,310 differentials. 61 00:03:40,310 --> 00:03:44,405 So let's compute over here. 62 00:03:44,405 --> 00:03:49,070 63 00:03:49,070 --> 00:03:51,860 The total differential df is-- 64 00:03:51,860 --> 00:04:02,052 65 00:04:02,052 --> 00:04:05,600 the total differential of f is just the partials of f in the 66 00:04:05,600 --> 00:04:07,810 x-direction, f in the y-direction, f in the 67 00:04:07,810 --> 00:04:10,410 z-direction, and each of these is multiplied by the 68 00:04:10,410 --> 00:04:13,690 corresponding differential. 69 00:04:13,690 --> 00:04:15,890 And we don't know f, so we can't compute the partial 70 00:04:15,890 --> 00:04:19,010 derivatives of it in general, but we do know these partial 71 00:04:19,010 --> 00:04:20,700 derivatives at this point. 72 00:04:20,700 --> 00:04:26,780 And so in the problem, we were given that this is 2dx 73 00:04:26,780 --> 00:04:33,590 plus dy minus 3dz. 74 00:04:33,590 --> 00:04:41,020 So this is just using the fact that the gradient of f we were 75 00:04:41,020 --> 00:04:49,410 given is 2, 1 minus 3, OK? 76 00:04:49,410 --> 00:04:51,530 So that's the total differential of f, and now we 77 00:04:51,530 --> 00:04:52,115 have this constraint. 78 00:04:52,115 --> 00:04:54,730 And remember, when we do these partial derivatives with 79 00:04:54,730 --> 00:04:57,180 constraints, the trick is to take the differential of the 80 00:04:57,180 --> 00:04:58,330 constraint. 81 00:04:58,330 --> 00:05:04,430 So we had this equation z equals x squared plus y plus 82 00:05:04,430 --> 00:05:07,730 1, and what we need to do is take its differential. 83 00:05:07,730 --> 00:05:17,320 So we have dz is 2x dx plus dy. 84 00:05:17,320 --> 00:05:20,440 So that's our constraint. 85 00:05:20,440 --> 00:05:23,780 Now here we have this variable x, but we're not varying x in 86 00:05:23,780 --> 00:05:24,150 this problem. 87 00:05:24,150 --> 00:05:26,570 We're only focused on the point P, and at the 88 00:05:26,570 --> 00:05:28,430 point P, x is 1. 89 00:05:28,430 --> 00:05:39,630 So, in fact, dz is just 2dx plus dy, OK? 90 00:05:39,630 --> 00:05:46,290 So now what we need to do is we need to combine the 91 00:05:46,290 --> 00:05:54,770 constraint equation and the total differential for f into 92 00:05:54,770 --> 00:05:58,320 one equation, and so this is just linear algebra now. 93 00:05:58,320 --> 00:05:59,840 So I'll just come over here. 94 00:05:59,840 --> 00:06:02,580 95 00:06:02,580 --> 00:06:11,580 So we can rewrite our total differential for the 96 00:06:11,580 --> 00:06:24,160 constraint as saying that dy is equal to dz minus 2dx, and 97 00:06:24,160 --> 00:06:25,900 then we can plug that back into our total 98 00:06:25,900 --> 00:06:27,480 differential for f. 99 00:06:27,480 --> 00:06:35,470 And so we get that df is equal to 2dx plus-- 100 00:06:35,470 --> 00:06:37,980 now I plug in dy here-- 101 00:06:37,980 --> 00:06:46,286 so dz minus 2dx, and then finally, minus 3dz. 102 00:06:46,286 --> 00:06:51,560 So altogether, I get a minus 2dz, because 103 00:06:51,560 --> 00:06:52,712 this and this cancel. 104 00:06:52,712 --> 00:06:55,080 OK. 105 00:06:55,080 --> 00:06:58,920 We get a minus 2dz. 106 00:06:58,920 --> 00:07:04,170 So what does that tell us about the gradient? 107 00:07:04,170 --> 00:07:09,570 So remember that the differential now of g and its 108 00:07:09,570 --> 00:07:20,700 variables is partial g partial x dx plus 109 00:07:20,700 --> 00:07:26,490 partial g partial z dz. 110 00:07:26,490 --> 00:07:29,120 And remember, the trick about partial derivatives and their 111 00:07:29,120 --> 00:07:30,850 relation to total differentials is that the 112 00:07:30,850 --> 00:07:33,080 partial derivative is just this coefficient. 113 00:07:33,080 --> 00:07:36,110 114 00:07:36,110 --> 00:07:39,920 So the fact that we computed df and we found that it was 115 00:07:39,920 --> 00:07:48,010 minus 2dz, that tells us that dg-- 116 00:07:48,010 --> 00:07:52,180 117 00:07:52,180 --> 00:07:55,510 so the thing that we need to use is that g, remember, is 118 00:07:55,510 --> 00:07:57,720 just the specialization of f. 119 00:07:57,720 --> 00:08:03,170 So dg is equal to df in this case, because g is just a 120 00:08:03,170 --> 00:08:05,620 special case of f with constraints. 121 00:08:05,620 --> 00:08:08,940 So when we computed df here, we were imposing exactly the 122 00:08:08,940 --> 00:08:12,380 constraints that we used to define dg, and so what this 123 00:08:12,380 --> 00:08:17,810 tells us is that we can just compare the coefficients here 124 00:08:17,810 --> 00:08:27,110 and so our gradient is 0 minus 2. 125 00:08:27,110 --> 00:08:30,800 So the 0 is because there is no dependence anymore on x at 126 00:08:30,800 --> 00:08:31,740 this point. 127 00:08:31,740 --> 00:08:33,190 There wasn't a dx term. 128 00:08:33,190 --> 00:08:34,710 There could have been and there wasn't. 129 00:08:34,710 --> 00:08:39,370 And the minus 2 is because that's the dependence on z. 130 00:08:39,370 --> 00:08:41,850 OK, so this is a bit complicated, so why don't we 131 00:08:41,850 --> 00:08:43,210 review what we did. 132 00:08:43,210 --> 00:08:50,750 So going back over to the problem statement, we first 133 00:08:50,750 --> 00:08:59,820 needed to realize that saying that g was a special case of f 134 00:08:59,820 --> 00:09:05,680 where we use our constraints to solve for y, that's what 135 00:09:05,680 --> 00:09:09,650 put us in the context of problems with constraints. 136 00:09:09,650 --> 00:09:14,750 So the fact that the dependence on y was so simple 137 00:09:14,750 --> 00:09:15,837 that we could just use the constraint. 138 00:09:15,837 --> 00:09:17,087 OK. 139 00:09:17,087 --> 00:09:19,970 140 00:09:19,970 --> 00:09:22,750 So then, what that allowed us to do is it allowed us to say 141 00:09:22,750 --> 00:09:26,270 that the partial derivative of g in the x-direction is just 142 00:09:26,270 --> 00:09:30,190 the partial derivative in the x-direction subject to the 143 00:09:30,190 --> 00:09:33,650 constraint, and that's what we did here. 144 00:09:33,650 --> 00:09:37,790 And so then, the next steps that we did are the same steps 145 00:09:37,790 --> 00:09:39,880 that we would always do to compute partial derivatives 146 00:09:39,880 --> 00:09:48,380 with constraints, and so we finally got a relationship 147 00:09:48,380 --> 00:09:52,730 that said that, subject to these constraints, df is equal 148 00:09:52,730 --> 00:09:54,890 to minus 2dz. 149 00:09:54,890 --> 00:09:58,460 And the point is that g is just the function f with those 150 00:09:58,460 --> 00:10:04,400 constraints imposed, and so dg and df are the same, and so, 151 00:10:04,400 --> 00:10:07,360 in particular, dg is minus 2dz. 152 00:10:07,360 --> 00:10:11,200 And then, we remember that you can always read off partial 153 00:10:11,200 --> 00:10:12,670 derivatives from the total differential. 154 00:10:12,670 --> 00:10:14,140 They're just the coefficients. 155 00:10:14,140 --> 00:10:18,545 And so in the end, we got that the gradient was 0 minus 2. 156 00:10:18,545 --> 00:10:21,010 And I think I'll leave it at that. 157 00:10:21,010 --> 00:10:21,288