Flash and JavaScript are required for this feature.

Download the video from iTunes U or the Internet Archive.

**Instructor:** Prof. Gilbert Strang

Recitation 10

The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To make a donation, or to view additional materials from hundreds of MIT courses, visit MIT OpenCourseWare at ocw.mit.edu.

PROFESSOR STRANG: So, shall we start, as always, just open for questions. About any topic. I listed again trusses, 1-D finite elements, grad, div, curl. And I should have squeezed in x+iy too, as the magic trick for finding solutions to Laplace's equation in 2-D. So those are all certainly topics that are in this part of the course. We didn't really get to 3-D, I'm sorry about that, where the curl comes in. Maybe I can say a few words about curl today. Anyway, questions. Discussion. Yes, thanks.

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: Ooh, let's see. So A^T A for a truss. That's a good question. Trusses, A^T A. I guess I don't know any magic tricks either, so one way is to construct A, or A transpose, and then just multiply. A second way to do it would be by the four by four bar element matrices, so go bar by bar. So four by four bar matrices, four by four. So those are already in the A transpose A form. They're little A element, A bar transpose A, jeez, this isn't a great as it should be. A element, but I don't know if that would be, so and then you pop those into their correct places. I don't think I know any great idea beyond that. I think you should really be ready to construct a matrix A, yeah. For a reasonably small truss, of course. And of course the other part of trusses, the fun part is to be able to recognize solutions to Au=0. Possibly by looking at the truss more than by solving Au=0. Yeah, any particular example? Of a truss that I should look at just to pin this down? Any favorite trusses? There was an exam question, what was it, a complicated truss? Let's just create a truss. And just think about it. Maybe I won't create the whole matrix A. Here's a truss. How's that for a truss? So it's got-- And let me put no supports on it. Just, there's a truss to think about. Probably we won't get to all the gory details but if you look at that truss, what's the shape of A?

Shape of the matrix A. I have a row for every bar. So one, two, three, four, five. And how many columns have I got, how many unknown u's, unknown displacements have I got? Eight. Two four, six, eight. So I would expect Au=0 would probably have how many independent solutions? Three. You don't know the exact rank, that's exactly true. There could be more than three, right. So to really pin it down you'd have to be sure you were right about that. So three, at least. And I guess here you could tell me the three solutions to Au=0. Three rigid motions. I could translate it to the right, I could translate it up, and you would know what the u is, so u translating to the right would be [1, 0, 1, 0, 1, 0, 1, 0], right? That's horizontal motion all the same, rigid motion. And we should certainly discover that if we created A for this truss, that Au was zero. And similarly vertical motion and the third one would be? Rotation, rotation. Yeah. So if I did the rotation around there, for example, this guy would-- this u would also be a [1, 0] here. This wouldn't move. So I'm putting in the four pieces that would go into u. This one, what would be the u for this, the displacement of that corner of the truss? In a rotation? So my rotation is just swing this whole thing around. Zero? [0, -1], I think. Right. Because it's not going to go out, it's going to go straight down, [0, -1].

And what do you think this guy is? [1, -1], let's see. It's going to go this way, so it's going to go forward and down. And I think you're right. One and negative one, yeah. I think that would be right. Yeah, then the truss, we could check each bar. That bar, for example, should not change length because the movement is perpendicular to the bar and I'm writing ones, but I really should write some much smaller number like .1 everywhere, or something just so that this isn't a very big angle. And it wouldn't change length to first order. So that that's maybe an example where we see the motions, but we didn't actually create A, and we should be able to create A, don't let me prevent you from thinking about A. Yeah.

AUDIENCE: [INAUDIBLE] Should those be ones, or should they be root two over twos?

PROFESSOR STRANG: Well, that's a good question and after many years I've figured out that they're ones. But it's a very good question. Let's just see why. Let's look at this bar to be sure it's not stretched. Right? So this guy is moving over by one, and this also by one, is my claim. And then this movement down doesn't stretch it to first order, yeah. So I needed to make those guys the same. I guess what I figured out is that if you're rotating around here, then somehow it's the x and y, is that-- Anyway. Whatever. So that gives us a chance to do a specific example. OK, but I've dodged the creation of A. Yep, thanks.

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: Sorry, the solution to A transpose A?

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: Yeah, I see, OK. So the reason I stopped here was that A transpose A will be singular. So I wouldn't, like, go ahead, go forward to A transpose Au=f. But if I put on some supports, then of course now all good. So now I have, what's now the shape of A? For this one. I now have this bar is now, forget it, right? This bar is just between two supports. So if we put it in the matrix it'll just be a row of zeroes. Nothing will happen, and we're better off to just knock it out. So I think, now I have, I now have four bars. And how many unknowns? Four: two there and two there. And, do you guess that it's stable? That truss? Yeah, that looks stable to me. So the four by four matrix would be invertible and then I could solve. Good point. Then, A would be four by four, A transpose would be four by four, C would be four by four in between. This is the case that-- I gave a name for this case. When I have a square matrix, do you remember the name just for the hell of it? Statically determinate. It's determinate because each step determines everything completely. Normally, if I have another bar there, now it would be five by four, and now I really have to do the A transpose C A to get to a four by four invertible. By itself, A would not be invertible. This is the more typical case, where you really have to put all three together. Right.

I hope you enjoyed the trusses part, though, and continue to enjoy them this evening. OK, I'll just keep moving to be sure that we cover any other topics. Yeah, thanks.

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: For this matrix?

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: For that truss? Oh my God. OK, let me see. Then can I do one row? OK, of course, you guys are responsible for much more. Alright, which row shall I do? Which bar? A diagonal bar? I knew you'd make it like, you could make up quizzes and I could just sit back here. OK, so let's take this diagonal bar, alright. And are we going to keep that supported, or not? Do you want to keep it supported? OK, so in this case then that end is not moving. So this will be in this, and this bar corresponds to a row of A. And how many non-zeroes will I expect in that row? Just two. Normally four, but I'm not getting any motion down here. So it'll just be two and if that's 45 degrees, shall we say, then that row, I think, would be what? Well, OK. Where do my non-zeroes appear? This is node number one with an H and a V. So I think we have zeroes. If that bar stretches-- The connection between displacement and stretching of this bar does not involve this guy. So I think it's zero and zero there. And now, what else is it? So now come the real numbers, which I believe to be cosine and sine of that angle. Because if I, how much does that bar stretch? I know that I'm looking for a cosine and a sine, and if this goes positively, then the bar does stretch. If this goes positively, that does stretch the bar so I'm expecting positive numbers there, like the cosine, square root of two over two, and the sine, square root of two over two.

Well, I dodged the bullet of getting the whole matrix, but maybe that would do it. Why don't we do this the top one? Yeah. Tell me the first, if that's bar one, what would be the first row of the matrix? OK, it involves both of these nodes. But the angle is zero. So that's going to be a little special. So if this goes out horizontally, I should really start with the first one. Is this goes horizontally it compresses the bar, I think we get a minus one there. If it goes vertically, that doesn't do anything. If this goes horizontally it does do something. If it goes vertically it doesn't. I'd say that would be the row of the matrix coming from the top. That would give me the stretching. You remember, I'm always going to, I think of multiplying this by u. I think of multiplying that by [u 1 H, u 1 V, u 2 H, u 2 V], and this top row should give me you u 2 H minus u 1 H, which is the stretch in bar one. So that would be a typical one, this would be at least typical of one where I do see a cosine and a sine. And let me just finally add, suppose this was not supported. OK, suppose that's not supported, now I've got a couple more columns to squeeze in. Maybe I can somehow do it here. Can I squeeze in the two more columns? So can you complete the top row of the matrix? Now I've got six columns. Because here's two, here's two, here's two more. What goes on the top row of a matrix now? Zeroes, because this is not affected by bar one. But it is affected by this bar. So it's going to show up in this row, and how will it show up? Two negatives, right. A negative cosine and a negative sine. and at 45 degrees I can't tell the difference. Because if these move forward, that compresses the bar. So the minus sign. So again, the rows add up to zero, as we expect when the bar is not touching a support. This is not touching a support, so it adds up to zero. OK, we'll have a truss problem this evening, but not a big messy one.

How about finite elements? You guys, do you like finite elements? I'm sort of hoping to make them attractive. I noticed a problem, just to give us some specific one to work on, and I don't remember that it was a homework problem. This is Section 3.1, number 18, asks about the equation u''=0. Well, we've talked about it in class. With u(0)=0 but u' of-- the slope equal zero at the other end. So what's the picture if I use linear elements? I don't remember how many I used in the problem. Well, it allows you to use N interior guys, one, two, up to N, and then another-- This will come in. Or that's the point. OK, so what's the finite element method, finite element matrix K for this-- So I want to do linear elements and I want to construct K. And, yeah, I guess. Oh, I haven't actually made anything happen to this problem. All zeroes is kind of slow going. u will be, the solution will certainly be zero. So maybe I'd better put in a load here to get some action. OK, well, yeah. So I proposed this question but now, is this a question to think about? I think that's a reasonable example to do. It's got the two types of boundary conditions. It's got the right-hand side f, it's got linear elements which means it's kind of doable by hand. And we kind of know what matrix to expect out of it. What matrix do we expect? What do I expect out of linear elements, do you remember the point about linear elements on equally spaced meshes? That just brought back our regular difference matrices.

So I'm expecting this stiffness matrix to be a difference matrix. Anyway, the point of this question is, OK, I have a hat function, I have a hat function, I've a hat function, a hat function, and is that the end? Is that the complete list of my trial functions? One more, right? Because this condition is, all my trial and test functions don't have to satisfy this. So I'm allowed, and should have, another guy there. A half hat for that one. You may say, don't let that clown into the finite element space but I think it should be. The solution won't use much of it. Because the solution is going to aim for zero slope. But it's going to need a little-- You see why it needs a little bit, something here? Because this thing has slope down. So if there's some of that in there, there better be somebody else to cancel it. If our approximation is going to have about zero slope. OK, so then. Can you construct a matrix K? Let's see, what's the (2,3) entry? So if I call this number one, this number two, oh, I've already numbered. So number two and number three, so that trial function against that one. What do I? What's my formula for the (2,3) entry of the stiffness matrix? It's some integral, right? And what do I integrate? I integrate, yeah. And I've got to have to remember. So I do, yeah, my weak form-- I've integrated by parts, so my weak form is the integral of u'*v'*dx equals the integral of f times. v dx. That's my weak form. I did two integrations by parts and the integrated term will go away. Because of those zeroes. OK, so K_(2,3) will come from this side when I'm using phi_2 and phi_3, because I'm taking the phis, the phis and the V's both the same hat function.

OK, so what do I get for that? phi_2' is? So this is it, and it overlaps this one. So when it overlaps this phi_2 is coming down and phi_3 is going up. And the slope is 1/h, let's say. So I think I'm integrating us a negative slope, is that right? Times a positive slope. And I'm really only integrating over one h interval. The two overlap only here, where this one's coming down and that one's going up. So I think-- dx. And the great thing is, of course, we have a constant. So I have minus one over h squared times h, I think minus one over h. That would be K_(2,3). That's a simple example. And then at the end we will see it, we'll see this one, I think we'll get some matrix. We'll have this 1/h outside, I think we'll have something like two, minus one; two, minus one; minus one and then only a one from the half-hat. I think it would be that matrix that would be K. I think. Maybe with more, greater size if we have a whole bunch of elements. But that pattern. You're pretty much into this? Yeah, I mean we're doing a lot in this course. I'm really grateful you guys stay with it, and kept to these new ideas, through doing exercises and so on. Because there's a lot here.

Well, I thought I'd put an example up, to open up, just to remind you what that language is about there. And to be ready for any question in that topic. Or any question whatever. So I jumped in with finite elements, but I'm ready also to talk about that area of the course.

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: Yeah. x+iy stuff, OK. Basically, any function of x+iy, yeah. Any function. So strictly, yeah, I mean a mathematician would say what, any function? That's, you've opened the door to crazy things saying that. So what I really mean is, we have these powers of x+iy, and then we have combinations of them. So the only requirement would be that if I want to take an infinite combination it should, the series should, add up to something. If it has a nice Taylor series then those are the best functions there are. Functions with nice Taylor series. I'll just say it. Having used those words. Suppose I take that function. There's a function, that's a function-- z is x+iy. But z is shorter to write. So it's not a polynomial, obviously. But it is a function of x+iy. Well, tell me this. Where does that function go wrong? So e^z is a function that never goes wrong, right? e^z, that series always converges. Can you tell me the series, if I expand that into a series, what series am I looking at? This is not on the exam, so to speak. Do you know one over one plus something, what's the series for that? Well the constant term, when z is zero is certainly a one. I think the trick, it's this is geometric series, and because it's a z squared it's that. That would be the geometric series. With constant ratio z squared. If I multiply that by that, 1 plus z squared times that, everything will cancel and I'll get the one. That's it. So there is a Taylor series for this function. Now, the reason I chose that example is, you could tell me, it doesn't converge if z is too large, right?

Is this an analytic function? Where is this a good function and where does it have problems? If z is less than one, and I really mean magnitude of z, so let me draw the z-plane. Here's the real part of z that you usually call x, and the imaginary part of z that you usually call y, because z is x+iy, and where will this series converge? It'll converge out as far as this circle. This is the Taylor series around zero. Right? The constant term I found at z=0. Then that series, this function, is great. It's an analytic function, everything, it gives us a solution to Laplace's-- This'll be, the real and imaginary parts of that will be the u and the s that solve Laplace's equation. Out to, at least in this circle. But something, there's a problem at the edge of the circle. Now, here's my point. If I think of one over one plus x squared, look at that for a minute. That function has no problems at all, right? One over one plus x squared, you can let x be anything? It's no trouble. But one over one plus z squared, when we look in the complex plane, ah, we find a problem. And where is the problem with this function? At z equals, so everybody's looking at this guy. There's a problem with that function at z=i. And it happens to be not an accident, it's right there on the circle. It's hiding in the complex-- it's not on the real axis. So the real person didn't notice it. But the complex person said ah, that's the problem. There's a singularity there, and of course it's called a pole, and people in so many parts of science are interested in that.

Is there any other place that there's a problem? At minus i. When z is minus i we'll also get a problem. So this is a function with two poles, those two poles and they're the reason that the series couldn't make it. Going out this way the series doesn't meet any problems. But the series always goes out in a circle, and the first circle, the first guy, the first problem it hits, the series stops converging. By the way, let me ask you a question. Suppose I instead did the Taylor series around this point? Now, what do I mean by that? That's the point one, let's say. What do I mean by that, the Taylor series around one? I'll rewrite the function as one plus, well now, what do I do? I want it in z minus one squared. Oh, gosh. I'm getting beyond what you will care about. Again, if I expanded, if I wrote the power series in powers of z minus one, what would it work in? And then I'll stop with this example. The circle would reach out until it hit a pole. And it can't make it past that pole. So it would be a circle of radius square root of two, there would be a circle there. If we were going to discuss, and this is really Chapter 5 of the book. I mention it, because you've got a book that explains this. If I thought the center of the universe was there, and then the poles are still here, the circle will make it out to those poles. So I can do Taylor series, I can sort of hook together Taylor series all over the place. And they'll all quit when they reach a pole, but when I put all those circles together I can get all the rest of the plane. OK, so that's something about, I don't know how I got onto that department, but it's amazing.

This, so the real and imaginary parts of that would be a flow, would give me a flow. I don't know if it'd be easy to compute it or not, maybe I won't tackle that here. But we could find the real part of that and the imaginary part of that, and we would have a genuine flow field. Satisfying Laplace's equation with the two orthogonal, the streamlines orthogonal to the equipotentials. We could totally do that example. OK, let me, yeah, thanks.

AUDIENCE: You say one test question is based on x+iy?

PROFESSOR STRANG: Yeah. Well, this sort of stuff. But, so u would be the, yeah that's right. Yeah, so a test question would be something like, one way or another, you would end up with a u, and an s, and the u+is, if they're a good pair, would be some function of this magic z. Yeah, yeah. That's right. So whatever. We know examples, of course. For example, this could be x squared minus y squared. And the s that goes with that is 2xy, and the function that's involved there when I throw in the i is simply z squared. OK, that would be an example where the real and imaginary parts of this give us the good u, its good friend s, and the picture of streamlines and equipotentials meeting at right angles. Just, a beautiful picture, all coming out of this function. So probably the quiz will have some other function. But you'll still have a u and an s and a function of x+iy. So if it's not this one, which I don't think it is. It won't be be this one.

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: Yes. Because first of all, I wouldn't have mentioned it if I was. And secondly, that's a little too messy, I think, to get a good handle of, to take the real and imaginary parts of that. It's not impossible, of course. We could completely do it. There'd be some ratio of two polynomials. Here we have just simple polynomials. OK, does that help with that question? Yeah. What else is on your mind? Any thoughts? Yeah, thanks. Curl, OK. Well, so I didn't really do three dimensions. But curl is important. And we did see, in two dimensions the key fact that all this stuff-- Let me just write down what the great connections are between these. Because I can't let the whole semester go without writing down that, what is it, the grad-- Is it the curl of a gradient? The curl of any gradient of u is always zero. Whatever it is. Whatever u is. And this comes from, let me put the other one down and then I'll just say why. The other one is like the transpose of this one. So if I transpose, so this is the zero operator. Curl times gradient gives the zero. So if I just transpose I still have zero. So if it's a transposed gradient, I have minus divergence, and actually if I transpose curl I get curl again. Of any, now I should put in, what should the curl act on? It acts on a w, I guess is. No, divergence w, it acts on an S, sorry.

OK, and the minus sign, of course, isn't going to matter because I've got a zero on the right-hand side. So S. Yeah, so if I take any field-- I mean this is like, real proper vector calculus. To check these, I call them identities and maybe sometimes people indicate an identity meaning it's always true for every u, or for every S. They'll use the triple equals sign. Just to say they're really equal. OK, so we could define the curl, but you've met it elsewhere and maybe this isn't the time to do that. What's the key fact, the key little math business that makes all these true? So there's sort of a formal math fact that makes them true. And then there's the physical understanding of gradients being directions out with no rotation. So the physical understanding of that. But the math, the formal math fact is the fact that the second derivative of u with respect to x and y is equal to what? It's equal to second derivative with respect to y and x, yep. So you would find if you wrote out all the terms here, or all the terms here, you would find that just by using that fact, they all cancel each other. And the book, of course, does that. So we simply didn't do 3-D in the vector calculus section. So I'll stop there with that, because it's really saying that the curl is tremendously important. It measures vorticity and flow, and it's-- Being able to-- You know that like, you take the Navier-Stokes equations? Well, the pressure and the velocity are the, I'd say primary variables or the natural quantities to measure, pressure and velocity for a fluid flow. But you could also use these identities to set up in terms of other variables. Just rewrite the equation and you get other things.

Mentioning Navier-Stokes and fluid flow reminds me to say, we keep using the example of Laplace's equation. And a person could say wait a minute, get beyond that. Right? So why are you always, when you teach finite elements, why do you always start with Laplace's equation? OK, well the main reason is it's the simplest one. It's the one where you can really see what's happening. More complicated equations would be for, like, elasticity, plane elasticity, or 3-D elasticity or other boundary value problems could be quite messy. But Laplace's equation is not totally a waste of time. First, it comes up when you have these scalar unknowns. And then it also comes up in numerical methods for Navier-Stokes. So the standard numerical method for Navier-Stokes, which would come in 18.086, ends up with Laplace's equation for the pressure. So to have a fast Laplace solver, as in today's lecture, pays off. So I'm just saying Laplace's equation is important in itself, it has the great advantage of being the simplest example we could possibly think of. It's the example where an x+iy trick works. And it actually comes up in serious big computations, because the equation for the pressure comes out to be a Laplace or a Poisson equation. Now. I kept going there. Yeah, thank you.

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: We did, as a MATLAB problem.

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: Sorry? And a first order, right.

AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: Huh. Yeah. I would do it the same way but it wouldn't be symmetric, of course. That was the point about that convection term, is-- The diffusion term would be just what we've done, right? The diffusion term was that second derivative. And what would it look like in, as long as we're close to, what would convection-diffusion in 2-D look like? Just, I mean part of your interest is pass 18.085 and get rid of it, right? But another part is like, these are problems that if you're in Course 16, Course 2, others, you're going to meet this. So the diffusion part is going to be, again in 2-D I'll have some minus u, well, I made it simple because I took c(x) to be one. It could have a c(x) in there. And what would the convection term look like? I'd have a velocity, in the x direction, say a V_x. And a velocity in the y direction, V_y. V_y times-- That's just a number. In the simplest case that would be my river is traveling, or my flow is traveling along, and equals zero. AUDIENCE: [INAUDIBLE]

PROFESSOR STRANG: Sorry? Yeah I don't know which way the river's traveling, actually. So those are just constants. They could have positive or negative signs. The V_x and V_y is the constant flow that's carrying, what am I doing here? The flow is flowing along, and if those are constants it's just flowing steady, steady flow. But it's diffusing at the same time. And this would bring in that same difficulties that we met in the MATLAB 1-D. So the MATLAB 1-D problem just didn't have a y. I don't care, yeah the sign I'm not worried about, it's just is that there, now I'm in 2-D. And what would I expect to see? I'd expect to see some trouble when V is large. When V is large, convection, this is convection down here. This is the convection part. And if V is large, then so that this should be a lower order term, is really fighting against this higher order term. I expect numerical difficulties, just the way we met. So anyway, if I did a MATLAB example, stretched it to 2-D we see a whole lot of interesting stuff. We'd see flow in, flow out, yeah. But I just can't do everything. But that would have a weak form, but your question about weak forms, weak form, when you have this anti-symmetric term for odd number of derivatives, is not quite as beautiful. But you have to deal with it, of course. Yep. OK, Ready for whatever. Any thoughts? Let's see, just have a look again at the list of problem topics. To see if anything occurs to you. I mean, not that it should. You know we're OK. I'm happy to call it a day on that, and time for dinner for everybody and see you at 7:30.

## Welcome!

This is one of over 2,200 courses on OCW. Find materials for this course in the pages linked along the left.

**MIT OpenCourseWare** is a free & open publication of material from thousands of MIT courses, covering the entire MIT curriculum.

**No enrollment or registration.** Freely browse and use OCW materials at your own pace. There's no signup, and no start or end dates.

**Knowledge is your reward.** Use OCW to guide your own life-long learning, or to teach others. We don't offer credit or certification for using OCW.

**Made for sharing**. Download files for later. Send to friends and colleagues. Modify, remix, and reuse (just remember to cite OCW as the source.)

Learn more at Get Started with MIT OpenCourseWare