1 00:00:00,499 --> 00:00:01,560 GILBERT STRANG: OK. 2 00:00:01,560 --> 00:00:04,830 Now, I'm going to have differential equations, systems 3 00:00:04,830 --> 00:00:08,260 of equations, so there'll be matrices and vectors, 4 00:00:08,260 --> 00:00:11,340 using symmetric matrix. 5 00:00:11,340 --> 00:00:12,950 They'll be second order. 6 00:00:12,950 --> 00:00:16,079 So second order, second derivative, that y 7 00:00:16,079 --> 00:00:17,720 is the vector. 8 00:00:17,720 --> 00:00:21,200 And S is the symmetric matrix. 9 00:00:21,200 --> 00:00:23,900 And that's the first time we've been 10 00:00:23,900 --> 00:00:26,900 prepared for the most fundamental equation 11 00:00:26,900 --> 00:00:31,480 of physics, of mechanics, oscillating springs-- 12 00:00:31,480 --> 00:00:38,200 so many applications-- rotating torques. 13 00:00:38,200 --> 00:00:43,320 It's very important in applications. 14 00:00:43,320 --> 00:00:46,920 The finite element, giant finite element codes, 15 00:00:46,920 --> 00:00:51,810 are solving equations like that all the time. 16 00:00:51,810 --> 00:00:54,000 And we don't have a damping term here, so 17 00:00:54,000 --> 00:00:58,740 it-- or a forcing term, so it's the null solutions 18 00:00:58,740 --> 00:01:02,770 that I'm going to look for to match initial conditions. 19 00:01:02,770 --> 00:01:04,650 I don't have a forcing term. 20 00:01:04,650 --> 00:01:05,519 OK. 21 00:01:05,519 --> 00:01:12,930 So the real central equation always looks like that. 22 00:01:12,930 --> 00:01:16,720 This is-- Newton's law, is what this is-- mass times 23 00:01:16,720 --> 00:01:18,310 acceleration. 24 00:01:18,310 --> 00:01:22,820 So M will be a matrix, often a diagonal matrix, 25 00:01:22,820 --> 00:01:24,500 telling me the masses. 26 00:01:24,500 --> 00:01:27,590 Remember, I have n equations here, 27 00:01:27,590 --> 00:01:30,410 so I have n masses, as you'll see. 28 00:01:30,410 --> 00:01:33,210 And I have, let's say, a bunch of springs 29 00:01:33,210 --> 00:01:35,100 connecting those masses. 30 00:01:35,100 --> 00:01:41,390 And then there's a matrix K in multiplying y itself, 31 00:01:41,390 --> 00:01:45,360 and that's always called the stiffness matrix. 32 00:01:45,360 --> 00:01:47,820 So, actually, in applications, the first job 33 00:01:47,820 --> 00:01:54,050 is to take the problem and create these matrices. 34 00:01:54,050 --> 00:01:58,820 I'll give you an example, but let's suppose we've got them, 35 00:01:58,820 --> 00:02:02,150 and how do we solve them? 36 00:02:02,150 --> 00:02:08,870 We look for, as we always do, solutions where time 37 00:02:08,870 --> 00:02:12,310 is separate from the vector x. 38 00:02:12,310 --> 00:02:15,240 I substitute that into the equation, 39 00:02:15,240 --> 00:02:21,770 So I get M, second derivative will bring down the i omega, 40 00:02:21,770 --> 00:02:23,560 twice. 41 00:02:23,560 --> 00:02:30,558 E to the i omega t x, right? 42 00:02:30,558 --> 00:02:42,180 Plus, this term, K times e to the i omega t x, should be 0. 43 00:02:42,180 --> 00:02:47,550 So I'm just substituting the expected form for the solution. 44 00:02:47,550 --> 00:02:52,030 In that form, that exponential factor can cancel. 45 00:02:52,030 --> 00:02:55,910 And, I see, I have an eigenvalue problem. 46 00:02:55,910 --> 00:02:58,150 Let me just look at that eigenvalue problem. 47 00:02:58,150 --> 00:03:01,420 I'm going to put that on the opposite side. 48 00:03:01,420 --> 00:03:04,825 But what i squared is giving me minus one. 49 00:03:04,825 --> 00:03:09,300 I'm just going to be left with Kx. 50 00:03:09,300 --> 00:03:12,420 Well, let me put this on the other side, 51 00:03:12,420 --> 00:03:14,020 because it's got a minus. 52 00:03:14,020 --> 00:03:17,010 And then when I put it over there, will be a plus. 53 00:03:17,010 --> 00:03:24,800 M omega squared x. 54 00:03:24,800 --> 00:03:26,960 That's an eigenvalue problem. 55 00:03:26,960 --> 00:03:29,810 Here is the eigenvector. 56 00:03:29,810 --> 00:03:32,300 There is the eigenvalue. 57 00:03:32,300 --> 00:03:34,560 Oh, but we have two matrices. 58 00:03:34,560 --> 00:03:37,970 That's something a little new. 59 00:03:37,970 --> 00:03:40,110 Not new to MATLAB however. 60 00:03:40,110 --> 00:03:42,730 The MATLAB command to find these eigenvalues, 61 00:03:42,730 --> 00:03:45,310 let me call those eigenvalues lambda, 62 00:03:45,310 --> 00:03:48,420 so lambda will now be omega squared, 63 00:03:48,420 --> 00:03:52,490 because two derivatives brought down omega twice. 64 00:03:52,490 --> 00:03:56,700 But we have our two matrices, so the MATLAB command 65 00:03:56,700 --> 00:04:09,400 would be i of K and M. If you define the matrices, K and M, 66 00:04:09,400 --> 00:04:13,170 and you call that command, it will produce the eigenvalues 67 00:04:13,170 --> 00:04:17,769 and the eigenvectors x for this, you could say, 68 00:04:17,769 --> 00:04:22,490 generalized eigenvalue problem, two matrix eigenvalue problem. 69 00:04:22,490 --> 00:04:26,050 It's got a K, as usual, and then it has an M. 70 00:04:26,050 --> 00:04:30,740 But many, many times, M will be a multiple of the identity 71 00:04:30,740 --> 00:04:33,730 and present no problem. 72 00:04:33,730 --> 00:04:38,310 OK, so that-- this is the eigenvalue problem 73 00:04:38,310 --> 00:04:40,980 that we reached. 74 00:04:40,980 --> 00:04:44,830 And that's the command that would solve it. 75 00:04:44,830 --> 00:04:45,730 OK. 76 00:04:45,730 --> 00:04:49,110 That's the first step, is to look for solutions 77 00:04:49,110 --> 00:04:50,960 of that special form. 78 00:04:50,960 --> 00:04:52,330 Now let's do a little count. 79 00:04:52,330 --> 00:04:56,020 How many solutions are we expecting? 80 00:04:56,020 --> 00:04:58,820 How many initial conditions do we have? 81 00:04:58,820 --> 00:05:05,210 So we initially, we give y at 0 of course, 82 00:05:05,210 --> 00:05:07,950 the initial condition, the position. 83 00:05:07,950 --> 00:05:10,900 But we also give, in a second order equation, 84 00:05:10,900 --> 00:05:16,270 we also give the initial velocity, y prime of 0. 85 00:05:16,270 --> 00:05:18,460 And those are vectors, because those tell us 86 00:05:18,460 --> 00:05:21,400 the initial condition of n masses. 87 00:05:21,400 --> 00:05:26,380 And so I have n numbers from y of 0 and n more numbers. 88 00:05:26,380 --> 00:05:29,450 Two n, all together, initial conditions. 89 00:05:29,450 --> 00:05:32,880 I'm going to need two n solutions. 90 00:05:32,880 --> 00:05:34,770 I'm going to need two n solutions 91 00:05:34,770 --> 00:05:37,530 to match two n initial conditions 92 00:05:37,530 --> 00:05:40,780 and solve the-- solve the equation. 93 00:05:40,780 --> 00:05:42,650 OK, so what do they look like? 94 00:05:45,540 --> 00:05:46,610 All right. 95 00:05:46,610 --> 00:05:51,040 Here, I've gone ahead to put an application up. 96 00:05:51,040 --> 00:05:54,020 So, again, I'm taking the masses to be equal. 97 00:05:54,020 --> 00:06:03,340 Here are the masses, M, M, and M. And so I end up with a 3 98 00:06:03,340 --> 00:06:04,700 by 3 matrix. 99 00:06:04,700 --> 00:06:07,805 I have three unknowns, n is 3 for this problem. 100 00:06:12,020 --> 00:06:14,880 And I've got 4 springs. 101 00:06:14,880 --> 00:06:17,820 These are springs-- maybe I make them look a little springier. 102 00:06:21,770 --> 00:06:23,140 OK. 103 00:06:23,140 --> 00:06:31,030 And they're connected at the top to a fixed support 104 00:06:31,030 --> 00:06:34,210 and at the bottom to a fixed support 105 00:06:34,210 --> 00:06:36,230 and they're connected to each other. 106 00:06:36,230 --> 00:06:37,980 Do you see what will happen? 107 00:06:37,980 --> 00:06:43,830 As I, maybe I, the initial condition, 108 00:06:43,830 --> 00:06:47,500 I drag all those masses down? 109 00:06:47,500 --> 00:06:51,160 As my initial condition, I let go? 110 00:06:51,160 --> 00:06:55,060 Then they will go up and down, up and down, 111 00:06:55,060 --> 00:06:57,510 just the way springs always do. 112 00:06:57,510 --> 00:07:01,000 And they will solve, their position 113 00:07:01,000 --> 00:07:06,250 will be the solution to my differential equation. 114 00:07:06,250 --> 00:07:12,580 M y double prime plus Ky equals 0. 115 00:07:12,580 --> 00:07:17,350 So I'm not, I'm just starting the motion, 116 00:07:17,350 --> 00:07:18,860 and then backing off. 117 00:07:18,860 --> 00:07:22,930 So I'm not forcing-- it's not forced motion. 118 00:07:22,930 --> 00:07:27,010 It's pure oscillation, pure oscillation. 119 00:07:27,010 --> 00:07:27,860 Right. 120 00:07:27,860 --> 00:07:31,290 But coupled, several oscillators are 121 00:07:31,290 --> 00:07:33,380 a couple, that's what's new. 122 00:07:33,380 --> 00:07:39,090 We know all about this equation when y is just a scalar, just 123 00:07:39,090 --> 00:07:40,170 one equation. 124 00:07:40,170 --> 00:07:45,470 We know that, and that led us to the square root of K over M. 125 00:07:45,470 --> 00:07:48,470 That was just a 1 by 1 eigenvalue problem, 126 00:07:48,470 --> 00:07:52,320 and now we will have a 3 by 3 eigenvalue problem. 127 00:07:52,320 --> 00:07:54,630 The mass matrix is simple. 128 00:07:54,630 --> 00:07:57,200 Here's what the stiffness matrix would look like, 129 00:07:57,200 --> 00:08:00,280 if all those springs were the same. 130 00:08:00,280 --> 00:08:04,390 Just, I wanted to see what kind of a matrix 131 00:08:04,390 --> 00:08:08,180 shows up in the problem. 132 00:08:08,180 --> 00:08:11,180 And time to write down solutions. 133 00:08:11,180 --> 00:08:14,690 OK, so what are we remembering from solutions? 134 00:08:14,690 --> 00:08:21,150 We're remembering that solutions look like this. 135 00:08:21,150 --> 00:08:24,410 I have, but I'll have three possible eigenvectors, 136 00:08:24,410 --> 00:08:26,830 because I have 3 by 3 matrices. 137 00:08:26,830 --> 00:08:29,136 So that will give me three solutions. 138 00:08:31,780 --> 00:08:38,659 But I want six because I have six initial conditions all 139 00:08:38,659 --> 00:08:39,370 together. 140 00:08:39,370 --> 00:08:41,850 Let me write those six solutions down. 141 00:08:41,850 --> 00:08:50,490 Y, the solution is, sub constant times the cosine of omega t, 142 00:08:50,490 --> 00:08:54,010 times the first eigenvector. 143 00:08:54,010 --> 00:08:59,290 And another constant times the sine of omega 144 00:08:59,290 --> 00:09:03,510 t, times the second eigenvector-- 145 00:09:03,510 --> 00:09:05,580 times the first eigenvector, sorry. 146 00:09:05,580 --> 00:09:09,400 The first eigenvector, I have three eigenvectors, 147 00:09:09,400 --> 00:09:13,280 and for each of them, I get two solutions, one a cosine 148 00:09:13,280 --> 00:09:14,910 and one a sine. 149 00:09:14,910 --> 00:09:18,440 And the frequencies, there would be omega 1, 150 00:09:18,440 --> 00:09:22,930 and you are remembering that lambda, 151 00:09:22,930 --> 00:09:26,790 lambda is omega squared. 152 00:09:26,790 --> 00:09:29,680 So if I write omega 1 there, it's 153 00:09:29,680 --> 00:09:31,870 the square root of lambda 1. 154 00:09:31,870 --> 00:09:33,850 That's the square root of lambda 1. 155 00:09:33,850 --> 00:09:36,390 So I've got two solutions so far, 156 00:09:36,390 --> 00:09:40,840 coming from the first eigenvector at its eigenvalue, 157 00:09:40,840 --> 00:09:43,590 and with the cosine and a sine. 158 00:09:43,590 --> 00:09:50,070 And then, I'll also have for the A2 and a B2, 159 00:09:50,070 --> 00:09:51,720 and an A3 and a B3. 160 00:09:51,720 --> 00:10:02,700 So I just, briefly, A2, B2 with omega, using omega 2 and x2. 161 00:10:02,700 --> 00:10:08,300 And then they'll be an A3 and a B3 using 162 00:10:08,300 --> 00:10:12,820 omega 3 and the eigenvector x3. 163 00:10:12,820 --> 00:10:15,560 That's pretty stupid looking. 164 00:10:15,560 --> 00:10:19,960 This is what I meant to represent. 165 00:10:19,960 --> 00:10:23,530 I don't want to rewrite all that with 2's, and then rewrite it 166 00:10:23,530 --> 00:10:24,940 again with 3's. 167 00:10:24,940 --> 00:10:27,135 That's what the solution looks like. 168 00:10:27,135 --> 00:10:27,635 OK. 169 00:10:30,330 --> 00:10:32,460 How do we-- when we match the initial condition, 170 00:10:32,460 --> 00:10:34,010 what happens? 171 00:10:34,010 --> 00:10:36,000 I said t equals 0, right? 172 00:10:36,000 --> 00:10:41,040 When I said t equals 0, the sines disappear. 173 00:10:41,040 --> 00:10:47,210 So it's the A's that match y of 0. 174 00:10:47,210 --> 00:10:54,500 So A's match y of 0. 175 00:10:54,500 --> 00:11:00,180 And when I look at the initial velocity, the derivative, 176 00:11:00,180 --> 00:11:04,270 the derivative of the cosine is the sine, and it's 0. 177 00:11:04,270 --> 00:11:07,790 But the derivative of the sine is the cosine and it's 1, 178 00:11:07,790 --> 00:11:15,900 so I'll see that the B's match y prime of 0. 179 00:11:15,900 --> 00:11:18,800 I'm trying to get the total count to be six. 180 00:11:18,800 --> 00:11:24,140 So there are three, three initial positions, 181 00:11:24,140 --> 00:11:25,990 and three A's. 182 00:11:25,990 --> 00:11:28,000 There are three initial velocities, 183 00:11:28,000 --> 00:11:30,870 cause there are three masses, and there are three B's. 184 00:11:30,870 --> 00:11:33,370 I get a perfect match, a total of six. 185 00:11:33,370 --> 00:11:36,640 Six constants, six numbers to match. 186 00:11:36,640 --> 00:11:38,230 It all works. 187 00:11:38,230 --> 00:11:39,000 OK. 188 00:11:39,000 --> 00:11:41,150 Now, do I want to try an example? 189 00:11:41,150 --> 00:11:41,890 Sure. 190 00:11:41,890 --> 00:11:45,260 Let me end with a particular example. 191 00:11:45,260 --> 00:11:49,400 I better go to 2 by 2 for an example. 192 00:11:49,400 --> 00:11:52,490 So can I do the same problem 2 by 2? 193 00:11:52,490 --> 00:11:58,500 So my problem is going to be y double prime plus S-- 194 00:11:58,500 --> 00:12:01,650 there's a K, there's a division by m, 195 00:12:01,650 --> 00:12:10,160 and there's a 2, 2 minus 1, minus 1 y equals 0. 196 00:12:10,160 --> 00:12:12,160 That's my equation. 197 00:12:12,160 --> 00:12:15,580 Now, I'm speaking now, about the problem 198 00:12:15,580 --> 00:12:23,220 with a spring, a first mass m, a spring, the second mass 199 00:12:23,220 --> 00:12:25,685 m, and a spring. 200 00:12:28,410 --> 00:12:33,550 So two masses, two equal masses, three equal springs. 201 00:12:33,550 --> 00:12:35,130 That's my equation. 202 00:12:35,130 --> 00:12:36,950 So what's a solution? 203 00:12:36,950 --> 00:12:38,750 How do I solve it? 204 00:12:38,750 --> 00:12:42,920 I need the eigenvalues and the eigenvectors of my matrix. 205 00:12:42,920 --> 00:12:49,800 So here's my matrix S. That's my matrix S. It's symmetric, 206 00:12:49,800 --> 00:12:53,180 it's got physical constants there. 207 00:12:53,180 --> 00:12:56,750 The stiffness of the springs divided 208 00:12:56,750 --> 00:13:01,590 by the masses, k over m, we're expecting that same k over m 209 00:13:01,590 --> 00:13:03,440 that always shows up. 210 00:13:03,440 --> 00:13:05,700 And we need the eigenvectors there. 211 00:13:05,700 --> 00:13:07,430 And what are they? 212 00:13:07,430 --> 00:13:14,130 The eigenvalues of that are 1 times k over m, 213 00:13:14,130 --> 00:13:18,460 And 3 times k over m. 214 00:13:18,460 --> 00:13:20,970 Cause the trace is 4. 215 00:13:20,970 --> 00:13:22,460 2 plus 2 is 4. 216 00:13:22,460 --> 00:13:23,930 The determinant is 3. 217 00:13:23,930 --> 00:13:25,740 4 minus 1 is 3. 218 00:13:25,740 --> 00:13:28,010 Those are the two eigenvalues. 219 00:13:28,010 --> 00:13:32,320 And these are the omega squareds, remember. 220 00:13:32,320 --> 00:13:33,040 OK. 221 00:13:33,040 --> 00:13:35,620 That's how I start the system from rest. 222 00:13:35,620 --> 00:13:40,860 So physically I pull down these masses, 223 00:13:40,860 --> 00:13:44,210 or maybe I push that one up and pull that one down, 224 00:13:44,210 --> 00:13:46,440 whatever I like. 225 00:13:46,440 --> 00:13:49,720 I hold them for a moment and I let go. 226 00:13:49,720 --> 00:13:51,800 I don't give them an initial velocity. 227 00:13:51,800 --> 00:13:56,950 They start from rest, so the B's will be 0. 228 00:13:56,950 --> 00:14:04,270 So y prime of 0, y prime of 0 is going to be 0 from rest. 229 00:14:04,270 --> 00:14:08,900 And that will give me B's are 0. 230 00:14:08,900 --> 00:14:19,770 So my solution will be, my A cosine of, 231 00:14:19,770 --> 00:14:24,680 so the eigenvalues cosine, I take the square root of k 232 00:14:24,680 --> 00:14:31,100 over m t times the first eigenvector-- 233 00:14:31,100 --> 00:14:34,420 one of the eigenvectors. 234 00:14:34,420 --> 00:14:38,325 The eigenvectors of this, probably are 1, 1. 235 00:14:41,120 --> 00:14:44,320 And then the other eigenvector, and that 236 00:14:44,320 --> 00:14:48,840 will have a cosine of the square root of omega, 237 00:14:48,840 --> 00:14:50,600 I have to take the square root of that, 238 00:14:50,600 --> 00:14:56,380 so that's the square root of 3, k over m t, 239 00:14:56,380 --> 00:15:00,616 times its eigenvector, which I think is 1 minus 1. 240 00:15:00,616 --> 00:15:03,520 It's going to be perpendicular to that one. 241 00:15:03,520 --> 00:15:05,360 I've solved the problem. 242 00:15:05,360 --> 00:15:10,330 The A1 and the A2 are determined by the initial condition. 243 00:15:10,330 --> 00:15:13,880 Now do you see what's happening in the motion? 244 00:15:13,880 --> 00:15:17,780 That's the last thing, last point for this video. 245 00:15:17,780 --> 00:15:22,000 This motion with a 1, 1 eigenvector, the two masses 246 00:15:22,000 --> 00:15:23,290 are in sync. 247 00:15:23,290 --> 00:15:25,040 They're growing together, up and down. 248 00:15:25,040 --> 00:15:30,160 That's one eigenvector of the problem. 249 00:15:30,160 --> 00:15:32,500 And it has a certain frequency that they 250 00:15:32,500 --> 00:15:36,710 go up and down-- a square root of k over m, our old friend. 251 00:15:36,710 --> 00:15:41,080 But also, with two masses, they can go against each other, 252 00:15:41,080 --> 00:15:43,350 like this motion. 253 00:15:43,350 --> 00:15:46,210 That's coming from this eigenvector, 254 00:15:46,210 --> 00:15:49,220 and it happens at a higher frequency. 255 00:15:49,220 --> 00:15:52,840 So those are going-- the final solution 256 00:15:52,840 --> 00:15:56,570 is a combination of the masses moving together 257 00:15:56,570 --> 00:16:00,980 at a little slower oscillation, and the masses moving 258 00:16:00,980 --> 00:16:04,200 opposite each other at a faster oscillation. 259 00:16:04,200 --> 00:16:07,990 Some combination of those two is the solution. 260 00:16:07,990 --> 00:16:11,280 And then if we had three masses, there 261 00:16:11,280 --> 00:16:13,860 would be three oscillations. 262 00:16:13,860 --> 00:16:16,840 One where all three are going together, 263 00:16:16,840 --> 00:16:22,870 one where the outside ones are opposite, 264 00:16:22,870 --> 00:16:26,930 and one where all three are, I see opposite signs. 265 00:16:29,830 --> 00:16:32,230 It's a beautiful subject. 266 00:16:32,230 --> 00:16:37,280 Highly developed, and highly important applications. 267 00:16:37,280 --> 00:16:41,130 But that's the nicest solution you could hope for. 268 00:16:41,130 --> 00:16:44,290 OK that's a second order system, solved. 269 00:16:44,290 --> 00:16:45,840 Good.