So far we've dealt with constant forces, but now let's think about what happens when the force varies. So if the force varies, you will have to use an integral, is basically the short answer. So the work is the integral from some initial position to some final position. There's your displacement, initial to final, of the force dotted with some differential change, some differential displacement, okay? This is not a new formula for the work, this is just a more general formula for the work. The one we had before, F dot delta r displacement, was when the force is constant. If the force varies, you gotta do a bunch of little delta r's and add them up. That's what an integral is, right? So the best introductory way to show this is the mass on a spring. So let's imagine we have a spring here, and it's coiled up and compressed and pushing on a block and everything is frictionless. So the block is going to feel a spring force like that. Pushing it this way because the spring's natural length is there. When this position is here, the spring is natural length, no forces. We've pulled back, we know F equals -kx, so it's going to push that way. So as the spring pushes the block from one position to another, let's calculate the work it does on the block. All right, so to do that we need the force of the spring. Let's do full units here. Let's do full coordinate system x, y, z as usual. In the x direction, what is the force? According to Hooke's law for forces, its -k times the x position. It's really x minus, or it's the displacement from the natural length, but I put the natural length at the origin. So let's just call it -k times x, + 0 j hat + 0 k hat. We don't really need those. This is obviously one-dimensional, but will be complete. So we have F, we need dr. So dr, You can really just think of as the differentials in each dimension, right? It might move a little dx i hat, it might move a little bit of motion of the j hat dy plus dz k hat. So we brought in those other differentials, but when we take the dot product, they're going to go away. All right, because we care about F dot dr, right? So F dot dr, gone, gone, these are 0, 0, it's really just -kx dx. Don't need the unit vectors anymore, because we took a dot product. So now we just do our integral. The work equals the integral, and we need limits. So let's see, we're going to talk about the work as the spring pushes it to here. because then that's all it's going to push it, and it'll fly away. The spring will do whatever it wants to do. If it has no mass, it'll stop or keep going. We want to think about the work from here to here. So let's say it starts out at the position -d. Right, we're going to push it through a distance d. So it starts at -d and pushes to 0. So initial to final, it started at -d and pushed to 0, of -kx dx, all we've gotta do. Then you have to know how to integrate. So vector-based or physics-based calculus, hopefully you know how to integrate that. It is equal to- one-half kx squared. Evaluated from -d to 0, which we plug in 0 we get 0. Minus, we plug in -d, -d dquared is d squared. So- a- one-half kd squared. And, of course, that becomes positive to one-half kd squared. The work that the spring did on the object, right? So notice it's not just the force kx times the displacement d, right? That would be kdd or something, kd squared, right? The half shows up because it's an integral, because the force was big. But then as you add it up, the force is less and less, the work it's doing is less and less, so the half shows up. In general, if you wanted to write this, and really not do a specific case of a limit, you could also write it this way. You could say the work of a spring on a mass. You could say it's just one-half kx final squared. One-half kx initial squared. If you define those positions with respect to the rest length of the spring, where the forces are zero. Then you could always find one that way.