1 00:00:00 --> 00:00:01 2 00:00:01 --> 00:00:02 The following content is provided under a Creative 3 00:00:02 --> 00:00:03 Commons license. 4 00:00:03 --> 00:00:05 Your support will help MIT OpenCourseWare continue to 5 00:00:05 --> 00:00:10 offer high-quality educational resources for free. 6 00:00:10 --> 00:00:12 To make a donation, or to view additional materials from 7 00:00:12 --> 00:00:15 hundreds of MIT courses, visit MIT OpenCourseWare 8 00:00:15 --> 00:00:20 at ocw.mit.edu. 9 00:00:20 --> 00:00:21 AUDIENCE: OK. 10 00:00:21 --> 00:00:26 I hoped I might have Exam 2 for you today, but it's not 11 00:00:26 --> 00:00:28 quite back from the grader. 12 00:00:28 --> 00:00:33 It's already gone to the second grader, so it will not be long. 13 00:00:33 --> 00:00:40 And I hope you've had a look at the MATLAB homework for 14 00:00:40 --> 00:00:43 a variety of possible. 15 00:00:43 --> 00:00:49 I think we've got, there were some errors in the original 16 00:00:49 --> 00:00:52 statement, location of the coordinates, but I think 17 00:00:52 --> 00:00:53 they're fixed now. 18 00:00:53 --> 00:00:55 So ready to go on that MATLAB. 19 00:00:55 --> 00:00:58 Don't forget that it's four on the right-hand side and not 20 00:00:58 --> 00:01:04 one, so if you get an answer near 1/4 at the center of the 21 00:01:04 --> 00:01:07 circle, that's the reason. 22 00:01:07 --> 00:01:12 Just that factor four is to remember. 23 00:01:12 --> 00:01:15 I'll talk more about the MATLAB this afternoon in the 24 00:01:15 --> 00:01:18 review session right here. 25 00:01:18 --> 00:01:22 Just to say, I'm highly interested in that problem. 26 00:01:22 --> 00:01:28 Not just increasing N, the number of mesh points in the 27 00:01:28 --> 00:01:34 octagon, but also increasing the number of sides. 28 00:01:34 --> 00:01:42 So there are two numbers there, we had N points on a ray, 29 00:01:42 --> 00:01:44 out from the center. 30 00:01:44 --> 00:01:49 But we have M sides of the polygon. 31 00:01:49 --> 00:01:55 And I'm interested in both of those, getting big. 32 00:01:55 --> 00:01:57 Growing. 33 00:01:57 --> 00:01:58 I don't know how. 34 00:01:58 --> 00:02:08 And maybe a reasonable balance is to take, I think N 35 00:02:08 --> 00:02:11 proportional to M is a pretty good balance. 36 00:02:11 --> 00:02:14 So I'd be very happy; I mean I'm very happy 37 00:02:14 --> 00:02:15 with whatever you do. 38 00:02:15 --> 00:02:19 But I'm really interested to know what happens as 39 00:02:19 --> 00:02:22 both of these increase. 40 00:02:22 --> 00:02:25 How close, how quickly do you approach the eigenvalues 41 00:02:25 --> 00:02:26 of a circle. 42 00:02:26 --> 00:02:29 And you might keep the two proportional as 43 00:02:29 --> 00:02:31 you increase them. 44 00:02:31 --> 00:02:34 So let me say more about that this afternoon, because it's a 45 00:02:34 --> 00:02:37 big day today, to start Fourier. 46 00:02:37 --> 00:02:41 Fourier series, the new chapter, the new topic. 47 00:02:41 --> 00:02:44 In fact, the final major topic of the course. 48 00:02:44 --> 00:02:52 So I tried to list here, so here I'm in Section 4.1, so I'm 49 00:02:52 --> 00:02:54 talking about Fourier series. 50 00:02:54 --> 00:02:58 So Fourier series is for functions that have period 2pi. 51 00:02:59 --> 00:03:05 It involves things like sin(x), like cos(x) like e^(ikx), all 52 00:03:05 --> 00:03:11 of those if I increase x by 2pi, I'm back where I started. 53 00:03:11 --> 00:03:15 So that's the sort of functions that have Fourier series. 54 00:03:15 --> 00:03:21 Then we'll go on to the other two big forms, crucial 55 00:03:21 --> 00:03:23 forms of the Fourier world. 56 00:03:23 --> 00:03:28 But 4.1 starts with the classical Fourier series. 57 00:03:28 --> 00:03:34 So I realize, you will have seen, many of you will have 58 00:03:34 --> 00:03:36 seen Fourier series before. 59 00:03:36 --> 00:03:40 I hope you'll see some new aspects here. 60 00:03:40 --> 00:03:48 So, let me just get organized. 61 00:03:48 --> 00:03:53 It's nice to have some examples that just involve sine. 62 00:03:53 --> 00:03:57 And since the sine is an odd function, that means it's sort 63 00:03:57 --> 00:04:01 of anti-symmetric across zero, those are the functions 64 00:04:01 --> 00:04:03 that will have only sine. 65 00:04:03 --> 00:04:05 That will have a sine expansion. 66 00:04:05 --> 00:04:07 Cosines are the opposite. 67 00:04:07 --> 00:04:10 Cosines are symmetric across zero. 68 00:04:10 --> 00:04:12 Like a constant, or like cos(x). 69 00:04:12 --> 00:04:15 Zero comes right at the symmetric point. 70 00:04:15 --> 00:04:18 So those will have only cosines. 71 00:04:18 --> 00:04:22 And a lot of examples fit in one or the other of those, 72 00:04:22 --> 00:04:24 and it's easy to see them. 73 00:04:24 --> 00:04:28 The general function, of course, is a combination 74 00:04:28 --> 00:04:30 odd and even. 75 00:04:30 --> 00:04:33 It has cosines and it has sines, it's just the 76 00:04:33 --> 00:04:35 some of the two pieces. 77 00:04:35 --> 00:04:41 So, this is the standard Fourier series, which I 78 00:04:41 --> 00:04:45 couldn't get onto one line, but it has all the cosines 79 00:04:45 --> 00:04:49 including this slightly different cos(0), 80 00:04:49 --> 00:04:51 and all the sines. 81 00:04:51 --> 00:04:57 But because this one has these three different pieces, the 82 00:04:57 --> 00:05:02 constant term, the other cosines, all the sines, three 83 00:05:02 --> 00:05:07 slightly different formulas, it's actually nicest of all, 84 00:05:07 --> 00:05:10 to use this final form. 85 00:05:10 --> 00:05:12 Because there's just one formula. 86 00:05:12 --> 00:05:13 There's just one kind. 87 00:05:13 --> 00:05:18 And I'll call its coefficient c_k, and now they multiply 88 00:05:18 --> 00:05:22 e^(ikx), so we have to get used to e^(ikx). 89 00:05:24 --> 00:05:29 We may be more familiar with cos, sin(kx) and cos(kx), 90 00:05:29 --> 00:05:34 but everybody knows e^(ikx) is a combination of them. 91 00:05:34 --> 00:05:38 And if we let k go from minus infinity to infinity, so 92 00:05:38 --> 00:05:40 we've got all the terms. 93 00:05:40 --> 00:05:48 Including e^(-i3x), and e^(+i3x), those would 94 00:05:48 --> 00:05:51 combine to give cosines and sines of 3x. 95 00:05:52 --> 00:05:54 We get one nice formula. 96 00:05:54 --> 00:05:57 There's just one formula for the C's. 97 00:05:57 --> 00:06:01 So that's one good reason to look at the complex form. 98 00:06:01 --> 00:06:05 Even if our function is actually real. 99 00:06:05 --> 00:06:09 That form is kind of neat, and the second good reason, the 100 00:06:09 --> 00:06:13 really important reason, is then when we go to the discrete 101 00:06:13 --> 00:06:18 Fourier transform, the DFT, everybody writes that 102 00:06:18 --> 00:06:20 with complex numbers. 103 00:06:20 --> 00:06:25 So it's good to see complex numbers first and then we 104 00:06:25 --> 00:06:30 can just translate the formulas from. 105 00:06:30 --> 00:06:33 And these are also almost always written with 106 00:06:33 --> 00:06:34 complex numbers. 107 00:06:34 --> 00:06:39 So this is the way to see it. 108 00:06:39 --> 00:06:44 OK, so what do we do about Fourier series? 109 00:06:44 --> 00:06:46 What do we have to know how to do and what 110 00:06:46 --> 00:06:47 should we understand? 111 00:06:47 --> 00:06:53 Well, if you've met Fourier series you may have met the 112 00:06:53 --> 00:06:56 formula for these coefficients. 113 00:06:56 --> 00:06:58 That's sort of like step one. 114 00:06:58 --> 00:07:01 If I'm given the function, whatever the function might be, 115 00:07:01 --> 00:07:02 might be a delta function. 116 00:07:02 --> 00:07:04 Interesting case, always. 117 00:07:04 --> 00:07:07 Always interesting. 118 00:07:07 --> 00:07:08 Always crazy right? 119 00:07:08 --> 00:07:13 But it's always interesting, the delta function. 120 00:07:13 --> 00:07:16 The coefficients can be computed. 121 00:07:16 --> 00:07:21 The coefficients, you'll see, I'll repeat those formulas. 122 00:07:21 --> 00:07:26 They involve integrals. 123 00:07:26 --> 00:07:29 What I want to say right now is that this isn't a 124 00:07:29 --> 00:07:31 course in integration. 125 00:07:31 --> 00:07:35 So I'm not interested in doing more and more complicated 126 00:07:35 --> 00:07:39 integrals and finding Fourier coefficients 127 00:07:39 --> 00:07:40 of weird functions. 128 00:07:40 --> 00:07:41 No way. 129 00:07:41 --> 00:07:45 I want to understand the simple, straight, the 130 00:07:45 --> 00:07:47 important examples. 131 00:07:47 --> 00:07:52 And here's a point that's highly interesting. 132 00:07:52 --> 00:07:56 In practice, in computing practice, we're close to 133 00:07:56 --> 00:07:57 computing practice here. 134 00:07:57 --> 00:07:59 In everything we do. 135 00:07:59 --> 00:08:03 I mean, this is really constantly used. 136 00:08:03 --> 00:08:07 And one important question is, is the Fourier series 137 00:08:07 --> 00:08:09 quickly convergent? 138 00:08:09 --> 00:08:11 Because if we're going to compute, we don't want to 139 00:08:11 --> 00:08:14 compute a thousand terms. 140 00:08:14 --> 00:08:19 Hopefully ten terms, 20 terms would give us good accuracy. 141 00:08:19 --> 00:08:24 So that question comes down to how quickly does those a's 142 00:08:24 --> 00:08:27 and b's and c's go to zero? 143 00:08:27 --> 00:08:28 That's highly important. 144 00:08:28 --> 00:08:32 And you'll connect this decay rate, we'll connect this with 145 00:08:32 --> 00:08:34 the smoothness of the function. 146 00:08:34 --> 00:08:38 Oh, I can tell you even at a start. 147 00:08:38 --> 00:08:42 OK, so I just want to emphasize this point. 148 00:08:42 --> 00:08:50 We'll see it over and over that like for a delta function, 149 00:08:50 --> 00:08:56 which is not smooth at all, we'll see no decay at all. 150 00:08:56 --> 00:08:58 In the coefficients. 151 00:08:58 --> 00:09:03 They're constant. 152 00:09:03 --> 00:09:06 They don't decrease as we go to higher and higher frequencies. 153 00:09:06 --> 00:09:13 I think of k here, I'll use the word frequency for k. 154 00:09:13 --> 00:09:18 So high frequency means high k, far off the Fourier series, and 155 00:09:18 --> 00:09:22 the question is, are the coefficients staying up there 156 00:09:22 --> 00:09:24 big, and we have to worry about them. 157 00:09:24 --> 00:09:26 Or do they get very small? 158 00:09:26 --> 00:09:29 So a delta function is a key example and 159 00:09:29 --> 00:09:32 then a step function. 160 00:09:32 --> 00:09:34 So what will be the deal with those? 161 00:09:34 --> 00:09:38 If I have a function that's a step function, I'll have 162 00:09:38 --> 00:09:41 decay at rate is 1/k. 163 00:09:41 --> 00:09:44 164 00:09:44 --> 00:09:46 So they do go to zero. 165 00:09:46 --> 00:09:53 The thousandth coefficient will be roughly of size 1/1000. 166 00:09:53 --> 00:09:54 That's not fast. 167 00:09:54 --> 00:10:02 That's not really fast enough to compute with. 168 00:10:02 --> 00:10:08 Well, we meet step functions, I mean, functions with jumps. 169 00:10:08 --> 00:10:11 And we'll see that their Fourier series, the 170 00:10:11 --> 00:10:16 coefficients do go to zero but not very fast. 171 00:10:16 --> 00:10:19 And we get something highly interesting. 172 00:10:19 --> 00:10:23 So when we do these examples, so I've sort of moved on to 173 00:10:23 --> 00:10:27 examples, so these are two basic examples. 174 00:10:27 --> 00:10:30 What would be the next example? 175 00:10:30 --> 00:10:32 Step function. 176 00:10:32 --> 00:10:35 Well, yeah, or maybe a hat next. 177 00:10:35 --> 00:10:37 A hat function would be, you see what I'm 178 00:10:37 --> 00:10:38 doing at each step? 179 00:10:38 --> 00:10:40 I'm integrating. 180 00:10:40 --> 00:10:44 A hat function might be the next, yeah, a ramp, exactly. 181 00:10:44 --> 00:10:48 Hat function, which is a ramp with a corner. 182 00:10:48 --> 00:10:50 Now, so that's one integral better. 183 00:10:50 --> 00:10:55 You want to guess the decay rate on that one? k squared. 184 00:10:55 --> 00:10:58 Now we're getting better. 185 00:10:58 --> 00:11:00 That's a faster follow-up. 186 00:11:00 --> 00:11:00 1/k^2. 187 00:11:02 --> 00:11:04 And then we integrate again, we'd get 1/k^3. 188 00:11:06 --> 00:11:11 Then one more integral, 1/k^4 would be a cubic spline with, 189 00:11:11 --> 00:11:14 you remember the cubic spline is continuous. 190 00:11:14 --> 00:11:16 Its derivative is continuous, that gives us a 1/k^3. 191 00:11:17 --> 00:11:20 Its second derivative is continuous, that gives us a 192 00:11:20 --> 00:11:25 1/k^4, and then you really can compute with that, if you 193 00:11:25 --> 00:11:27 have such a function. 194 00:11:27 --> 00:11:31 So, point, pay attention to decay rate. 195 00:11:31 --> 00:11:37 That, and the connection to smoothness. 196 00:11:37 --> 00:11:41 So examples, we'll start right off with these guys. 197 00:11:41 --> 00:11:44 And then we'll see the rules for the derivative. 198 00:11:44 --> 00:11:48 Oh yeah, rules for the derivative. 199 00:11:48 --> 00:11:53 The beauty of Fourier series is, well, actually 200 00:11:53 --> 00:11:54 you can see this. 201 00:11:54 --> 00:11:56 You can see the rule. 202 00:11:56 --> 00:11:58 Let me just show you the rule for this. 203 00:11:58 --> 00:12:03 So the rule for derivatives, the whole point about 204 00:12:03 --> 00:12:08 Fourier is, it connects perfectly with calculus. 205 00:12:08 --> 00:12:10 With taking derivatives. 206 00:12:10 --> 00:12:16 So suppose I have F(x) equals, I'll use this form, the 207 00:12:16 --> 00:12:18 sum of c_k*e^(ikx). 208 00:12:18 --> 00:12:22 209 00:12:22 --> 00:12:24 And now I take its derivative. dF/dx. 210 00:12:25 --> 00:12:29 What do you think is the derivative, what's the Fourier 211 00:12:29 --> 00:12:33 series for the derivative? 212 00:12:33 --> 00:12:36 Suppose I have the Fourier series for some function, and 213 00:12:36 --> 00:12:38 then I take Fourier series for the derivative. 214 00:12:38 --> 00:12:42 So I'm kind of going the backwards way. 215 00:12:42 --> 00:12:43 Less smooth. 216 00:12:43 --> 00:12:48 I'm going from, the derivative of the step function involves 217 00:12:48 --> 00:12:53 delta functions, so I'm going less smooth as 218 00:12:53 --> 00:12:57 I take derivatives. 219 00:12:57 --> 00:13:00 It's so easy, it jumps at you. 220 00:13:00 --> 00:13:01 What's the rule? 221 00:13:01 --> 00:13:05 Just take the derivative of every term, so I'll have the 222 00:13:05 --> 00:13:10 sum of, now what happens when I take the derivative? 223 00:13:10 --> 00:13:14 Everybody see what happens when I take the derivative of that 224 00:13:14 --> 00:13:17 typical term in the Fourier series? 225 00:13:17 --> 00:13:19 What happens? 226 00:13:19 --> 00:13:22 The derivative brings down a factor, ik. 227 00:13:23 --> 00:13:32 With k being the thing that, so it's ik times what we have. 228 00:13:32 --> 00:13:38 So these are the Fourier coefficients of the derivative. 229 00:13:38 --> 00:13:42 And that again makes exactly the same point about the 230 00:13:42 --> 00:13:46 decay rate or the opposite, the non decay rate. 231 00:13:46 --> 00:13:50 As I take the derivative you got a rougher function, right? 232 00:13:50 --> 00:13:54 Derivative of a step function is a delta, derivative of a 233 00:13:54 --> 00:13:57 hat would have some steps. 234 00:13:57 --> 00:14:02 We're going less smooth as we take more derivatives. 235 00:14:02 --> 00:14:06 And every time we do it, we see, you understand 236 00:14:06 --> 00:14:07 the decay rate now? 237 00:14:07 --> 00:14:14 Because the derivative just brings a factor ik, so its high 238 00:14:14 --> 00:14:18 frequencies are more present. 239 00:14:18 --> 00:14:20 Have larger coefficients. 240 00:14:20 --> 00:14:22 So and of course, the second derivative would 241 00:14:22 --> 00:14:24 bring down (ik)^2. 242 00:14:24 --> 00:14:27 243 00:14:27 --> 00:14:35 So that our equations, for example, let me just do 244 00:14:35 --> 00:14:38 an application here. 245 00:14:38 --> 00:14:41 Without pushing it. 246 00:14:41 --> 00:14:45 Our application, we started this course with equations 247 00:14:45 --> 00:14:46 like -u''(x)=delta(x-a). 248 00:14:46 --> 00:14:51 249 00:14:51 --> 00:14:52 Right? 250 00:14:52 --> 00:14:55 If we wanted to apply to a differential equation, 251 00:14:55 --> 00:14:56 how would I do it? 252 00:14:56 --> 00:15:00 I would take the Fourier series of both sides. 253 00:15:00 --> 00:15:03 I would look at, I'd jump into what people would 254 00:15:03 --> 00:15:05 call the frequency domain. 255 00:15:05 --> 00:15:10 So this is a differential equation written as usual 256 00:15:10 --> 00:15:13 in the physical domain. 257 00:15:13 --> 00:15:17 And with physical variable x position. 258 00:15:17 --> 00:15:18 Or it could be time. 259 00:15:18 --> 00:15:22 And now let me take Fourier transforms. 260 00:15:22 --> 00:15:23 So what would happen here? 261 00:15:23 --> 00:15:27 If I take the Fourier transform of this, well, we'll 262 00:15:27 --> 00:15:30 soon see, right? 263 00:15:30 --> 00:15:33 We get Fourier coefficients of the deltas. 264 00:15:33 --> 00:15:34 Of the delta function. 265 00:15:34 --> 00:15:38 That's a key example, and you see why. 266 00:15:38 --> 00:15:40 Over here, what will we get? 267 00:15:40 --> 00:15:43 And now I'm taking two derivatives, so I 268 00:15:43 --> 00:15:45 bring down ik twice. 269 00:15:45 --> 00:15:46 So I'm looking. 270 00:15:46 --> 00:15:51 Here it would be the sum of whatever the delta's 271 00:15:51 --> 00:15:52 coefficients are. 272 00:15:52 --> 00:15:54 Shall we call those d? 273 00:15:54 --> 00:15:59 The alphabet's coming out right. d for delta. 274 00:15:59 --> 00:16:03 So the right side has coefficients, d_k. 275 00:16:03 --> 00:16:05 And what about the left side? 276 00:16:05 --> 00:16:10 What are the coefficients if the solution u has coefficients 277 00:16:10 --> 00:16:15 c_k, so let's call this u now. 278 00:16:15 --> 00:16:18 Has coefficients c_k, then what happens to the second 279 00:16:18 --> 00:16:23 derivative? ik, ik again, that's i squared k 280 00:16:23 --> 00:16:25 squared, the minus sign. 281 00:16:25 --> 00:16:29 So we would have the sum of k squared c_k*e^(ikx). 282 00:16:29 --> 00:16:33 283 00:16:33 --> 00:16:37 This is if u itself has coefficient c_k, then -u'' 284 00:16:37 --> 00:16:39 has these coefficients. 285 00:16:39 --> 00:16:41 So what's up? 286 00:16:41 --> 00:16:43 How would we use that? 287 00:16:43 --> 00:16:44 It's going to be easy. 288 00:16:44 --> 00:16:48 We'll just match terms. 289 00:16:48 --> 00:16:49 Right? 290 00:16:49 --> 00:16:52 I can see, what's my formula, what should c_k 291 00:16:52 --> 00:16:54 be if I know the d_k? 292 00:16:54 --> 00:16:58 I'm given the right-hand side. 293 00:16:58 --> 00:17:01 We're just doing what's constantly happening, 294 00:17:01 --> 00:17:03 this three step process. 295 00:17:03 --> 00:17:04 You're given the right side. 296 00:17:04 --> 00:17:09 Step one, expand it in Fourier series now. 297 00:17:09 --> 00:17:13 Step two, match the two sides. 298 00:17:13 --> 00:17:14 So what's the formula for c_k? 299 00:17:16 --> 00:17:19 In this application, which by the way I had no 300 00:17:19 --> 00:17:20 intention to do this. 301 00:17:20 --> 00:17:24 But it jumped into my head and I thought why not just do it. 302 00:17:24 --> 00:17:28 What would be the formula for c_k? 303 00:17:30 --> 00:17:35 It'll be d_k divided by? k squared. 304 00:17:35 --> 00:17:37 You're just matching terms. 305 00:17:37 --> 00:17:43 Just the way, when we expanded things in eigenvectors, we'd 306 00:17:43 --> 00:17:46 match the coefficients of the eigenvectors, and that involved 307 00:17:46 --> 00:17:52 just the simple step, here it's d_k over k squared. 308 00:17:52 --> 00:17:53 Good. 309 00:17:53 --> 00:17:55 And then what's the final step? 310 00:17:55 --> 00:17:59 The final step is, now you know the right coefficients, 311 00:17:59 --> 00:18:01 add them back up. 312 00:18:01 --> 00:18:03 Add the thing back up, like here. 313 00:18:03 --> 00:18:10 Only I'm temporarily calling it u, to find the solution. 314 00:18:10 --> 00:18:11 Right? 315 00:18:11 --> 00:18:13 Three steps. 316 00:18:13 --> 00:18:16 Go into the frequency domain. 317 00:18:16 --> 00:18:21 Write the right-hand side as a Fourier series. 318 00:18:21 --> 00:18:28 Second quick step is look at the equation for each separate 319 00:18:28 --> 00:18:30 Fourier coefficient. 320 00:18:30 --> 00:18:34 Match the coefficients of these eigenvectors. 321 00:18:34 --> 00:18:35 Eigenfunctions. 322 00:18:35 --> 00:18:38 And that's this quick middle step. 323 00:18:38 --> 00:18:42 And then you've got the answer, but you're still in Fourier 324 00:18:42 --> 00:18:44 space, you're still in frequency space. 325 00:18:44 --> 00:18:48 So you have to use these, put them back to get the 326 00:18:48 --> 00:18:51 answer in physical space. 327 00:18:51 --> 00:18:51 Right? 328 00:18:51 --> 00:18:53 That's the pattern. 329 00:18:53 --> 00:18:54 Over and over. 330 00:18:54 --> 00:18:59 So that's sort of the general plan of applying Fourier. 331 00:18:59 --> 00:19:02 And when does it work? 332 00:19:02 --> 00:19:03 When does it work? 333 00:19:03 --> 00:19:07 Because, I mean it's fantastic when it works. 334 00:19:07 --> 00:19:13 So what is it about this problem that made it work? 335 00:19:13 --> 00:19:15 What is Fourier happy? 336 00:19:15 --> 00:19:18 You know, when does he raise his hand, say yes I can 337 00:19:18 --> 00:19:20 solve that problem? 338 00:19:20 --> 00:19:26 OK, what do I need here for this plan to work? 339 00:19:26 --> 00:19:29 I certainly don't need always just -u'', Fourier could 340 00:19:29 --> 00:19:31 do better than that. 341 00:19:31 --> 00:19:37 But what's the requirement for Fourier to work perfectly? 342 00:19:37 --> 00:19:40 Well, linear equation, right? 343 00:19:40 --> 00:19:42 If we didn't have linear equations we couldn't do 344 00:19:42 --> 00:19:45 all this adding and matching and stuff. 345 00:19:45 --> 00:19:47 So linear equations. 346 00:19:47 --> 00:19:51 Well, OK. 347 00:19:51 --> 00:19:54 Now, what other linear equations? 348 00:19:54 --> 00:19:56 Could I have a c(x) in here? 349 00:19:56 --> 00:20:01 My familiar c(x), variable material property 350 00:20:01 --> 00:20:03 inside this equation? 351 00:20:03 --> 00:20:04 No. 352 00:20:04 --> 00:20:05 Well, not easily, anyway. 353 00:20:05 --> 00:20:09 That would really mess things up if there's a variable 354 00:20:09 --> 00:20:14 coefficient in here then it's going to have its 355 00:20:14 --> 00:20:15 own Fourier series. 356 00:20:15 --> 00:20:18 We're going to be multiplying Fourier series. 357 00:20:18 --> 00:20:22 That comes later and it's not so clean. 358 00:20:22 --> 00:20:25 So we want, it works perfectly when it's 359 00:20:25 --> 00:20:28 constant coefficients. 360 00:20:28 --> 00:20:33 Constant coefficients in the differential equations. 361 00:20:33 --> 00:20:36 And then one more thing. 362 00:20:36 --> 00:20:38 Very important other thing. 363 00:20:38 --> 00:20:39 The boundary conditions. 364 00:20:39 --> 00:20:42 Everybody remembers now, it's a part of the message of this 365 00:20:42 --> 00:20:47 course is that boundary conditions are often 366 00:20:47 --> 00:20:48 a source of trouble. 367 00:20:48 --> 00:20:51 They're part of the problem, you have to deal with them. 368 00:20:51 --> 00:20:56 Now, what boundary conditions do we think about here? 369 00:20:56 --> 00:21:02 Well, fixed-fixed was where we started. 370 00:21:02 --> 00:21:04 So if we had fixed-fixed boundary conditions 371 00:21:04 --> 00:21:06 what would I expect? 372 00:21:06 --> 00:21:12 Then things would give me a sine series, possibly. 373 00:21:12 --> 00:21:14 Because those are the eigenfunctions we're used to. 374 00:21:14 --> 00:21:19 Fixed-fixed, it's sines that go from zero back to zero. 375 00:21:19 --> 00:21:24 Fixed-free will have some sines or cosines. 376 00:21:24 --> 00:21:27 Periodic would be the best of all. 377 00:21:27 --> 00:21:32 Yeah, so we need nice boundary conditions. 378 00:21:32 --> 00:21:38 So the boundary conditions, let me just say, 379 00:21:38 --> 00:21:40 periodic would be great. 380 00:21:40 --> 00:21:51 Or sometimes a fixed-free, are familiar ones. 381 00:21:51 --> 00:21:55 At least in simple cases can be dealt with. 382 00:21:55 --> 00:21:57 OK. 383 00:21:57 --> 00:22:04 So now, boy, that board is already full of formulas. 384 00:22:04 --> 00:22:09 But, let's go back to the start and say how do we 385 00:22:09 --> 00:22:13 find the coefficients? 386 00:22:13 --> 00:22:15 So because that was the first step. 387 00:22:15 --> 00:22:18 Take the right-hand side, find its coefficient. 388 00:22:18 --> 00:22:22 If we want to, just as applying eigenvalues, the first step 389 00:22:22 --> 00:22:25 is always find eigenvalues. 390 00:22:25 --> 00:22:29 Here, in applying Fourier, the first step is always 391 00:22:29 --> 00:22:31 find the coefficients. 392 00:22:31 --> 00:22:33 So, how do we do that? 393 00:22:33 --> 00:22:36 And at the beginning it doesn't look too easy, right? 394 00:22:36 --> 00:22:39 Because let me take the first guy, sin(x). 395 00:22:40 --> 00:22:43 Let me take an example. 396 00:22:43 --> 00:22:46 Particular S(x). 397 00:22:46 --> 00:22:49 The most important, interesting function, S(x). 398 00:22:50 --> 00:22:53 I want it to be an odd function, so that it 399 00:22:53 --> 00:22:55 will have only sine. 400 00:22:55 --> 00:22:57 And I should have two period, 2pi. 401 00:22:58 --> 00:23:01 So let me just graph it. 402 00:23:01 --> 00:23:08 So it's going to have coefficients, and I use b 403 00:23:08 --> 00:23:15 for sine, so it's going to have b_1*sin(x), and 404 00:23:15 --> 00:23:18 b_2*sin(2x), and so on. 405 00:23:18 --> 00:23:23 And so it's got a whole infinity of coefficients. 406 00:23:23 --> 00:23:24 Right? 407 00:23:24 --> 00:23:25 We're in function space. 408 00:23:25 --> 00:23:27 We're not dealing with vectors now. 409 00:23:27 --> 00:23:32 So how is it possible to find those coefficients? 410 00:23:32 --> 00:23:38 And let me chose a particular S(x) so I'll put, since it's 411 00:23:38 --> 00:23:45 2pi periodic, if I tell you what it is over a 2pi interval, 412 00:23:45 --> 00:23:47 just, repeat, repeat, repeat. 413 00:23:47 --> 00:23:52 So I'll pick the 2pi interval to be minus pi to pi here. 414 00:23:52 --> 00:23:57 Just because it's a nice way, and so that's a 2pi length. 415 00:23:57 --> 00:24:02 There's zero, I want to function to be odd across zero. 416 00:24:02 --> 00:24:04 And I want it to be simple, because it's going to be an 417 00:24:04 --> 00:24:07 important example that I can actually compute. 418 00:24:07 --> 00:24:09 So I'm going to make it a one. 419 00:24:09 --> 00:24:13 And a minus one there. 420 00:24:13 --> 00:24:15 So, a step function. 421 00:24:15 --> 00:24:18 A step function, a square. 422 00:24:18 --> 00:24:22 And if I repeat it, of course, it would go down, 423 00:24:22 --> 00:24:25 up, down, up, so on. 424 00:24:25 --> 00:24:30 But we only have to look over this part. 425 00:24:30 --> 00:24:33 OK. 426 00:24:33 --> 00:24:37 Now, well, you might say wait a minute how are we going to 427 00:24:37 --> 00:24:41 expand this function in sine. 428 00:24:41 --> 00:24:46 Well, sines are odd functions. 429 00:24:46 --> 00:24:48 Everybody knows what odd means? 430 00:24:48 --> 00:24:53 Odd means that S(-x) is -S(x). 431 00:24:56 --> 00:25:01 So that's the anti-symmetric that we see in that graph. 432 00:25:01 --> 00:25:04 We also see a few problems in this graph. 433 00:25:04 --> 00:25:11 At x=0, what is our sine series going to give us? 434 00:25:11 --> 00:25:14 If I plug in x=0 on the right-hand side I 435 00:25:14 --> 00:25:16 get zero, certainly. 436 00:25:16 --> 00:25:21 So this sine series is going to do that. 437 00:25:21 --> 00:25:24 And actually Fourier series tend to do this. 438 00:25:24 --> 00:25:26 In the middle of a jump it'll pick the middle 439 00:25:26 --> 00:25:27 point of a jump. 440 00:25:27 --> 00:25:31 Fourier series generally, it's the best possible, will pick 441 00:25:31 --> 00:25:33 the middle point of the jump. 442 00:25:33 --> 00:25:34 And what about at x=pi? 443 00:25:36 --> 00:25:39 At the end of the interval? 444 00:25:39 --> 00:25:41 What does my series add up at x=pi? 445 00:25:42 --> 00:25:47 Zero again, because sin(pi), sin(2pi), all zero. 446 00:25:47 --> 00:25:49 And that'll be in the middle of that jump. 447 00:25:49 --> 00:25:52 So it's pretty good. 448 00:25:52 --> 00:25:57 But now what I'm hoping is that my sine series is going to 449 00:25:57 --> 00:26:04 somehow get real fast up to one, and level out at one. 450 00:26:04 --> 00:26:06 We're asking a lot. 451 00:26:06 --> 00:26:12 In fact, when Fourier proposed this idea, Fourier series, 452 00:26:12 --> 00:26:17 there was a lot of doubters. 453 00:26:17 --> 00:26:23 Was it really possible to represent other functions, 454 00:26:23 --> 00:26:27 maybe even including a step function, in terms of 455 00:26:27 --> 00:26:31 sines or maybe cosines? 456 00:26:31 --> 00:26:33 And Fourier said yes, go with it. 457 00:26:33 --> 00:26:34 So let's do it. 458 00:26:34 --> 00:26:42 OK, so and he turned out to be incredibly right. 459 00:26:42 --> 00:26:43 How do I find b_2? 460 00:26:44 --> 00:26:48 Do you remember how to, I don't want to know the formula. 461 00:26:48 --> 00:26:50 I want to know why. 462 00:26:50 --> 00:26:55 What's the step to find the coefficient b_2? 463 00:26:56 --> 00:27:02 Well, the step is, the key point. 464 00:27:02 --> 00:27:03 Which makes everything possible. 465 00:27:03 --> 00:27:08 Why don't I identify the key point without which we 466 00:27:08 --> 00:27:11 would be in real trouble. 467 00:27:11 --> 00:27:17 The key point is that all these sine functions, sin(2x), 468 00:27:17 --> 00:27:22 sin(3x), sin(4x), are orthogonal. 469 00:27:22 --> 00:27:27 Now, what do I mean by two functions being orthogonal? 470 00:27:27 --> 00:27:31 Somehow my picture in function space, so my picture in 471 00:27:31 --> 00:27:38 function space is that here is, this is the sine x coordinate. 472 00:27:38 --> 00:27:41 And somewhere there's a sin(2x) coordinate and it's 90 degrees 473 00:27:41 --> 00:27:44 and then there's a sin(3x) coordinate, and then there's 474 00:27:44 --> 00:27:47 a sine, I don't know where to point now. 475 00:27:47 --> 00:27:51 But there is a sin(4x), and we're in infinite dimensions. 476 00:27:51 --> 00:27:56 And the sine vectors are an orthogonal basis. 477 00:27:56 --> 00:27:58 They're orthogonal to each other. 478 00:27:58 --> 00:28:00 What does that mean? 479 00:28:00 --> 00:28:03 Vectors we take the dot product. 480 00:28:03 --> 00:28:07 Functions, we take, we don't use the word dot product 481 00:28:07 --> 00:28:09 as much as inner product. 482 00:28:09 --> 00:28:12 So let me take the inner product of, the whole 483 00:28:12 --> 00:28:13 point is orthogonality. 484 00:28:13 --> 00:28:15 Let me write that word down. 485 00:28:15 --> 00:28:17 Orthogonal. 486 00:28:17 --> 00:28:19 The sines are orthogonal. 487 00:28:19 --> 00:28:21 And what does that mean? 488 00:28:21 --> 00:28:27 That means that the integral over our 2pi interval, or any 489 00:28:27 --> 00:28:34 2pi interval, of one sine, sin(kx), let's say, multiplied 490 00:28:34 --> 00:28:42 by another sine, sin(lx), the x is, you can guess the answer. 491 00:28:42 --> 00:28:47 And everything is depending on this answer. 492 00:28:47 --> 00:28:49 And it is? 493 00:28:49 --> 00:28:51 Zero. 494 00:28:51 --> 00:28:53 It's just terrific. 495 00:28:53 --> 00:28:55 If k is different from l, of course. 496 00:28:55 --> 00:29:00 If k is equal to l then I have to figure that one out. 497 00:29:00 --> 00:29:01 I'll need that one. 498 00:29:01 --> 00:29:08 What is it if sine, if k=l so I'm integrating sine 499 00:29:08 --> 00:29:12 squared of kx, then it's certainly not zero. 500 00:29:12 --> 00:29:16 I getting like, the length squared of the 501 00:29:16 --> 00:29:18 sin(kx) function. 502 00:29:18 --> 00:29:25 If k=l, what is it? 503 00:29:25 --> 00:29:27 It has some nice formula. 504 00:29:27 --> 00:29:28 Very nice. 505 00:29:28 --> 00:29:28 Let's see. 506 00:29:28 --> 00:29:32 Sine squared, do I need to think about sine squared kx? 507 00:29:33 --> 00:29:37 Sine squared kx, what does it do? 508 00:29:37 --> 00:29:39 Well, just graph sine squared x. 509 00:29:39 --> 00:29:45 What would the graph of sine squared x look like, 510 00:29:45 --> 00:29:48 from minus pi to pi? 511 00:29:48 --> 00:29:51 So it goes up, right? 512 00:29:51 --> 00:29:52 Doesn't it go up? 513 00:29:52 --> 00:29:54 And then it goes back down. 514 00:29:54 --> 00:29:55 OK. 515 00:29:55 --> 00:30:00 Sorry, I made that a little hard. 516 00:30:00 --> 00:30:03 Is that right? 517 00:30:03 --> 00:30:05 And then it keeps it up. 518 00:30:05 --> 00:30:06 Right. 519 00:30:06 --> 00:30:08 So, what's the integral of that? 520 00:30:08 --> 00:30:12 I'm not seeing quite why. 521 00:30:12 --> 00:30:16 The answer is its average value is 1/2. 522 00:30:16 --> 00:30:23 The integral of sine squared is 1/2 of the length. 523 00:30:23 --> 00:30:29 The whole interval is of length 2pi, and we're taking the 524 00:30:29 --> 00:30:31 area under sine squared. 525 00:30:31 --> 00:30:34 I may have to come back to it, but the answer would be 526 00:30:34 --> 00:30:36 half of 2pi, which is pi. 527 00:30:36 --> 00:30:37 Yeah, yeah. 528 00:30:37 --> 00:30:41 So you could say the length of the sine function 529 00:30:41 --> 00:30:46 is square root of pi. 530 00:30:46 --> 00:30:48 So these are integrals. 531 00:30:48 --> 00:30:51 You told me the answer was zero. 532 00:30:51 --> 00:30:55 And I agreed with you, but we haven't computed it. 533 00:30:55 --> 00:30:57 And nor have we really got that. 534 00:30:57 --> 00:31:00 So a little bit to fix, still. 535 00:31:00 --> 00:31:09 But the crucial fact, I mean, those are highly important 536 00:31:09 --> 00:31:12 integrals that just come out beautifully. 537 00:31:12 --> 00:31:16 And beautifully really means zero. 538 00:31:16 --> 00:31:19 I mean, that's the beautiful number, right, for an integral. 539 00:31:19 --> 00:31:23 OK, so now how do I use that? 540 00:31:23 --> 00:31:24 Again, I'm looking for b_2. 541 00:31:26 --> 00:31:32 How do I pick off b_2, using the fact that sin(2x) times any 542 00:31:32 --> 00:31:37 other sine integrates to zero. 543 00:31:37 --> 00:31:38 Ready for the moment? 544 00:31:38 --> 00:31:39 To find the coefficient b_2? 545 00:31:40 --> 00:31:44 I should, let me start this sentence and if you finish it. 546 00:31:44 --> 00:31:50 I'll multiply both sides of this equation by sin(2x). 547 00:31:51 --> 00:31:56 And then I will integrate. 548 00:31:56 --> 00:32:00 I'll multiply both sides by sin(2x), so I take S(x)sin(2x). 549 00:32:00 --> 00:32:04 550 00:32:04 --> 00:32:07 And on the right hand, I have b_1*sin(x)sin(2x). 551 00:32:07 --> 00:32:12 552 00:32:12 --> 00:32:13 And then I have b_2. 553 00:32:14 --> 00:32:16 Now, here's the one that's going to live through 554 00:32:16 --> 00:32:17 the integration. 555 00:32:17 --> 00:32:20 It's going to survive, because it's the sin(2x) times 556 00:32:20 --> 00:32:26 sin(2x) sin(2x) squared. 557 00:32:26 --> 00:32:30 And then comes the b_3 guy, would be b_3*sin(3x)sin(2x). 558 00:32:37 --> 00:32:40 Everybody sees what I'm doing? 559 00:32:40 --> 00:32:44 As we did with the weak form in differential equations, I'm 560 00:32:44 --> 00:32:47 multiplying through by these guys. 561 00:32:47 --> 00:32:51 And then I'm integrating over the interval. 562 00:32:51 --> 00:32:55 And what do I get? 563 00:32:55 --> 00:32:57 Integrate everyone dx. 564 00:32:59 --> 00:33:02 And what's the result? 565 00:33:02 --> 00:33:06 What is that integral? 566 00:33:06 --> 00:33:08 Zero. 567 00:33:08 --> 00:33:09 It's gone. 568 00:33:09 --> 00:33:11 What is this integral, the integral of 569 00:33:11 --> 00:33:12 sin(3x) times sin(2x)? 570 00:33:14 --> 00:33:15 Zero. 571 00:33:15 --> 00:33:21 All those sines integrate to zero, and I have to come 572 00:33:21 --> 00:33:27 back and see it's a simple trig identity to do it. 573 00:33:27 --> 00:33:29 To see why that's zero. 574 00:33:29 --> 00:33:32 Do you see that everything is disappearing, except b_2. 575 00:33:33 --> 00:33:36 So we finally have the formula that we want. 576 00:33:36 --> 00:33:42 Let me just with put these formulas down. 577 00:33:42 --> 00:33:46 So b_k, b_2 or b_k, yeah tell me the formula for b_k. 578 00:33:47 --> 00:33:50 Let me go back, here. 579 00:33:50 --> 00:33:53 What did b_2 come out to be? 580 00:33:53 --> 00:33:56 So I have b_2, that's a number. 581 00:33:56 --> 00:33:59 It's got this right-hand side. 582 00:33:59 --> 00:34:01 That's the integral that I mentioned. 583 00:34:01 --> 00:34:04 You'd have to compute that integral. 584 00:34:04 --> 00:34:07 And then what about this stuff? 585 00:34:07 --> 00:34:10 This sin(2x) squared? 586 00:34:10 --> 00:34:13 I've integrated that. 587 00:34:13 --> 00:34:16 And what did I get for that? 588 00:34:16 --> 00:34:20 This is b_2, and then this is some number. 589 00:34:20 --> 00:34:22 And it's pi. 590 00:34:22 --> 00:34:26 So this is b_2, and multiplying, right? 591 00:34:26 --> 00:34:29 That b_2 comes out, and then I have the integral of 592 00:34:29 --> 00:34:32 sine squared 2x, and that's what's pi. 593 00:34:32 --> 00:34:37 So that's b_2 times pi here, and I just divide by the pi. 594 00:34:37 --> 00:34:43 So I divide by pi and I get the integral from minus pi to pi 595 00:34:43 --> 00:34:52 of my function times my sine. 596 00:34:52 --> 00:34:59 That's the model for all the coefficients of 597 00:34:59 --> 00:35:02 orthogonal series. 598 00:35:02 --> 00:35:04 That's the model. 599 00:35:04 --> 00:35:11 Cosines, the complete ones, the complex coefficients. 600 00:35:11 --> 00:35:15 The Legendre series, the Bessel series, everybody's series 601 00:35:15 --> 00:35:18 will follow this same model. 602 00:35:18 --> 00:35:23 Because all those series are series of orthogonal functions. 603 00:35:23 --> 00:35:26 Everything is hinging on this orthogonality. 604 00:35:26 --> 00:35:31 The fact that one term times another gives zero. 605 00:35:31 --> 00:35:34 What that means, really. 606 00:35:34 --> 00:35:43 I want to say it with a picture, too. so let me draw 607 00:35:43 --> 00:35:46 two orthogonal directions. 608 00:35:46 --> 00:35:53 I intentionally didn't make them just x and y axes. 609 00:35:53 --> 00:35:58 This might be the direction of sin(x), and this might be 610 00:35:58 --> 00:35:59 the direction of sin(2x). 611 00:36:00 --> 00:36:05 And then I have a function. 612 00:36:05 --> 00:36:08 And I'm trying to find out how much of sin(2x) 613 00:36:08 --> 00:36:09 has it got in it? 614 00:36:09 --> 00:36:12 How much of sin(x) has it got in it, and then of course 615 00:36:12 --> 00:36:16 there's also a sin(3x) and all the other sin(kx)'s. 616 00:36:17 --> 00:36:25 The point is, the point of this 90 degree angle there is, that 617 00:36:25 --> 00:36:34 if I can split this S(x), whatever it might be, I can 618 00:36:34 --> 00:36:39 find its sin(x) piece directly. 619 00:36:39 --> 00:36:44 By just projecting it, it's the projection of my 620 00:36:44 --> 00:36:48 function on that coordinate. 621 00:36:48 --> 00:36:51 If you don't like sin(x), sin(2x), S(x), write 622 00:36:51 --> 00:36:54 v_1, v_2, whatever. 623 00:36:54 --> 00:36:56 To think of it as vectors. 624 00:36:56 --> 00:36:57 What's the sin 2? 625 00:36:57 --> 00:36:59 So that is b_1*sin(x). 626 00:37:01 --> 00:37:04 That's the right amount of sin(x). 627 00:37:04 --> 00:37:11 And the whole point is that that calculation didn't 628 00:37:11 --> 00:37:14 involve b_2 and b_3 and all the other b's. 629 00:37:14 --> 00:37:19 When I'm projecting onto orthogonal directions, I 630 00:37:19 --> 00:37:22 can do them one at a time. 631 00:37:22 --> 00:37:25 I can do one one-dimensional projection at a time. 632 00:37:25 --> 00:37:35 This b_ksin(kx) is the, so I'm just saying this in words, 633 00:37:35 --> 00:37:42 is the projection of my function onto sin(kx). 634 00:37:44 --> 00:37:49 And the point is, I could do this and get this 635 00:37:49 --> 00:37:52 answer because of that 90 degree angle. 636 00:37:52 --> 00:37:54 If I didn't have 90 degrees, do you see that 637 00:37:54 --> 00:37:55 this wouldn't work? 638 00:37:55 --> 00:38:02 Suppose my two basis functions are at some 40 degree angle. 639 00:38:02 --> 00:38:05 Then I take my function. 640 00:38:05 --> 00:38:08 Can I project that onto this guy? 641 00:38:08 --> 00:38:13 And project that onto this guy, so the projections are there? 642 00:38:13 --> 00:38:14 And there? 643 00:38:14 --> 00:38:20 Do they add back to the function that I started with? 644 00:38:20 --> 00:38:22 The given function? 645 00:38:22 --> 00:38:23 No way. 646 00:38:23 --> 00:38:26 I mean, these are much too big, right? 647 00:38:26 --> 00:38:30 If I add that one to this one I'm way out here somewhere. 648 00:38:30 --> 00:38:34 But over here, with 90 degrees, these are the two 649 00:38:34 --> 00:38:36 projections, project there. 650 00:38:36 --> 00:38:37 Project there. 651 00:38:37 --> 00:38:42 Add those two pieces and I got back exactly. 652 00:38:42 --> 00:38:48 I just want to emphasize the importance of orthogonality. 653 00:38:48 --> 00:38:52 It breaks the problem down into one-dimensional projections. 654 00:38:52 --> 00:38:55 So here we go with b_k*sin(kx). 655 00:38:56 --> 00:38:59 OK, let me do the key example now. 656 00:38:59 --> 00:39:01 This example. 657 00:39:01 --> 00:39:07 Let me find the coefficients of that particular function S(x). 658 00:39:08 --> 00:39:13 This is the step function, the square wave, S(x), let's 659 00:39:13 --> 00:39:15 find its coefficients. 660 00:39:15 --> 00:39:17 I'll just use this formula. 661 00:39:17 --> 00:39:22 OK, maybe I'll erase so that I can write the integration 662 00:39:22 --> 00:39:23 right underneath. 663 00:39:23 --> 00:39:24 OK. 664 00:39:24 --> 00:39:26 Oh, one little point here. 665 00:39:26 --> 00:39:30 Well, not so little, but it's a saving. 666 00:39:30 --> 00:39:35 It's worth noticing. 667 00:39:35 --> 00:39:42 The reward for picking off the odd function is, I think that 668 00:39:42 --> 00:39:46 this integral is the same from minus pi to zero 669 00:39:46 --> 00:39:48 as zero to a pi. 670 00:39:48 --> 00:39:51 In other words, I think that for an odd function, I get 671 00:39:51 --> 00:39:57 the same answer if I just do the integral from zero to 672 00:39:57 --> 00:40:03 pi, that I have to do. 673 00:40:03 --> 00:40:05 And double it. 674 00:40:05 --> 00:40:11 So I think if I just double it, I don't know if you 675 00:40:11 --> 00:40:14 regard that as a saving. 676 00:40:14 --> 00:40:18 In some way, the work is only half as much. 677 00:40:18 --> 00:40:21 It'll make this particular example easy, so let 678 00:40:21 --> 00:40:23 me do this example. 679 00:40:23 --> 00:40:27 What are the Fourier coefficients of 680 00:40:27 --> 00:40:29 the square wave? 681 00:40:29 --> 00:40:34 OK, so I'll do this integral. 682 00:40:34 --> 00:40:39 So from zero to pi, what is my function? 683 00:40:39 --> 00:40:42 My N from the graph? 684 00:40:42 --> 00:40:44 Just one. 685 00:40:44 --> 00:40:47 This is going to be a picnic, right? 686 00:40:47 --> 00:40:50 The function is one here. 687 00:40:50 --> 00:40:58 So S(x) is one, so I want 2/pi, the integral from zero to pi 688 00:40:58 --> 00:41:03 of just sin(kx)dx, right? 689 00:41:03 --> 00:41:10 Which is, so I've got 2/pi, now I integrate sin(kx), I 690 00:41:10 --> 00:41:15 get minus cos(kx), right? 691 00:41:15 --> 00:41:18 Between zero and pi. 692 00:41:18 --> 00:41:20 And what else? 693 00:41:20 --> 00:41:21 What have I forgotten? 694 00:41:21 --> 00:41:23 The most important point. 695 00:41:23 --> 00:41:27 The integral of sin(kx) k x is not minus cos(kx). 696 00:41:28 --> 00:41:34 I have to divide by k. 697 00:41:34 --> 00:41:36 It's the division by k that's going to give me 698 00:41:36 --> 00:41:41 the correct decay rate. 699 00:41:41 --> 00:41:41 2/(pi*k). 700 00:41:42 --> 00:41:45 Alright, now I've got a little calculation to do. 701 00:41:45 --> 00:41:49 I have to figure out what is cos(kx) at zero, 702 00:41:49 --> 00:41:51 no problem, it's one. 703 00:41:51 --> 00:41:54 And at the other point, at x=pi. 704 00:41:55 --> 00:41:57 So what am I getting, then? 705 00:41:57 --> 00:41:58 I'm getting 2/(pi*k). 706 00:41:58 --> 00:42:09 707 00:42:09 --> 00:42:13 With that minus sign, I'll evaluate it at x=0, I have 708 00:42:13 --> 00:42:17 one minus whatever I get at the top. cos(k*pi). 709 00:42:17 --> 00:42:21 710 00:42:21 --> 00:42:22 That's b_k. 711 00:42:22 --> 00:42:24 712 00:42:24 --> 00:42:32 So there's a typical, well not typical but very nice, answer. 713 00:42:32 --> 00:42:35 Now let's see what these numbers are. 714 00:42:35 --> 00:42:39 So let me take a 2/pi out here. 715 00:42:39 --> 00:42:44 And then just list these numbers. 716 00:42:44 --> 00:42:47 So k is one, two, three, four, five, right? 717 00:42:47 --> 00:42:51 Tell me what these numbers are for, let me put the k in here 718 00:42:51 --> 00:42:55 because that's part of it. 719 00:42:55 --> 00:42:56 So it's a constant, 2/pi. 720 00:42:56 --> 00:42:59 721 00:42:59 --> 00:43:03 At k=1, what do I get? 722 00:43:03 --> 00:43:03 At k=1? 723 00:43:04 --> 00:43:09 This is the little bit that needs the patience. 724 00:43:09 --> 00:43:15 At k=1, the cos(pi) is? 725 00:43:15 --> 00:43:16 Negative one. 726 00:43:16 --> 00:43:20 So I have net minus minus one, I get a two. 727 00:43:20 --> 00:43:25 I get a two over a one. k is one. 728 00:43:25 --> 00:43:30 Alright, that is the coefficient for k=1. 729 00:43:30 --> 00:43:33 Now, what's b_2, the coefficient for k=2? 730 00:43:33 --> 00:43:37 I have 1-cos(2pi), what's cos(2pi)? 731 00:43:39 --> 00:43:40 One. 732 00:43:40 --> 00:43:43 So they cancel, so I get a zero. 733 00:43:43 --> 00:43:43 There is no b_2. 734 00:43:45 --> 00:43:45 What about b_3? 735 00:43:47 --> 00:43:49 So now b_3, I have 1-cos(3pi). 736 00:43:49 --> 00:43:51 737 00:43:51 --> 00:43:52 What's the cos(3pi)? 738 00:43:54 --> 00:43:56 It's negative one again. 739 00:43:56 --> 00:43:57 Right, same as the cos(pi). 740 00:43:58 --> 00:44:01 So that gives me a two, and now I'm dividing by three. 741 00:44:01 --> 00:44:08 2/3, alright, let's do two more. k=4, what do I get? 742 00:44:08 --> 00:44:12 Zero, because the cos(4pi) has come back to one. 743 00:44:12 --> 00:44:13 So I get a zero. 744 00:44:13 --> 00:44:15 And what do I get from k=5? 745 00:44:15 --> 00:44:18 746 00:44:18 --> 00:44:25 1-cos(5pi), which is? cos(5pi) is back to negative 747 00:44:25 --> 00:44:29 one, so 1--1 is a two. 748 00:44:29 --> 00:44:31 You see the pattern. 749 00:44:31 --> 00:44:39 And so let me just copy the famous series for this, S(x). 750 00:44:40 --> 00:44:44 This S(x) is, let's see. 751 00:44:44 --> 00:44:48 The twos, I'll make that 4/pi, right? 752 00:44:48 --> 00:44:50 I'll take out all those twos. 753 00:44:50 --> 00:44:51 So I have 4/pi*sin(x). 754 00:44:51 --> 00:44:55 755 00:44:55 --> 00:44:58 I have no sin(2x), forget that. 756 00:44:58 --> 00:45:02 Now I do have some sin(3x)'s, how much do I have? 757 00:45:02 --> 00:45:12 4/pi*sin(3x)'s, But divide by three, right? 758 00:45:12 --> 00:45:14 And then there's no 4x's, no sin(4x)'s. 759 00:45:16 --> 00:45:19 But then there will be a 4/pi*sine, what's 760 00:45:19 --> 00:45:22 the next term now? 761 00:45:22 --> 00:45:23 Are you with me? 762 00:45:23 --> 00:45:27 So this is a typical nice example, an important example. 763 00:45:27 --> 00:45:29 Sine of what? 764 00:45:29 --> 00:45:33 5x divided by five. 765 00:45:33 --> 00:45:35 OK. 766 00:45:35 --> 00:45:37 That's a great example, it's worth remembering. 767 00:45:37 --> 00:45:40 Factor the 4/pi out if you want to. 768 00:45:40 --> 00:45:47 4/pi time sin(x), sin(3x)/3, sin(5x)/5, it's a beautiful 769 00:45:47 --> 00:45:49 example of an odd function. 770 00:45:49 --> 00:45:53 OK, and let's see. 771 00:45:53 --> 00:46:01 So what do you think, MATLAB can draw this graph far 772 00:46:01 --> 00:46:02 better than we can. 773 00:46:02 --> 00:46:07 But let me draw enough so you see what's really 774 00:46:07 --> 00:46:09 interesting here. 775 00:46:09 --> 00:46:12 Interesting and famous. 776 00:46:12 --> 00:46:15 So the leading term is 4 over pi sine x, that would 777 00:46:15 --> 00:46:18 be something like that. 778 00:46:18 --> 00:46:21 That's as close as sin(x) can get, 4/pi 779 00:46:21 --> 00:46:23 is the optimal number. 780 00:46:23 --> 00:46:24 The optimal coefficient. 781 00:46:24 --> 00:46:29 The projection, this 4/pi*sin(x) is the best, the 782 00:46:29 --> 00:46:32 closest I can get to one. 783 00:46:32 --> 00:46:34 On that integral. 784 00:46:34 --> 00:46:35 With just sin(x). 785 00:46:36 --> 00:46:40 But now when I put in sin(3x), I think it'll do 786 00:46:40 --> 00:46:44 something more like this. 787 00:46:44 --> 00:46:46 Do you see what's happening there? 788 00:46:46 --> 00:46:49 That's what I've got with sin(3x), and of course 789 00:46:49 --> 00:46:50 odd on the other side. 790 00:46:50 --> 00:46:52 What do you think it looks like with sin(5x)? 791 00:46:54 --> 00:46:59 It's just so great you have to let the computer draw 792 00:46:59 --> 00:47:00 it a couple of times. 793 00:47:00 --> 00:47:04 You see, it goes up here. 794 00:47:04 --> 00:47:08 And then it's sort of, you know, it's getting closer. 795 00:47:08 --> 00:47:13 It's going to stay closer to that. 796 00:47:13 --> 00:47:18 But I don't know if you can see from my picture, I'm actually 797 00:47:18 --> 00:47:19 proud of that picture. 798 00:47:19 --> 00:47:22 It's not as bad as usual. 799 00:47:22 --> 00:47:27 And it makes the crucial point, two crucial points. 800 00:47:27 --> 00:47:31 One is, I am going to get closer and closer to one. 801 00:47:31 --> 00:47:38 These oscillations, these ripples, will be smaller. 802 00:47:38 --> 00:47:42 But here is the great fact and it's a big headache 803 00:47:42 --> 00:47:45 in calculation. 804 00:47:45 --> 00:47:51 At the jump, the first ripple doesn't get smaller. 805 00:47:51 --> 00:47:57 The first ripple gets thinner, the first ripple gets thinner. 806 00:47:57 --> 00:47:59 You see the ripples moving over there, but their 807 00:47:59 --> 00:48:01 height doesn't change. 808 00:48:01 --> 00:48:04 Do you know whose name is associated with that, 809 00:48:04 --> 00:48:06 in that phenomenon? 810 00:48:06 --> 00:48:07 Gibbs. 811 00:48:07 --> 00:48:15 Gibbs noticed that the ripple height as you add more and more 812 00:48:15 --> 00:48:20 terms, you're closer and closer to the function over more 813 00:48:20 --> 00:48:23 and more of the interval. 814 00:48:23 --> 00:48:25 So the ripples get squeezed to the left. 815 00:48:25 --> 00:48:29 The area under the ripples goes to zero, certainly. 816 00:48:29 --> 00:48:32 But the height of the ripples doesn't. 817 00:48:32 --> 00:48:36 And it doesn't stay constant, but nearly constant. 818 00:48:36 --> 00:48:39 It approaches a famous number. 819 00:48:39 --> 00:48:43 And of course we'll have the same odd picture down here. 820 00:48:43 --> 00:48:47 And it'll bump up again, the same thing is happening 821 00:48:47 --> 00:48:49 at every jump. 822 00:48:49 --> 00:48:52 In other words, if you're computing shock. 823 00:48:52 --> 00:48:56 If you're computing air flow around shocks, with Fourier 824 00:48:56 --> 00:49:00 type method, Gibbs is going to get you. 825 00:49:00 --> 00:49:02 You'll have to deal with Gibbs. 826 00:49:02 --> 00:49:09 Because the shock has that extra ripple. 827 00:49:09 --> 00:49:12 OK, that's a lot of Section 4.1. 828 00:49:12 --> 00:49:15 Energy, we didn't get to, so that'll be the 829 00:49:15 --> 00:49:17 first point on Friday. 830 00:49:17 --> 00:49:19 And I'll see you this afternoon and talk about the 831 00:49:19 --> 00:49:21 MATLAB or anything else. 832 00:49:21 --> 00:49:22 OK.