1 00:00:05,965 --> 00:00:06,590 BEN HARRIS: Hi. 2 00:00:06,590 --> 00:00:08,220 I'm Ben. 3 00:00:08,220 --> 00:00:12,440 Today we are going to do an LU decomposition problem. 4 00:00:12,440 --> 00:00:14,900 Here's the problem right here. 5 00:00:14,900 --> 00:00:18,830 Find that LU decomposition of this matrix A. 6 00:00:18,830 --> 00:00:22,020 Now notice that this matrix A has variables, as well 7 00:00:22,020 --> 00:00:23,180 as numbers. 8 00:00:23,180 --> 00:00:28,612 So the sentence ends: when it exists. 9 00:00:28,612 --> 00:00:30,070 And the second part of the question 10 00:00:30,070 --> 00:00:33,510 asks you: for which real numbers a and b 11 00:00:33,510 --> 00:00:38,240 does the LU decomposition of this matrix actually exist? 12 00:00:38,240 --> 00:00:43,650 Now, you can hit pause now and I'll give you a few seconds. 13 00:00:43,650 --> 00:00:45,940 You can try to solve this on your own, 14 00:00:45,940 --> 00:00:48,245 and then we'll be back and we can do it together. 15 00:00:58,320 --> 00:01:00,740 And we're back. 16 00:01:00,740 --> 00:01:04,480 Now, what do you have to remember when doing an LU 17 00:01:04,480 --> 00:01:07,760 decomposition problem? 18 00:01:07,760 --> 00:01:11,310 Well, we do elimination in the same way 19 00:01:11,310 --> 00:01:18,830 that we did before in order to find U. But with this question 20 00:01:18,830 --> 00:01:20,940 we need to find L as well. 21 00:01:20,940 --> 00:01:23,100 So we need to do elimination, but we also 22 00:01:23,100 --> 00:01:25,540 need to keep track of the elimination matrices 23 00:01:25,540 --> 00:01:27,440 along the way. 24 00:01:27,440 --> 00:01:28,150 Good. 25 00:01:28,150 --> 00:01:30,350 So let's do that. 26 00:01:30,350 --> 00:01:32,780 So let me put my matrix up here. 27 00:01:42,090 --> 00:01:44,320 And we want to do elimination. 28 00:01:44,320 --> 00:01:47,719 So which entry do we eliminate first? 29 00:01:47,719 --> 00:01:48,260 That's right. 30 00:01:48,260 --> 00:01:52,320 It's this (2, 1) entry. 31 00:01:52,320 --> 00:01:55,890 So we replace the second row by the second row 32 00:01:55,890 --> 00:02:00,240 minus a times the first row, and we get this. 33 00:02:09,810 --> 00:02:12,000 But we're not just doing elimination, 34 00:02:12,000 --> 00:02:14,180 we're finding an LU decomposition. 35 00:02:14,180 --> 00:02:16,800 So we need to keep track of the matrix 36 00:02:16,800 --> 00:02:20,880 that I multiplied the elimination matrix, that I 37 00:02:20,880 --> 00:02:24,980 multiplied this matrix A by on the left to get this matrix. 38 00:02:24,980 --> 00:02:26,800 So what is that? 39 00:02:26,800 --> 00:02:28,950 That's this E_(2,1). 40 00:02:28,950 --> 00:02:33,720 Since I eliminated the (2, 1) entry, I'll call it E_(2,1). 41 00:02:33,720 --> 00:02:37,280 And it's this matrix. 42 00:02:37,280 --> 00:02:38,840 Why is it this matrix? 43 00:02:38,840 --> 00:02:41,970 Well, remember how multiplication on the left 44 00:02:41,970 --> 00:02:43,000 works. 45 00:02:43,000 --> 00:02:47,190 I replaced the first row by just the first row. 46 00:02:47,190 --> 00:02:50,270 I replaced the second row by the second row 47 00:02:50,270 --> 00:02:53,110 minus a times the first row. 48 00:02:53,110 --> 00:02:55,440 So you can just read off from these rows 49 00:02:55,440 --> 00:02:59,010 which operations I did. 50 00:02:59,010 --> 00:03:01,620 Now, which entries should we eliminate next? 51 00:03:01,620 --> 00:03:03,750 We need to eliminate this b. 52 00:03:03,750 --> 00:03:09,090 So we will replace the third row by the third row 53 00:03:09,090 --> 00:03:11,500 minus b times the first row. 54 00:03:18,680 --> 00:03:20,945 And which elimination matrix did we use? 55 00:03:28,330 --> 00:03:31,620 Well, note, we replaced the third row 56 00:03:31,620 --> 00:03:34,950 by the third row minus b times the first row. 57 00:03:34,950 --> 00:03:37,350 That's exactly what you should read off this elimination 58 00:03:37,350 --> 00:03:39,470 matrix. 59 00:03:39,470 --> 00:03:40,400 Good. 60 00:03:40,400 --> 00:03:43,220 Now, we only have one step left. 61 00:03:43,220 --> 00:03:45,550 We only need to eliminate one last entry. 62 00:03:45,550 --> 00:03:50,960 But this one's a little tricky, so let's be careful. 63 00:03:50,960 --> 00:03:55,730 In order to eliminate this b, we need a to be a pivot. 64 00:03:55,730 --> 00:03:59,670 In particular, we need a to be nonzero. 65 00:03:59,670 --> 00:04:01,330 If a were zero here, then we would 66 00:04:01,330 --> 00:04:03,610 have to do a row exchange. 67 00:04:03,610 --> 00:04:05,220 And that's no good. 68 00:04:05,220 --> 00:04:07,540 You can't find an LU decomposition 69 00:04:07,540 --> 00:04:11,100 if you have to do a row exchange in elimination. 70 00:04:11,100 --> 00:04:18,579 So we need to assume that a is non-zero 71 00:04:18,579 --> 00:04:22,470 in order to keep going. 72 00:04:22,470 --> 00:04:26,070 So let's just assume there that a is non-zero. 73 00:04:26,070 --> 00:04:28,960 Now, what do we do? 74 00:04:28,960 --> 00:04:31,600 Well we can replace the third row 75 00:04:31,600 --> 00:04:38,040 by the third row minus b over a times the second row. 76 00:04:38,040 --> 00:04:43,600 And we just get this. 77 00:04:43,600 --> 00:04:46,020 a minus b. 78 00:04:46,020 --> 00:04:49,130 And let's write down our elimination matrix. 79 00:04:49,130 --> 00:04:52,980 E_(3,2) now. 80 00:04:59,340 --> 00:05:00,910 There's our elimination matrix. 81 00:05:00,910 --> 00:05:04,180 We replaced the third row by the third row minus b 82 00:05:04,180 --> 00:05:06,191 over a times the second row. 83 00:05:06,191 --> 00:05:06,690 Good. 84 00:05:10,630 --> 00:05:13,130 So we found our U matrix. 85 00:05:13,130 --> 00:05:16,000 That's what elimination does, it gives us our U matrix. 86 00:05:16,000 --> 00:05:17,210 So let me write it up here. 87 00:05:20,300 --> 00:05:28,050 1, 0, 1; 0, a, 0; 0, 0, a minus b. 88 00:05:35,130 --> 00:05:37,140 Good. 89 00:05:37,140 --> 00:05:38,825 Now we have to find our L matrix, 90 00:05:38,825 --> 00:05:41,330 and we need to use these elimination matrices 91 00:05:41,330 --> 00:05:46,440 that we've been recording along the way in order to do that. 92 00:05:46,440 --> 00:05:53,580 So remember that we started with A, and we got U. 93 00:05:53,580 --> 00:05:54,660 And how did we do that? 94 00:05:54,660 --> 00:05:58,270 Well we multiplied on the left by all of these elimination 95 00:05:58,270 --> 00:06:05,770 matrices, E_(2,1), E_(3,1) and E_(3,2). 96 00:06:05,770 --> 00:06:08,870 Sorry if that's scrunching together there. 97 00:06:08,870 --> 00:06:11,200 Now, if we move these elimination matrices 98 00:06:11,200 --> 00:06:17,220 to the other side then we'll get L. So what do we have? 99 00:06:17,220 --> 00:06:26,180 We have A equals E_(2,1) inverse, E_(3,1) inverse, 100 00:06:26,180 --> 00:06:33,770 E_(3,2) inverse times U. And this is our L, 101 00:06:33,770 --> 00:06:37,570 this product of these three matrices. 102 00:06:37,570 --> 00:06:38,430 Good. 103 00:06:38,430 --> 00:06:40,610 So let's compute it now. 104 00:06:43,190 --> 00:06:45,170 So L is the product of three matrices. 105 00:06:45,170 --> 00:06:49,340 I need to get them by going back and looking at these three 106 00:06:49,340 --> 00:06:52,110 elimination matrices and taking their inverses. 107 00:06:52,110 --> 00:06:54,860 Well the nice thing about taking an inverse 108 00:06:54,860 --> 00:06:58,080 of an elementary matrix like this is we 109 00:06:58,080 --> 00:07:02,150 just make a minus a plus or a plus a minus. 110 00:07:02,150 --> 00:07:06,470 So that's easy enough. 111 00:07:06,470 --> 00:07:08,480 We just change the off-diagonal entries, 112 00:07:08,480 --> 00:07:09,605 we just change their signs. 113 00:07:12,860 --> 00:07:17,232 You can check that that does what we wanted it to. 114 00:07:17,232 --> 00:07:20,450 It gives us the inverse. 115 00:07:20,450 --> 00:07:21,720 Good. 116 00:07:21,720 --> 00:07:24,410 And the last comment is that multiplying these three 117 00:07:24,410 --> 00:07:26,970 matrices is really easy in this order. 118 00:07:26,970 --> 00:07:31,290 Turns out all you do is you just plop these entries right in. 119 00:07:35,030 --> 00:07:36,040 1, 1. 120 00:07:36,040 --> 00:07:36,860 Good. 121 00:07:36,860 --> 00:07:38,065 So this is our L matrix. 122 00:07:41,780 --> 00:07:45,600 So now we have our U matrix and our L matrix, 123 00:07:45,600 --> 00:07:49,110 and we're done with the first part of the question. 124 00:07:49,110 --> 00:07:52,850 The second part asks us for which real numbers a and b 125 00:07:52,850 --> 00:07:55,350 does this decomposition exist? 126 00:07:55,350 --> 00:07:58,660 Now let's go back and remember that at one point 127 00:07:58,660 --> 00:08:01,400 we had to assume that A was non-zero. 128 00:08:01,400 --> 00:08:03,810 That was the only assumption we had to make 129 00:08:03,810 --> 00:08:06,030 to get this decomposition. 130 00:08:06,030 --> 00:08:10,840 So it exists-- it being this decomposition-- 131 00:08:10,840 --> 00:08:11,825 when a is non-zero. 132 00:08:14,792 --> 00:08:16,500 And that's the answer to the second part. 133 00:08:19,630 --> 00:08:24,750 So we have our LU decomposition, and we know when it exists. 134 00:08:24,750 --> 00:08:27,920 Before I end, two comments. 135 00:08:27,920 --> 00:08:30,810 First, always check your work. 136 00:08:30,810 --> 00:08:33,880 Always go back and multiply L times U 137 00:08:33,880 --> 00:08:35,580 and make sure it's A, because it's 138 00:08:35,580 --> 00:08:38,270 easy to screw up the elimination process 139 00:08:38,270 --> 00:08:41,360 and it's easy to check your work. 140 00:08:41,360 --> 00:08:46,300 So if you go back and make sure things are as they should be. 141 00:08:46,300 --> 00:08:50,320 Second comment is that you might be worried 142 00:08:50,320 --> 00:08:55,990 when you do this elimination process that-- well OK, we 143 00:08:55,990 --> 00:08:58,860 had to assume a is non-zero because we 144 00:08:58,860 --> 00:09:01,164 wanted a non-zero pivot. 145 00:09:01,164 --> 00:09:02,580 You might worry that we might have 146 00:09:02,580 --> 00:09:05,290 to have a minus b be non-zero. 147 00:09:05,290 --> 00:09:09,660 But in fact, a minus b can be 0. 148 00:09:09,660 --> 00:09:14,420 It's not a problem for this entry 149 00:09:14,420 --> 00:09:20,670 to be 0 because we don't have to do a row exchange to get 150 00:09:20,670 --> 00:09:24,280 U. That's the only time when we can't do the LU decomposition. 151 00:09:24,280 --> 00:09:29,146 In particular, singular matrices can have LU decompositions. 152 00:09:29,146 --> 00:09:29,646 Good. 153 00:09:32,660 --> 00:09:34,210 Thanks.