1 00:00:00,000 --> 00:00:07,800 JOEL LEWIS: Hi. 2 00:00:07,800 --> 00:00:09,390 Welcome back to recitation. 3 00:00:09,390 --> 00:00:11,320 In lecture, you've been learning about how 4 00:00:11,320 --> 00:00:14,080 to solve multivariable optimization problems using 5 00:00:14,080 --> 00:00:15,747 the method of Lagrange multipliers, 6 00:00:15,747 --> 00:00:17,330 and I have a nice problem here for you 7 00:00:17,330 --> 00:00:18,830 that can be solved that way. 8 00:00:18,830 --> 00:00:21,950 So in this problem, we've got an ellipse, 9 00:00:21,950 --> 00:00:24,610 the ellipse with equation x squared plus 4 y squared 10 00:00:24,610 --> 00:00:25,320 equals 4. 11 00:00:25,320 --> 00:00:27,175 So that's this ellipse, and we want 12 00:00:27,175 --> 00:00:30,510 to inscribe a rectangle in it, so here I 13 00:00:30,510 --> 00:00:35,180 mean actually a rectangle whose edges are parallel to the axes. 14 00:00:35,180 --> 00:00:37,660 So I want to inscribe a rectangle in this ellipse, 15 00:00:37,660 --> 00:00:40,945 and among all such rectangles, I want 16 00:00:40,945 --> 00:00:43,396 to find the one with the largest perimeter. 17 00:00:43,396 --> 00:00:45,020 So I want to find the maximal perimeter 18 00:00:45,020 --> 00:00:47,840 of a rectangle that can be inscribed in this ellipse. 19 00:00:47,840 --> 00:00:50,940 So why don't you have a go at solving this problem, 20 00:00:50,940 --> 00:00:53,480 pause the video, work it out, come back, 21 00:00:53,480 --> 00:00:54,940 and we can work it out together. 22 00:01:03,200 --> 00:01:05,680 So hopefully, you've had some luck working on this problem. 23 00:01:05,680 --> 00:01:07,440 Let's get started on it. 24 00:01:07,440 --> 00:01:09,645 So one thing we need to start is we 25 00:01:09,645 --> 00:01:11,970 need to figure out a way to sort of describe 26 00:01:11,970 --> 00:01:14,940 these rectangles in a way that will let 27 00:01:14,940 --> 00:01:17,120 us describe their perimeter, write down 28 00:01:17,120 --> 00:01:18,120 what their perimeter is. 29 00:01:18,120 --> 00:01:20,390 So a natural way to do that is to call 30 00:01:20,390 --> 00:01:24,070 this upper right-hand corner of the rectangle, the call it 31 00:01:24,070 --> 00:01:27,700 the point (x, y). 32 00:01:27,700 --> 00:01:30,340 So (x, y) is going to be that upper right-hand corner 33 00:01:30,340 --> 00:01:32,550 of the rectangle, and it's going to be ranging 34 00:01:32,550 --> 00:01:36,450 over the region from this topmost point on the ellipse 35 00:01:36,450 --> 00:01:39,470 down to this rightmost point on the ellipse, 36 00:01:39,470 --> 00:01:42,070 on this quarter arc of the ellipse. 37 00:01:42,070 --> 00:01:44,990 So if that point is (x, y), we need 38 00:01:44,990 --> 00:01:46,950 to figure out what is the perimeter that we're 39 00:01:46,950 --> 00:01:47,810 trying to optimize. 40 00:01:47,810 --> 00:01:53,030 So the perimeter here, P, which is a function of x and y-- 41 00:01:53,030 --> 00:01:56,400 well, so x is this distance, so the length 42 00:01:56,400 --> 00:01:58,945 of the horizontal edge of the rectangle is 2x, 43 00:01:58,945 --> 00:02:00,760 and we've got two of those, so that's 44 00:02:00,760 --> 00:02:04,440 4x from the horizontal sides. 45 00:02:04,440 --> 00:02:08,960 And then this height is y, so the length 46 00:02:08,960 --> 00:02:11,410 of the vertical side of the rectangle is 2y, 47 00:02:11,410 --> 00:02:17,580 so the perimeter is going to be 4x plus 4y. 48 00:02:17,580 --> 00:02:21,290 So that's our objective function that we're trying to optimize, 49 00:02:21,290 --> 00:02:24,130 that we're trying to find the maximum of. 50 00:02:24,130 --> 00:02:27,200 And we also have the constraint function 51 00:02:27,200 --> 00:02:34,410 g, which is x squared plus 4 y squared, 52 00:02:34,410 --> 00:02:37,330 and the constraint is that g is equal to 4. 53 00:02:37,330 --> 00:02:41,100 So we have the objective function P-- P of x, y-- 54 00:02:41,100 --> 00:02:44,200 and we have this constraint function g, 55 00:02:44,200 --> 00:02:47,610 and so we want to write down some equations using 56 00:02:47,610 --> 00:02:50,950 Lagrange multipliers whose solutions will correspond 57 00:02:50,950 --> 00:02:55,100 to the possible maximum points of P. 58 00:02:55,100 --> 00:02:56,340 So what are those equations? 59 00:02:56,340 --> 00:03:00,730 Well, we need that the gradient of P 60 00:03:00,730 --> 00:03:03,660 is parallel to the gradient g. 61 00:03:03,660 --> 00:03:09,950 So that means that we need P_x is equal to lambda times 62 00:03:09,950 --> 00:03:15,260 g_x and P_y is equal to lambda times g_y 63 00:03:15,260 --> 00:03:17,020 for some value of lambda. 64 00:03:17,020 --> 00:03:19,350 We need to find a value of lambda that makes this true. 65 00:03:19,350 --> 00:03:21,940 And then also, our third equation is the constraint 66 00:03:21,940 --> 00:03:23,840 equation, that g is equal to 4. 67 00:03:23,840 --> 00:03:27,690 So what does P_x equal lambda g_x translate to in our case? 68 00:03:27,690 --> 00:03:29,560 Let's just draw a line here. 69 00:03:29,560 --> 00:03:35,200 So in our case, P_x is the x partial derivative of 4x plus 70 00:03:35,200 --> 00:03:40,750 4y, so that's just 4, and g_x, we take the partial derivative 71 00:03:40,750 --> 00:03:43,430 with respect to x of x squared plus 4y squared, 72 00:03:43,430 --> 00:03:49,610 and that's equal to 2x, so 4 is equal to lambda times 2x. 73 00:03:49,610 --> 00:03:52,080 And from taking the y partial derivatives, 74 00:03:52,080 --> 00:03:57,690 we have that the y partial derivative of P is 4, P_y is 4, 75 00:03:57,690 --> 00:04:03,310 and g_y is going to be the y partial derivative of x squared 76 00:04:03,310 --> 00:04:11,740 plus 4 y squared, so that's 8y, so 4 equals lambda times 8y, 77 00:04:11,740 --> 00:04:16,060 and we also have the constraint equation x squared 78 00:04:16,060 --> 00:04:19,756 plus 4 y squared equals 4. 79 00:04:19,756 --> 00:04:21,505 So we need to solve these three equations, 80 00:04:21,505 --> 00:04:24,120 and we need to figure out which values of x and y 81 00:04:24,120 --> 00:04:27,050 are the solutions. 82 00:04:27,050 --> 00:04:30,430 So I think the simplest way to proceed here 83 00:04:30,430 --> 00:04:33,530 is to note that from the first equation 84 00:04:33,530 --> 00:04:37,100 and the second equation, we can eliminate lambda between them, 85 00:04:37,100 --> 00:04:40,760 and what we'll see is that x has to be exactly four times 86 00:04:40,760 --> 00:04:44,130 as large as y for this to be true, 87 00:04:44,130 --> 00:04:46,830 for both of these equations to be true at the same time. 88 00:04:46,830 --> 00:04:50,200 So we need x to be equal to 4y. 89 00:04:50,200 --> 00:05:02,620 So from the first two equations, we have that x is equal to 4y, 90 00:05:02,620 --> 00:05:06,090 and now we can substitute that in to the constraint equation. 91 00:05:06,090 --> 00:05:10,140 So if x is 4y, then x squared is 16 y squared, 92 00:05:10,140 --> 00:05:15,720 so x squared plus 4 y squared is 20 y squared. 93 00:05:15,720 --> 00:05:20,812 So we have 20y squared is equal to 4. 94 00:05:20,812 --> 00:05:22,270 And OK, so we can solve this for y. 95 00:05:22,270 --> 00:05:24,420 We can divide by 20 and take a square root, 96 00:05:24,420 --> 00:05:29,470 so we get that y-- well, so y squared is equal to 1/5, 97 00:05:29,470 --> 00:05:33,010 so y is equal to plus or minus 1 over the square root of 5. 98 00:05:33,010 --> 00:05:37,630 But remember, come back over here, we've taken (x, y) 99 00:05:37,630 --> 00:05:40,980 to be the upper right-hand corner, this first quadrant 100 00:05:40,980 --> 00:05:45,190 corner of our rectangle, so y is always positive. 101 00:05:45,190 --> 00:05:49,520 So we had that y squared equals 1/5 and y is positive, 102 00:05:49,520 --> 00:05:50,940 so there's actually only one root. 103 00:05:50,940 --> 00:05:52,773 We don't need to consider the negative root. 104 00:05:52,773 --> 00:05:56,960 So over here, we know that y is 1 divided 105 00:05:56,960 --> 00:06:00,140 by the square root of 5. 106 00:06:00,140 --> 00:06:01,810 OK, so that's y. 107 00:06:01,810 --> 00:06:02,450 Now what's x? 108 00:06:02,450 --> 00:06:04,890 Well, OK, so we solve for x in terms of y, 109 00:06:04,890 --> 00:06:11,580 so x is equal to 4 over the square root of 5. 110 00:06:11,580 --> 00:06:15,930 So Lagrange multipliers, when we use the method of Lagrange 111 00:06:15,930 --> 00:06:20,010 multipliers, we get this one possible point 112 00:06:20,010 --> 00:06:23,030 at which we have to check to be the maximum. 113 00:06:23,030 --> 00:06:25,850 But remember that when you're using Lagrange multipliers, 114 00:06:25,850 --> 00:06:28,227 you also have to worry about the boundary of the region 115 00:06:28,227 --> 00:06:29,310 that you're interested in. 116 00:06:29,310 --> 00:06:32,450 So let's go look at our picture again. 117 00:06:32,450 --> 00:06:36,250 So over on our picture, this point (x, y) 118 00:06:36,250 --> 00:06:40,852 moved along the arc connecting the topmost point 119 00:06:40,852 --> 00:06:43,060 of the ellipse to the rightmost point of the ellipse. 120 00:06:43,060 --> 00:06:45,540 So we also have to look at the perimeters 121 00:06:45,540 --> 00:06:48,930 when the point is the topmost point 122 00:06:48,930 --> 00:06:50,920 and when the point is the rightmost point. 123 00:06:50,920 --> 00:06:52,970 Now, in those two cases, the rectangle 124 00:06:52,970 --> 00:06:56,350 is a sort of degenerate rectangle, and when (x, y) 125 00:06:56,350 --> 00:07:00,380 is this point (0, 1), it's sort of two copies 126 00:07:00,380 --> 00:07:05,000 of this vertical line, this minor axis, and when (x, y) 127 00:07:05,000 --> 00:07:08,000 is the point (2, 0), then our rectangle 128 00:07:08,000 --> 00:07:11,890 just looks like the major axis, which is that horizontal line. 129 00:07:11,890 --> 00:07:14,130 But we still have to check those cases 130 00:07:14,130 --> 00:07:17,760 to see whether our function has a maximum and what it is. 131 00:07:17,760 --> 00:07:20,230 So we need to compute the objective function 132 00:07:20,230 --> 00:07:23,080 value at this point and we need to compute it 133 00:07:23,080 --> 00:07:25,050 at those endpoints. 134 00:07:25,050 --> 00:07:29,890 So we need to look at P of-- so this is our point 135 00:07:29,890 --> 00:07:32,390 4 over the square root of 5 comma 136 00:07:32,390 --> 00:07:35,730 1 over the square root of 5, and we know that P of x, y 137 00:07:35,730 --> 00:07:40,470 is 4x plus 4y, so that's equal to 20 138 00:07:40,470 --> 00:07:43,790 over the square root of 5, which we can also write as 4 139 00:07:43,790 --> 00:07:46,120 times the square root of 5. 140 00:07:46,120 --> 00:07:48,140 And we also need to check those two endpoints, 141 00:07:48,140 --> 00:07:52,692 so we need to check the point P of 0, 1, so that's 4, 142 00:07:52,692 --> 00:07:57,720 and we need to check the point P of 2, 0, so that's 8. 143 00:07:57,720 --> 00:08:00,910 So in order to find out what the maximum value of P is, 144 00:08:00,910 --> 00:08:03,370 we need to compare the value of P 145 00:08:03,370 --> 00:08:06,800 at the points given to us by Lagrange multipliers 146 00:08:06,800 --> 00:08:11,470 and at the boundary points of the region, which in this case 147 00:08:11,470 --> 00:08:12,920 are the endpoints of the arc. 148 00:08:12,920 --> 00:08:16,360 So we need to compare the numbers 4 square root of 5, 4 149 00:08:16,360 --> 00:08:21,090 and 8, and indeed, 4 square root of 5 is the largest of these. 150 00:08:21,090 --> 00:08:24,640 So this is the largest, so this is actually the maximum value, 151 00:08:24,640 --> 00:08:25,190 OK? 152 00:08:25,190 --> 00:08:38,310 So the maximum perimeter is 4 square root of 5 153 00:08:38,310 --> 00:08:50,440 when rectangle has its upper rightmost vertex at this point: 154 00:08:50,440 --> 00:08:57,330 4 over square root of 5 comma 1 over square root of 5. 155 00:08:57,330 --> 00:09:00,360 So our rectangle's maximal perimeter 156 00:09:00,360 --> 00:09:02,870 is 4 root 5, and that occurs when 157 00:09:02,870 --> 00:09:06,180 the upper right-hand vertex is at the point 4 over root 5, 1 158 00:09:06,180 --> 00:09:07,170 over root 5. 159 00:09:07,170 --> 00:09:12,220 So to quickly recap, we wanted to apply the method of Lagrange 160 00:09:12,220 --> 00:09:14,050 multipliers to this problem. 161 00:09:14,050 --> 00:09:18,320 So we chose to keep track of our rectangles 162 00:09:18,320 --> 00:09:20,170 by their upper right-hand corner. 163 00:09:20,170 --> 00:09:24,880 And then that gave us-- the perimeter was 4x plus 4y. 164 00:09:24,880 --> 00:09:26,240 That was our objective function. 165 00:09:26,240 --> 00:09:28,573 And the constraint was that that upper right-hand corner 166 00:09:28,573 --> 00:09:30,590 actually had to lie on the ellipse. 167 00:09:30,590 --> 00:09:36,170 So then we set the gradients of the two functions equal 168 00:09:36,170 --> 00:09:38,090 and solved the system of equations 169 00:09:38,090 --> 00:09:42,880 that we get by having those-- sorry, the gradients not to be 170 00:09:42,880 --> 00:09:44,350 equal, but to be parallel. 171 00:09:44,350 --> 00:09:48,160 There's some constant multiple lambda that appears. 172 00:09:48,160 --> 00:09:50,420 So we set the gradients to be parallel 173 00:09:50,420 --> 00:09:54,170 to each other and the constraint equation to hold, 174 00:09:54,170 --> 00:09:57,920 and we solved those three equation simultaneously 175 00:09:57,920 --> 00:10:00,270 for x and y. 176 00:10:00,270 --> 00:10:03,180 And those equations gave us one point 177 00:10:03,180 --> 00:10:04,920 that we had to check to be the maximum, 178 00:10:04,920 --> 00:10:06,680 and we also needed to check points 179 00:10:06,680 --> 00:10:08,770 on the boundary of the region in question. 180 00:10:08,770 --> 00:10:14,280 So here, those were just the two points (0, 1) and (2, 0). 181 00:10:14,280 --> 00:10:16,140 So I'll end there.