1 00:00:00,770 --> 00:00:02,500 GILBERT STRANG: OK. 2 00:00:02,500 --> 00:00:07,480 So can I begin with a few words about the big picture 3 00:00:07,480 --> 00:00:11,010 of solving differential equations? 4 00:00:11,010 --> 00:00:14,280 So if that was a nonlinear equation, 5 00:00:14,280 --> 00:00:17,110 we would go to computer solutions. 6 00:00:17,110 --> 00:00:22,500 And Cleve Moler is making a parallel video series 7 00:00:22,500 --> 00:00:27,260 about the Matlab suite of codes for solving 8 00:00:27,260 --> 00:00:29,420 differential equations. 9 00:00:29,420 --> 00:00:32,130 Then when that equation is linear, 10 00:00:32,130 --> 00:00:36,930 as it is here, with constant coefficients, as like the 1, 11 00:00:36,930 --> 00:00:40,610 minus 3, and the 2, we can always 12 00:00:40,610 --> 00:00:43,040 get a formula for the answer. 13 00:00:43,040 --> 00:00:45,210 Involves an integral. 14 00:00:45,210 --> 00:00:49,880 There's still one integral to do involving the impulse response. 15 00:00:49,880 --> 00:00:51,690 And you'll see that. 16 00:00:51,690 --> 00:00:56,080 But there are few, the most beautiful, the most simple 17 00:00:56,080 --> 00:01:00,670 equations when the right-hand side has a special form. 18 00:01:00,670 --> 00:01:04,980 And that's one possibility-- t, or t 19 00:01:04,980 --> 00:01:07,740 squared we could deal with, or e to the t. 20 00:01:07,740 --> 00:01:09,390 We'll see all those. 21 00:01:09,390 --> 00:01:13,920 Then we know what the solution looks like. 22 00:01:13,920 --> 00:01:16,910 For example-- first of all, we know the null solutions, 23 00:01:16,910 --> 00:01:17,720 of course. 24 00:01:17,720 --> 00:01:19,840 That's when this is 0. 25 00:01:19,840 --> 00:01:25,880 And then I just wrote for e to the st, and I find s could be 1 26 00:01:25,880 --> 00:01:27,240 or s could be 2. 27 00:01:27,240 --> 00:01:30,790 Those are two solutions with right side 0. 28 00:01:30,790 --> 00:01:33,040 So we can match initial conditions. 29 00:01:33,040 --> 00:01:36,040 But we need a particular solution. 30 00:01:36,040 --> 00:01:40,040 And that's where this one is especially simple. 31 00:01:40,040 --> 00:01:46,860 So the idea is to try the form we know the solution will have. 32 00:01:46,860 --> 00:01:55,060 So I'm going to try a particular solution. 33 00:01:55,060 --> 00:02:02,190 When I see a t there, I'll want a t in the particular solution. 34 00:02:02,190 --> 00:02:04,580 But I also need the constant term. 35 00:02:04,580 --> 00:02:09,500 So I'll try a plus bt. 36 00:02:09,500 --> 00:02:14,670 What I mean by try is put that into the equation, 37 00:02:14,670 --> 00:02:16,670 match the left side and the right side, 38 00:02:16,670 --> 00:02:18,790 and we have a solution. 39 00:02:18,790 --> 00:02:21,370 And I'll just go ahead and do that. 40 00:02:21,370 --> 00:02:25,760 So there's several-- this video is mostly 41 00:02:25,760 --> 00:02:30,450 about the list of possible nice functions. 42 00:02:30,450 --> 00:02:31,961 And that's one of them. 43 00:02:31,961 --> 00:02:32,460 OK. 44 00:02:32,460 --> 00:02:35,050 So if I put that into the equation, 45 00:02:35,050 --> 00:02:38,250 the second derivative is 0 for that. 46 00:02:38,250 --> 00:02:40,910 So I have minus 3. 47 00:02:40,910 --> 00:02:44,340 The first derivative is just b. 48 00:02:44,340 --> 00:02:49,656 Then I have plus 2 times y itself, which is a plus bt. 49 00:02:53,080 --> 00:02:56,600 So the left side of the equation is just this much. 50 00:02:56,600 --> 00:03:00,470 And it has to equal 4t. 51 00:03:00,470 --> 00:03:03,610 And that we can make happen. 52 00:03:03,610 --> 00:03:12,000 I see 2bt and 4t here, so I want b equal to 2. 53 00:03:12,000 --> 00:03:16,660 And so when b is 2, then I have 4t matching 4t. 54 00:03:16,660 --> 00:03:22,740 And then I have minus 3b plus 2a should be 0. 55 00:03:22,740 --> 00:03:27,280 Minus 3b plus 2a, the constant part there we don't want, 56 00:03:27,280 --> 00:03:28,950 so that should be 0. 57 00:03:28,950 --> 00:03:33,820 We already know b is 2, so that's minus 6 plus 2a. 58 00:03:33,820 --> 00:03:34,620 a is 3. 59 00:03:37,800 --> 00:03:39,810 a is 3. 60 00:03:39,810 --> 00:03:44,330 Now, that's perfectly satisfied by b equal 2a equal 3, 61 00:03:44,330 --> 00:03:45,750 and that's the answer. 62 00:03:45,750 --> 00:03:53,770 Correct answer is b was 2, a was 3, 63 00:03:53,770 --> 00:03:57,220 and we don't have to say try anymore. 64 00:03:57,220 --> 00:03:58,321 We got it. 65 00:03:58,321 --> 00:03:58,820 Done. 66 00:04:01,800 --> 00:04:03,350 One other right-hand side. 67 00:04:03,350 --> 00:04:08,370 Once you get a nice one like this, you look for more. 68 00:04:08,370 --> 00:04:10,770 If it was t squared, we would assume-- 69 00:04:10,770 --> 00:04:14,320 what would we assume if it was a 4t squared there? 70 00:04:14,320 --> 00:04:19,160 We would assume a plus bt plus ct squared. 71 00:04:19,160 --> 00:04:24,770 We want to match the right-hand side. 72 00:04:24,770 --> 00:04:27,440 Now, a different type of right-hand side 73 00:04:27,440 --> 00:04:28,840 we know already. 74 00:04:28,840 --> 00:04:38,520 What if this was e to the-- say, e to the 3t? 75 00:04:38,520 --> 00:04:47,880 Or e to the st. Let me put any exponent there for the moment. 76 00:04:47,880 --> 00:04:51,370 So now we have a different right-hand side. 77 00:04:51,370 --> 00:04:52,730 A very nice function. 78 00:04:52,730 --> 00:04:55,690 The best function of differential equations. 79 00:04:55,690 --> 00:05:03,080 And now what we will try with this right-hand side, 80 00:05:03,080 --> 00:05:06,050 e to the st. We've seen it before. 81 00:05:06,050 --> 00:05:12,340 The particular solution is just y e to the st. 82 00:05:12,340 --> 00:05:18,570 The undetermined coefficients were a and b in the first time. 83 00:05:18,570 --> 00:05:20,390 Here the undetermined coefficient 84 00:05:20,390 --> 00:05:25,370 is capital Y. I'm just going to plug that into the equation 85 00:05:25,370 --> 00:05:27,310 and match the left side and right side. 86 00:05:27,310 --> 00:05:32,270 And I'll determine this coefficient, capital Y. 87 00:05:32,270 --> 00:05:35,930 So what happens when I put that into the equation? 88 00:05:35,930 --> 00:05:38,970 I get second derivative brings down 89 00:05:38,970 --> 00:05:45,020 an s squared, and first derivative, we have a minus 3. 90 00:05:45,020 --> 00:05:49,725 The first derivative brings down an s, and I have plus 2. 91 00:05:52,990 --> 00:05:59,100 All that is Y e to the st, right? 92 00:05:59,100 --> 00:06:02,230 I put in Y e to the st. The derivatives 93 00:06:02,230 --> 00:06:07,280 brought down this familiar polynomial. 94 00:06:07,280 --> 00:06:13,940 And it's all supposed to match e to the st. 95 00:06:13,940 --> 00:06:14,830 We can do that. 96 00:06:14,830 --> 00:06:16,960 That's a perfect match. 97 00:06:16,960 --> 00:06:20,350 The left side has the same form as the right side. 98 00:06:20,350 --> 00:06:23,270 I can cancel the e to the st's, and I 99 00:06:23,270 --> 00:06:34,750 discover that Y is 1 over s squared minus 3s plus 2. 100 00:06:34,750 --> 00:06:37,420 Good. 101 00:06:37,420 --> 00:06:41,620 That's the coefficient, 1 over that. 102 00:06:41,620 --> 00:06:42,230 Let's see. 103 00:06:42,230 --> 00:06:45,310 I have to make two comments. 104 00:06:45,310 --> 00:06:52,540 One comment is that s-- we're totally golden if that s 105 00:06:52,540 --> 00:06:54,240 is imaginary. 106 00:06:54,240 --> 00:06:58,920 If s is i omega, well, minus i omega, 107 00:06:58,920 --> 00:07:01,770 or both, both possibilities, those 108 00:07:01,770 --> 00:07:05,530 will give us sine and cosine. 109 00:07:05,530 --> 00:07:08,190 So we'll add those to the nice function. 110 00:07:08,190 --> 00:07:13,310 So the nice functions are t, polynomials. 111 00:07:13,310 --> 00:07:18,730 E to the st, exponentials. 112 00:07:18,730 --> 00:07:20,860 Sines and cosines. 113 00:07:20,860 --> 00:07:24,240 And you see this worked perfectly. 114 00:07:24,240 --> 00:07:28,330 Well, perfectly except we have to be sure 115 00:07:28,330 --> 00:07:30,720 that we don't have 1/0. 116 00:07:30,720 --> 00:07:32,770 When would we have 1/0? 117 00:07:32,770 --> 00:07:38,090 If s is 1, this would be 1 minus 3 plus 2, that would be 1/0. 118 00:07:40,650 --> 00:07:48,700 I can't deal with s equal 1 with that assumption. 119 00:07:48,700 --> 00:07:50,230 Doesn't work. 120 00:07:50,230 --> 00:07:51,750 Also, s equal 2. 121 00:07:51,750 --> 00:07:55,290 What's special about s equal 1 and s equal 2? 122 00:07:55,290 --> 00:07:58,240 Those make that 0. 123 00:07:58,240 --> 00:08:01,680 They give the null solutions. 124 00:08:01,680 --> 00:08:06,330 And I know that if this happened to be e to the t, 125 00:08:06,330 --> 00:08:10,430 and a null solution was also e to the t, 126 00:08:10,430 --> 00:08:13,930 I have to fix the particular solution by giving it 127 00:08:13,930 --> 00:08:15,330 an extra factor t. 128 00:08:15,330 --> 00:08:17,800 Let me do that at the end of the lecture. 129 00:08:17,800 --> 00:08:21,950 That's the resonance idea, where my null solution 130 00:08:21,950 --> 00:08:25,980 is the same as what I hope for the particular solution. 131 00:08:25,980 --> 00:08:28,740 So I have to change that particular solution 132 00:08:28,740 --> 00:08:30,650 with an extra factor t. 133 00:08:30,650 --> 00:08:33,360 Let me keep going here to be sure we 134 00:08:33,360 --> 00:08:35,559 get all the possibilities. 135 00:08:35,559 --> 00:08:42,250 Again, we're getting a very small set of nice functions. 136 00:08:42,250 --> 00:08:47,120 But fortunately, they appear quite often in applications. 137 00:08:47,120 --> 00:08:52,120 Constants, linear like 4t, exponentials like e 138 00:08:52,120 --> 00:08:58,200 to the 5t, oscillation like e to the i omega t. 139 00:08:58,200 --> 00:09:00,790 So let me make a list. 140 00:09:00,790 --> 00:09:08,670 So polynomials, like the forcing function could be t, 141 00:09:08,670 --> 00:09:10,920 could be 1. 142 00:09:10,920 --> 00:09:14,000 Constant, that would be like a ramp. 143 00:09:14,000 --> 00:09:19,890 That would be like a step function. 144 00:09:19,890 --> 00:09:26,490 They could be 3 to the st, but not s 145 00:09:26,490 --> 00:09:30,250 equals 1 and 2 in this problem. 146 00:09:30,250 --> 00:09:35,210 They could be e to the i omega t, and e 147 00:09:35,210 --> 00:09:42,530 to the minus i omega t, which leads me directly to cosine 148 00:09:42,530 --> 00:09:47,870 of omega t and sine of omega t. 149 00:09:47,870 --> 00:09:52,290 I'm creating here a list of the nice functions-- 150 00:09:52,290 --> 00:09:56,810 polynomials, exponentials, cosine and sine, 151 00:09:56,810 --> 00:09:59,310 because those come from exponentials, 152 00:09:59,310 --> 00:10:03,550 and finally, I can multiply these. 153 00:10:03,550 --> 00:10:11,670 I could have, for example, t e to the st. I could allow that. 154 00:10:11,670 --> 00:10:13,760 And now, all I have to do is tell you, 155 00:10:13,760 --> 00:10:19,300 what form do I try to plug-in? 156 00:10:19,300 --> 00:10:22,520 The form will have undetermined coefficients. 157 00:10:22,520 --> 00:10:24,590 I'll substitute in the equation, and I'll 158 00:10:24,590 --> 00:10:26,520 determine the coefficients. 159 00:10:26,520 --> 00:10:29,740 So here we saw a plus bt. 160 00:10:29,740 --> 00:10:31,680 That was good. 161 00:10:31,680 --> 00:10:39,480 That was the Y. Here we saw Y e to the st. That was good. 162 00:10:39,480 --> 00:10:40,840 Here, what will I have? 163 00:10:43,880 --> 00:10:48,050 If I have cosine, I need the sine there also. 164 00:10:48,050 --> 00:10:50,940 So I'll have to allow a combination of those. 165 00:10:50,940 --> 00:10:56,230 Say M on this plus N of that. 166 00:10:56,230 --> 00:10:58,470 If I tried to do cosines alone, I 167 00:10:58,470 --> 00:11:02,470 would be in danger of taking the derivative, getting a sine, 168 00:11:02,470 --> 00:11:04,740 and having nothing to match. 169 00:11:04,740 --> 00:11:06,740 So I'll take that. 170 00:11:06,740 --> 00:11:11,340 Now, final question, or next question 171 00:11:11,340 --> 00:11:16,130 is, if I multiply two of these, the product rule is still 172 00:11:16,130 --> 00:11:19,480 going to tell me that derivatives of that 173 00:11:19,480 --> 00:11:21,830 have the same form as that. 174 00:11:21,830 --> 00:11:24,230 Derivatives of this t e to the st 175 00:11:24,230 --> 00:11:28,910 have the same-- they also involve t or e to the st, 176 00:11:28,910 --> 00:11:31,860 with factors s, from the product rule. 177 00:11:31,860 --> 00:11:34,070 So what do I assume here? 178 00:11:34,070 --> 00:11:38,770 Well, when I see t there, I have to include, 179 00:11:38,770 --> 00:11:44,290 as I did up there, also constants. 180 00:11:44,290 --> 00:11:47,940 And if I saw a t squared, I would go up to t squared. 181 00:11:47,940 --> 00:11:49,870 I'd have three coefficients. 182 00:11:49,870 --> 00:11:53,330 Now, that e to the st, I can keep. 183 00:11:56,290 --> 00:11:58,480 So what I've put on the right-hand side 184 00:11:58,480 --> 00:12:00,600 is the right form to assume. 185 00:12:00,600 --> 00:12:03,130 It's just like good advice. 186 00:12:03,130 --> 00:12:06,490 Put that into the differential equation when 187 00:12:06,490 --> 00:12:08,280 this is the right-hand side. 188 00:12:08,280 --> 00:12:10,700 Match left side with the right side. 189 00:12:10,700 --> 00:12:13,980 That will tell you a and b. 190 00:12:13,980 --> 00:12:15,830 And you have the answer. 191 00:12:15,830 --> 00:12:17,650 You have the particular solution. 192 00:12:17,650 --> 00:12:21,520 You have a particular solution, and that's what you wanted. 193 00:12:21,520 --> 00:12:23,370 OK. 194 00:12:23,370 --> 00:12:27,215 And if I had t cosine omega t, do 195 00:12:27,215 --> 00:12:29,340 you want to see in the whole business? 196 00:12:29,340 --> 00:12:34,640 If I had t cosine omega t-- oh dear, 197 00:12:34,640 --> 00:12:36,593 it's getting a little messy. 198 00:12:36,593 --> 00:12:47,180 I'd need an a plus bt to deal with the t. 199 00:12:47,180 --> 00:12:50,025 And I'd need a cosine to deal with the cosine. 200 00:12:53,020 --> 00:12:57,290 And then, just to make the problem a little messier, can't 201 00:12:57,290 --> 00:13:00,020 be helped, I'd need the sine. 202 00:13:00,020 --> 00:13:03,660 So I need a sine omega t. 203 00:13:03,660 --> 00:13:10,430 And I'm going to need a c plus dt there. 204 00:13:10,430 --> 00:13:11,130 OK. 205 00:13:11,130 --> 00:13:17,460 I'm up to four coefficients to determine by plugging in. 206 00:13:17,460 --> 00:13:21,020 It uses more ink, but it doesn't use more thinking. 207 00:13:21,020 --> 00:13:24,240 You just put it in, match all terms, 208 00:13:24,240 --> 00:13:27,790 and you discover A, B, C, and D. 209 00:13:27,790 --> 00:13:31,480 Finally, I have to say that word about resonance 210 00:13:31,480 --> 00:13:33,370 that I mentioned earlier. 211 00:13:33,370 --> 00:13:41,560 The possibility that if s happened to be 1 or 2 212 00:13:41,560 --> 00:13:46,380 on the right-hand side, that's also a null solution. 213 00:13:46,380 --> 00:13:51,830 This method would give me 1/0, infinite answer, no good. 214 00:13:51,830 --> 00:13:54,260 And we know what to do. 215 00:13:54,260 --> 00:13:57,170 We know how to deal with resonance. 216 00:13:57,170 --> 00:14:00,890 So with resonance-- so could I just finally complete 217 00:14:00,890 --> 00:14:02,030 the whole story. 218 00:14:02,030 --> 00:14:02,530 Resonance. 219 00:14:07,390 --> 00:14:12,020 In this example, s equal 1 or 2. 220 00:14:15,080 --> 00:14:22,190 What would I do with f of t equals e to the t? 221 00:14:22,190 --> 00:14:26,540 If that was the right-hand side, that would give me resonance. 222 00:14:26,540 --> 00:14:30,520 It's got the exponent s equal 1, which 223 00:14:30,520 --> 00:14:35,730 is also in the null solution, e to the t. 224 00:14:35,730 --> 00:14:37,420 So what do I try? 225 00:14:37,420 --> 00:14:42,960 So I try-- everybody knows what happens when there's resonance. 226 00:14:42,960 --> 00:14:45,110 When you have this doubling up. 227 00:14:45,110 --> 00:14:48,470 You need an extra factor t to rescue. 228 00:14:48,470 --> 00:14:51,810 So you would try y of t. 229 00:14:51,810 --> 00:14:55,100 y, this is the particular solution I'm looking for. 230 00:14:55,100 --> 00:15:02,790 You would try t e to the t, with a Y. 231 00:15:02,790 --> 00:15:06,650 And you would plug that in. 232 00:15:06,650 --> 00:15:10,170 You would find the right number for capital Y. 233 00:15:10,170 --> 00:15:12,940 And you'd have the particular solution. 234 00:15:12,940 --> 00:15:16,220 Only, I think, doing a few examples of this, 235 00:15:16,220 --> 00:15:19,970 you get the knack of assume the right form, 236 00:15:19,970 --> 00:15:24,130 put it into the equation, match left side with right side, 237 00:15:24,130 --> 00:15:27,660 and that reveals the undetermined coefficients. 238 00:15:27,660 --> 00:15:32,590 It tells you what a and b and capital Y and c and d, 239 00:15:32,590 --> 00:15:34,740 tells you what they all have to be. 240 00:15:34,740 --> 00:15:37,420 So this is a really good method that 241 00:15:37,420 --> 00:15:42,560 applies to really nice right-hand sides. 242 00:15:42,560 --> 00:15:43,060 Good. 243 00:15:43,060 --> 00:15:44,610 Thanks.