# Lecture 8: Springs and Masses

Flash and JavaScript are required for this feature.

Instructor: Prof. Gilbert Strang

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 today we move to a topic I really like. It's the beginning of the applications. So the particular application that comes first will be springs and masses, a pretty classical problem. But what we're looking for is how do we model it, what's the main framework to look at a whole series of problems. So this is number one in the series and it's the most straightforward. Let me draw it with four springs connecting three masses. And let me fix both ends. So this will be a fixed-fixed picture. So the masses have some weight. The weight pulls the springs down. When there was no weight acting they were not stretched. The masses will stretch the springs. And the question is how much do those, we're looking for the displacements. How much does mass one go down? Mass two? Mass three? And of course, essentially the displacement here is zero and here is zero. I don't know if you can imagine these masses have acted so that the position before gravity was turned on was somewhere up here and then it came here. So this moved down by a distance u_1. Let's use u for the displacements. So if I look at this main picture here I have displacements, movements, u_1, u_2, u_3.

Now what happens physically? Important in every one of these examples to see what's happening physically. Of course, this one moved down by some u_2, this one moved down from its total rest position to u_3. These are not oscillating. Next week they'll start moving, time will enter. Here I'm just looking for a steady state. They come to rest, they stretch. So what's your feeling of what's going to happen here, somehow? The displacements look to me like they'll all be positive. What's the key equation going to be? That when this moves down it will stretch that spring. Hooke's Law will say there's a force, the spring pulls back. The spring pulls back with a force proportional to the stretch. So u_1, u_2, and u_3 are movements.

Here is a key question. What's the stretching in spring number two? So this is spring one, two, three and four. How much does spring number two stretch? u_2-u_1. A difference is coming in there. So let me put that up here. So stretching or elongation, I'll use two words, elongation I'll say sometimes because that starts with a letter e. So these are the elongations in the springs, in the four springs. It's the amount the spring stretches. Or what's the opposite of stretching? Compression somehow. Looks to me like this last spring, at least, is going to be compressed, and I'm not sure about the others. So we've got four springs. And each one has a stretching or compression, an elongation. And then there's a link then that you already told me. That e_2 is, just from the picture, e_2 is the difference between u_2 and u_1. Because the lower mass goes down by distance u_2, the upper mass by u_1 and spring is stretched by the difference u_2-u_1.

So that's a first key fact. So that expresses somehow a fact of geometry. Of sort of the way things are connected. The material properties of the springs have not got into the picture yet. But now Hooke's Law brings them into the picture. By stretching a spring that produces a force that pulls back. So we get, can I say, forces in the spring. And let me give those a name w. w_1, 2, 3, and 4. And then the link between the stretching and the force that it produces is-- So that's somehow where the properties of the material come in. So I have to say, what are the properties of the springs? So this will be Hooke's Law, this step. Hooke's Law for this particular application. And so I have to say these springs have spring constants.

So I haven't completed the description of the problem until I've told you about springs themselves and the masses. So the spring constants will be c_1, c_2, c_3, and c_4. And now what does Hooke's Law say? Usually this physical law in the middle we keep it linear. Of course, we all understand that if these springs were enormously stretched the elastic property could become non-linear. It could become plastic. The first law always has somebody's name. Was the person to see that in some range of small displacements, so I guess that's the answer. We're speaking here about small displacements, small stretching up to the point where Hooke's Law continues to hold. And now what does Hooke's Law say? It says that each force in the spring is proportional to the stretching of the spring. You could say it's-- a diagonal matrix is showing up here. The vector of w's, the vector of forces in the spring is a diagonal matrix C, which just has these numbers on the diagonal, ...c_4, times the e's. So of course I'm going to write that in matrix notation as W equals a matrix C times e.

So there in the middle is the physics. The material properties, the constitutive law. C can stand for constants, for constitutive law, later for conductances. It's the place where the material enters. And now how do we complete this picture? In the end we have to bring in the masses. Gravity is the external force that's making things happen. We need a force term from outside to move us away from zeroes. And that will be the downward forces f_1, f_2, f_3 on the three masses. So I plan to complete this picture with a force balance equation on the masses, on each mass.

When I use the word framework there, this is what I was talking about. I guess what I want to say is I really have found that this way of describing, modeling the problem is successful for so many applications. You have somehow a geometry, a step which'll involve a matrix A. Then you have a physical step which involves a matrix C. And then finally you have a force balance. In a way this force balance or its analog, the analog would be Kirchhoff's current law. We'll see that for networks. Flow in equals flow out. Force on one side equals force on the other. If we're talking about equilibrium we can expect our model to have an equation like that. And for me it really helps to know when a new model comes in. Like somebody'll come into my office with a problem in chemistry or biology. But if it fits in this framework I'll be looking for a balance equation, a continuity equation at the end.

This part was easy and it's these two parts that I want to pin down. Well you told me how to start here. So the elongation, so I want to take this step again. I want to find the elongations from some matrix that multiplies the displacements. So I'm just completing this step. And you told me what is the stretching in spring two. Again, do you mind just saying it again? The stretching in that second spring, the amount, it's made longer by the action of gravity was? u_2-u_1. u_2-u_1. So e_2 will be, a minus one here for u_1, a plus one and a zero. That will be a typical row of this matrix, the displacement stretching matrix, you could say.

Now what about the stretching in e_1? What's the stretching in e_1? Only u_1. Because essentially it's u_1-u_0 but u_0 is set to zero by the support. So we only have u_1. Because that multiplication just gives us-- So e_1 is u_1. e_2 is u_2-u_1. e_3 is what? The stretching in the third spring. What is it? u_3-u_2. So I need a one for u_3 and a minus one for u_2. And the stretching in the fourth spring? What's the stretching in the fourth spring? I've sort of, and you have too, mentally given a plus sign when the spring is extended and a minus sign when it's compressed. Plus for tension, minus for compression. So since I fixed that one, u_4 was zero, so what do I have in this last row? Just minus u_3.

I guess what I'm saying here is that if we get a systematic approach to problems then we know we're looking for a matrix that connects these. We're looking for the material constitutive law that does this and now we're looking for this one. We kind of know where we are. What to look for. And so this matrix is the matrix I'm going to call A. So this is e=Au. Well one more step to go. And that will be the force balance step. So now, what's the equation for balance? The external forces are the masses. Well, I guess to get the units right, it should be mass times g, the gravitational constant. So let me put external forces f_1, f_2, and f_3. The three masses will be m_1*g, m_2*g, and m_3*g. So those are the forces from outside. Now it's the balance equation I'm after. So this is in this position. It's in equilibrium. And what does that tell us? That tells us that the total force on this mass, so I'm going to take each mass, it's like a free body force diagram here. I'm looking now at that mass. I'm saying what forces are acting on it and I'm making them balance. So what equation will that give me?

So let me write that. This is now the force balance equation. Force balance at each mass. How much force is pulling up? What's the force pulling up on? So this spring is pulling upwards. And it's pulling upwards by w_1, right? Just getting these letters right. The w's were the internal resisting force, reacting force in the spring. w_1 is pulling up. What other forces are acting? w_2 is pulling down. And also pulling down is? Gravity, m_1*g. So the balance of forces there says that w_1, the force up, is w_2, the force down, and m_1*g. And similarly the next one will have, the next mass if I look just at that I see a force up, a force down and gravity down. So w_2 will be, well, that's the pull up, will be w_3+m_2*g. And the third one, the force up on the third one will be the force down on the third one. so I think those are the equations of force balance written one at a time.

And now, of course I'm going to write that-- So that's three equations with four w's. So I want to write that as, I want to bring the w's all to the left-hand side. Can I do that? Can I just bring those over with minus signs? And make these equal signs. So now we've got internal force balancing external force. This vector of external forces is the f's and this is the internal forces. Now somewhere there we're going to see a matrix.

So I'm going to write this equation as some matrix. Well, let's figure out what that matrix is. So its shape is what? I've got three equations, so I need three rows in the matrix. I've got four w's so I need four columns. So it's going to multiply w_1, w_2, w_3, w_4 to give these three masses, can I call them f_1, f_2, f_3, just to have a good letter. We're almost there. What's the matrix? What's the matrix for this final step, the force balance equation? I just read it off. w_1-w_2. I think I've got that. w_2-w_3. Tell me what the second row of the matrix looks like to give me w_2-w_3. zero, one for the w_2, minus one. Good. And for the third, the final row? [0, 0, 1, -1]. So that completes the third piece. If I'd given you the problem as I did, drawn the problem, described it, you know that there's going to be a connection between the external forces and the displacements.

But what I'm trying to say is a good way to see the connection is to see it in three simple steps. The simple step that gets you from the displacements to the springs. A second step within the springs. A third step back to the nodes, you could say, back to the masses. And of course, the key question is, what's that matrix? And do you recognize it? Do we need a new name for that matrix? The matrix in the third step? So this third step is going to be that some matrix times w is f and what's that matrix? What's the good name for us to give it? A transpose is the best possible name. If we've given this matrix the name A, the stretching displacement matrix, the strain in elasticity, this becomes the strains, these become the stresses. But the beauty is, just beautiful, that the matrix in this law is the transpose of this one. So it's A transpose.

So that's the framework seen now here for the first time. So the key point was that A and A transpose both appeared but with physical material properties, constitutive matrix in between. So if we put the pieces together, then we're golden. And then, let's do an example to see what actually happened. So the equations were e=Aw-- e=Au, then w=Ce, that's Hooke's Law, and then A transpose-- or maybe I'll write it as f=A transpose*w. That's the three steps. So in this problem the source term showed up at that point. The source term came from external forces. I've got three equations. Now I'm going to put them together into one. I'll put them into one equation. So this w I'll just substitute. So it's A transpose w is Ce, and e is Au. So I have A transpose C Au.

So that's the ultimate. That's put the whole structure together. That's the equation you have to solve. This would be called the stiffness matrix. And I use the letter K for that one. So our equation is Ku=f. This is our final equation. Well, we didn't know w. There are two unknowns here. Two physical things that you want to find. If you're designing a bridge or a structure you want to know the displacements and then you want to know the internal forces w. It's really beautiful. The two unknowns of u and w are somehow dual, we can work with one, work with the other, work with both. Oh let me just mention that the finite element method will fit this framework and somehow this name stiffness matrix has become famous for finite elements in structures and then it's just exploded to appear all over the place.

I guess we should look at A transpose C A. We can see what it looks like. And also just from the way it looks there. So I can write it out explicitly. I think we want to. But at the same time I can learn something from just seeing how it's put together. What can you tell me about A transpose C A? Let's get the shape first. Just to see the shape of these things. The matrix A is what? What's the shape of A? It's over here. Four by three. Four by three. And the shape of C was, three by three is it? Where have I got, that C matrix better be here somewhere. Oh, no, it's four by four. Four springs. Of course, it had to be four by four to do that multiplication. There's the C matrix. Four by four, thanks. And the A transpose matrix? Three by four, thanks. So the net result is three by three. Good. So it's a square matrix. K is a square matrix.

What else can you tell me about it? Now we're going to begin to use some of the, sort of the matrix preparation. These matrices are kind of friends by now. This is a difference matrix, somehow. Right? The stretchings are differences and displacements. That's its transpose. And then the C matrix, which is the new thing, sort of the new guy to appear today, is diagonal. Well if I asked you now, without writing out the matrix, for one more property, it's square, what else could you tell me about it? Symmetric is going to be a very good guess and let's see why. Why is it symmetric? How do we show that that? What do I do? I take the transpose. If I take my K transpose, now I write it as, what do I do? It's a product of things. So when I transpose a product I have the individual transposes in the opposite order. So A, its transpose comes first. C, its transpose comes next. A transpose, its transpose comes last. So that's just the rules of matrix transposes.

Now what? Now I'm ready to use the wonderful fact of what we've got here. So what is C transpose? So notice we wanted a symmetric matrix in the middle to be able to knock that T out. And what is A transpose transpose? That's A. We've learned that the thing is symmetric, that if I transpose it I get it back again. We're going to see more about that.

But let me do the multiplication. So I'm going to take that, oh, boy. How am I going to do that? I want to multiply three matrices to see what K actually looks like here. One question first. Eventually the solution, the short formula for the solution, will be u equal K inverse f. Right? So the answer will be u equal K inverse f in matrix notation but I'm looking for numbers. And then if I know u then I know the stretching. e is A times K inverse f. And w is, I'm just going down the list, is C times A times K inverse f. We've got everything. So that's the key. This is the key equation. That's the answer.

Let me ask you about inverses. What about K inverse? We took three steps. Now what if I just ask you about inverses? This is K inverse that we would like to know. So again, for inverses I'm going to start this and I'm going to stop halfway and you'll tell me why. If you give me a product of matrices and I don't think particularly much I'll take the inverse of that times the inverse of that times the inverse of that. And what's the matter with that? You would say, why not just undo each step? Why not find the w's from the f's and then the e's from the w's by dividing and then the u's from the e's? Why don't we just go backwards around the loop rather than what I'm saying we have to do. We eventually get this step across with a matrix K that does all three at once. Well sometimes we might be able to, but I don't think we can in this time.

What's the trouble with A, that I don't want to write A inverse? Well I don't say singular. What do I say here? Look at this matrix A here. It's not square. It's not square, that's right. So I'm not comfortable, I'm not willing to write A inverse when A is not a square matrix. And this distinction, is the matrix A square or not, is the first issue. It's just the picture.

Let me show you an example of where it would be square. May I? Before I do this multiplication, can I jump to a-- I'll change the line of springs in a way that'll change A. And let me show you what happens. Suppose I take out that spring. So I've removed the fourth spring. It's a line of springs now, hanging from a support. It's a perfectly good problem. It's problem two, but it's a different problem. And what's different now? There is no fourth spring. If this was my problem, what would be different? There's no fourth spring. So that's gone. I just have three springs stretching from three masses. Then the force balance is the same. Everything looks the same except there's no force, there's no fourth spring, so there's no force there, that's gone. And of course, how does C change? So in my new picture now I have, let me write now, A transpose C A. A is now three by three, right, I've lost a row. A transpose is now three by three, I've lost a column, that fourth spring is gone. And what is C? Well of course there's no guy here anymore.

What I'm trying to say is for this problem the matrices have become square. This would be correct. So this is an especially nice kind of problem. It's called statically determinate. It means I can determine the three w's from the three f's. I can go backwards. Everything is determined. The long word for the fixed-fixed one, our main example, is statically indeterminate. I cannot determine four w's from three forces. I can't determine what these internal forces are until I put the whole loop into one matrix K. So that's like a warning, and at the same time, an important separation. A few nice problems where you don't have too many springs, you don't have too many bars in a truss. You just have like, the minimum number to hold it together. Could be statically determinate and square matrices. But here we're not square.

Now I go back. So that would be fixed-free. Right? That example that I just described would be fixed-free and we can kind of carry that along because we know that what happens is we lose a row and a column and a-- c_4 is just not in the picture anymore. But now I want to go back to the fixed-fixed one and finish it. So that's got a support down there, too. Key question, what's this matrix K? This A transpose C A. We know it's a square matrix, we know it's a symmetric matrix, but it would be really nice to know what does it look like.

What does that matrix look like? Can I do the multiplication? So this is going to be K. So it starts with a three by four. 1, -1; 1, -1; 1 -1. Then it's got the four by four, c_1, c_2, c_3, c_4. And then it's got the transpose of that, which is the 1, -1; 1, -1; 1, -1. With zeroes where I didn't write anything. We've got three matrices to multiply together. What's going to happen here? Well, let's see. I guess, why don't I multiply that by that? Can I do that? So that's like getting two steps together. It's going to be easy because of this. This is usually an easy matrix. Often diagonal. So when I do that multiplication, so let me, I'll just copy this guy. And now c_1 multiplies that row, c_2 multiplies this row, c_3 multiplies this row and c_4 multiplies the last row. c_1 in that row, c_2, c_3, and c_4. And now I'm ready to put those together into K. So K will be three by three. What does it have? It has c_1+c_2. And then next to that is going to be this row one against column two, there'll be a zero or they'll be a -c_2 here. And then when row one goes against column three there's nothing.

Why nothing? When do I expect to see a zero in the overall matrix? What is it about? So that zero is in the position 1, 3. What is it about masses one and three that is putting that zero in there. We kind of expect to see that zero even before we find it. If I look at the picture, what do you notice about masses one and three that is going to produce the zero? They're not connected. They're not connected. If I had another spring, which I could have, connecting mass one to mass three that would produce, I'd have another. I'd be up to five. Instead of four, there'd be a fifth spring. It would have its own constant. It would show up. Absolutely could. Here we don't have it.

Now let me keep going. I know from symmetry that the second row times this is going to be zero, is going to be -c_2. Symmetric as I expected. What are you expecting on the diagonal there? c_2+c_3. That's certainly the right pattern. Zero, c_2+c_3. c_2+c_3. And what are you expecting over here? -c_3 is a good guess. It's seeing that pattern. Let's just see it happen. That second row times this third guy will give me zero, two rows, two zeroes, and then a -c_3, good. And now we know the zeroes going to show up here, the -c_3 is going to show up here. And what will show up here? c_3+c_4. So we've got it. That's the matrix K that controls this whole problem.

Now we check. It's square, yes. It's symmetric, yes. And notice also it's the kind of matrix we've seen already. In fact, it's exactly the matrix we've seen already Suppose all the c's are one. Suppose every c_1, c_2, c_3, c_4 is one. Then what's the matrix capital C in that standard case? C will just be the identity if these are all ones. And then I'm only left with A transpose A. So let me take that special case below it. Special if so this is if C is I, what matrix do we have then? Just to see that we have a matrix that we know about. So I'm copying this now here in the case when all the c's are one. So if you put all those c's to be one, what matrix do you get? You get, yes. You get the special K. Right, you get the special. So the work we did to understand that special matrix pays off here. Because we know how that matrix works. And this matrix, well, it's got four spring constants in it. But we can guess the important facts about this one from this one.

So what are the important questions about that matrix? This is my matrix K now. What would be, we know it's square, we know it's symmetric. What else do we ask about a matrix? Well, positive definite, that's the perfect question, right. And built into positive definiteness would be a property that we mentioned the very first day. Is it invertible? What's your guess? Is that matrix invertible? Everybody's going to guess yes because, if you guessed no, where would you be, the whole course would end. In fact, the world would end because the problem is correctly posed. Those displacements are determined by the forces and that just says K is an invertible matrix. So but how do we see that it's invertible and, even more, positive definite, because that's the property we now know.

So why is that matrix positive definite? Do we want to check determinants? We could say, okay, that guy's positive. We could evaluate this product and find that it came out well. Would you want to do that one? We could probably do the two by two determinant. Could you take that times that and subtract that? Let's just write it above what we would get. Just to see it. That number times that number would be a c_1*c_2 and a c_1*c_3 and a c_2*c_2 twice. And a c_2*c_3. And then I would subtract off this guy. So it would knock out that, right? And it would leave something that would be positive. All the spring constants are positive here. We're talking normal materials.

I guess, actually, people are producing now really amazing materials with amazing properties. And the amazing property is a material with a negative c. But that's like-- 18.085 does not allow such a thing. Right? All these c's are positive. And you might guess that the whole determinant is positive. But now I'd like you to tell me why. So now we can use our growing familiarity with matrices to say why is this matrix positive definite. Is symmetric, of course. Positive definite. Why? So that's what the previous lecture helped us to answer.

We've got these various tests, but what was the core idea of positive definiteness? The core idea was positive energy. The core idea was I looked at the energy x trans-- no, u, sorry. Have to call it u now. u transpose times that matrix times u. And there was a reason why that matrix was, why this number, it's going to be a number, right? This combination will involve all four of these c's, it'll involve three u's. I don't want to write out that quantity. It would be, I'll have some u_1 squareds and some u_1*u_2. I won't have any u_1*u_3, because that 1, 3 entry is zero. But why was this positive? Where do I put the parentheses. Where do I put the parentheses to see that that's positive? I put them around where? Around that, good. And around this? This is really, since we now have a letter for Au, this is really e transpose Ce, right? That's e. This is e, Au, and this is its transpose. And now what? So now we've narrowed it down to C.

Oh, we can actually see why it's an energy. Remember C is that diagonal matrix. What will this be? This is the row of stretchings, the diagonal matrix of c's, and the column of stretchings. And now if I do that multiplication, what do I get? Do you see it? Because the physics is coming in. What do I get? This will multiply that. So what's the first term I should write here? e_1? What will it be? I only have diagonal. In other words, I only have perfect squares when I look at this thing. I think I just have c_1*e_1 squared coming from that diagonal. That c_1 there, this e_1 here, this e_1 there is going to give me that c_1-- What else will I have? c_2*e_2 squared, c_3*e_3 squared and c_4*e_4 squared.

And do you remember about springs and Hooke's Law and energy? What's the energy in a spring? This is a stretched spring. So the energy in a stretched spring, what I wanted to say, this is the sum of four internal energies in the four springs but it properly should have a factor 1/2. There probably, to really use the word energy properly, it should be half of all this, half of all this, half of that's the energy in the first spring, the energy in the second, the energy in the third and the energy in the fourth. But of course our matrix point was, it's positive. It's a sum of squares multiplied now by these positive numbers, these elastic constants, c_1, two, three and four.

So we know the main facts about that matrix. We're really at the point here of we've got some problem formulated, we've got the essential facts about the matrix, it's symmetric, positive definite, certainly invertible. Then there'd be the step of actually computing u by solving the stiffness equation. Say, for example, Professor Bathe's big finite element code, ADINA. What's the big picture for ADINA, for any big finite element code? NASTRAN, ANSYS, whatever. Abaqus. There are so many really good ones. And they've taken years and years of work to create. But if you look to see what are the elements that go in, you choose the model, and we'll see in the next chapter, in October we'll see what finite elements is about, you have the material properties, you assemble the matrix K.

That's a key step, is assembling this matrix K. And then the final step is solve the system. Ku=f. But it's assembling that matrix. Now one thing popped into my head. Do I have time to mention it or not? And there's no class Monday I think, right? Can I mention? Can you hang on one more second to mention a really remarkable way to do matrix multiplication. You may say, we know matrix multiplication. We got it. Right? We did it and we got the right answer. Can I just show you another way. And you can like, see if it works. I did this multiplication by like, I'll say rows times columns. I took rows times columns. That's the usual way. But finite elements and other, often the right way is the opposite. It's columns times rows. And of course, this guy's in here too. You might say, okay, what do I get from column one times that number, times row one? Can you do that multiplication just mentally? Multiply that column by that row. First of all, what shape will the answer have? What shape will the answer have if I multiply a three by one times a one by three. Three by three. It's a full matrix. Columns times rows. And it's a totally legitimate way to multiply matrices. That column times that row will be? Well you can see what will it be.

And then the c_1 is going to come into it. If I just did those multiplications, it would just be that. And then the c_1 puts that there. What do I see there? I see the element matrix. Do you see that this is the piece that involved c_1 in the answer? Well I guess you'll see it better when I do column two times c_2 times row two. So I have to add that guy on. And then I'll leave the other. What do I get if I do that column, three by one, times itself as a row times the c_2. I don't know if you see what I'm going to get. If you just do that, you'll see a c_2 will appear here. And a -c_2 will appear there. And these will be zeroes. So this was column one times row one. This is column two times row two. And third and then the fourth. But do you see that this part is telling me all about the second spring? This part is telling me, what does the first spring, the c_1, contribute to K. This part tells me what does the c_2 part, do you see the c_2 part in K? There, there, minus there and minus there. The third part from the column row would be the c_3 part. And the fourth part from the fourth spring would be the c_4 part. So that's a way you won't have thought of. But it's the way ADINA would assemble this matrix. It would not do that multiplication. It would do it this way, columns times rows. We'll see it again. So, hope you have a great weekend and a holiday Monday that we all happy about.