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