# Using a line integral to find the work done by a vector field example | Khan Academy

Let's apply what we learned in the last video into a concrete
example of the work done by a vector field on something
going through some type of path through the field.
So let's say that I have a vector field.
It's defined over r2 for the x-y plane.
So it's a function of x and y.
It associates a vector with every point on the plane.
And let's say my vector field is y times the unit vector i
minus x times the unit vector j.
And so you can imagine if we were to draw-- let's
draw our x- and y-axes.
I'll do it over here.
If we were to draw our x- and y-axes, this associates a
vector, a force vector-- let's say this is actually a
force vector-- with every point in our x-y plane.
So this is x and this is y.
So if we're at the point, for example, 1, 0, what will the
vector look like that's associated with that point?
Well, at 1, 0, y is 0, so this will be 0, i minus 1, j.
Minus 1, j looks like this.
So minus 1, j will look like that.
At x is equal to 2-- I'm just picking points at random, ones
that'll be -- y is still 0, and now the force vector here
would be minus 2, j.
So it would look something like this.
Minus 2, j.
Something like that.
Likewise, if we were to go here, where y is equal to 1 and
x is equal to is 0, when y is equal to 1, we have 1, i minus
0, j, so then our vector is going to look like
that at this point.
If we're to go to 2-- you could get the picture.
You can keep plotting these points.
You just want to get a sense of what it looks like.
If you go here, the vector's going to look like that.
If you go maybe at this point right here, the vector's
going to look like that.
I think you get the general idea.
I could keep filling in the space for this
entire field all over.
You know, just to make it symmetric, if I was here,
the vector is going to look like that.
You get the idea.
I could just fill in all of the points if I had to.
Now, in that field, I have some particle moving, and let's say
its path is described by the curve c, and the
parameterization of it is x of t is equal to cosine of t, and
y of t is equal to sine of t.
And the path will occur from t-- let's say, 0 is less than
or equal to t is less than or equal to 2pi.
You might already recognize what this would be.
This parameterization is essentially a
counterclockwise circle.
So the path that this guy is going to go is
going to start here.
Well, you can imagine, t in this case, you could almost
imagine is just the angle of the circle, but you can
also imagine t is time.
So at time equals 0, we're going to be over here.
Then at time of pi over 2, we're going to have traveled a
quarter of the circle to there, so we're moving in
that direction.
And then at time after pi seconds, we would have
gotten right there.
And then all the way after 2pi seconds, we would have gotten
all the way around the circle.
So our path, our curve, is one counterclockwise rotation
around the circle, so to speak.
So what is the work done by this field on this curve?
So the work done.
So the work, we learned in the previous video, is equal to the
line integral over this contour of our field, of our vector
field, dotted with the differential of our movement,
so dotted with the differential of our movement dr.
Well, I haven't even defined r yet.
I mean, I kind of have just the parameterization here, so we
need to have a vector function.
We need to have some r that defines this path.
This is just a standard parameterization, but if I
wanted to write it as a vector function of t, we would write
that r of t is equal to x of t, which is cosine of t times i
plus y of t times j, which is just sine of t times j.
And likewise, this is for 0 is less than or equal to t, which
is less than or equal to 2pi.
And this are equivalent.
The reason why I took the pain of doing this is so now I can
take its vector function derivative, and can figure out
its differential, and then I can actually take the dot
product with this thing over here.
So let's do all of that and actually calculate this line
integral and figure out the work done by this field.
We're going in a counterclockwise direction, but
at every point where we're passing through, it looks like
the field is going exactly opposite the direction
of our motion.
For example, here we're moving upwards.
The field is pulling us backwards.
Here we're moving to the top left.
The field is moving us to the bottom right.
Here we're moving exactly to the left.
The field is pulling us to the right.
So it looks like the field is always doing the exact opposite
of what we're trying to do.
It's hindering our ability to move.
So I'll give you a little intuition.
This'll probably deal with negative work.
For example, if I lift something off the ground,
I have to apply force to fight gravity.
I'm doing positive work, but gravity's doing
negative work on that.
We're just going to do the math here just to make you
comfortable with this idea, but it's interesting to think about
what's exactly going on even here.
The field is-- the field I'm doing in that pink color,
so let me stick to that.
The field is pushing in that direction, so it's always
going opposite the motion.
But let's just do the math to make everything in the last
video a little bit more concrete.
So a good place to start is the derivative of our
position vector function with respect to t.
So we have a dr/dt, which we could also write
as r prime of t.
This is equal to the derivative of x of t with respect to t,
which is minus sine of t times i plus the derivative of y
of t with respect to t.
Derivative of sine of t is just cosine of t.
Cosine of t times j.
And if we want the differential, we just multiply
everything times dt, so we get to dr is equal to-- we could
write it this way.
We could actually even just put the d-- well,
let me just do it.
So it's minus sine of t dt-- I'm just multiplying each of
these terms by dt, distributive property-- times the unit
vector i plus cosine of t dt times the unit vector j.
So we have this piece now.
And now we want to take the dot product with this over here,
but let me rewrite our vector field in terms of in
terms of t, so to speak.
So what's our field going to be doing at any point t?
We don't have to worry about every point.
We don't have to worry, for example, that over here the
vector field is going to be doing something like that
because that's not on our path.
That force never had an impact on the particle.
We only care about what happens along our path.
So we can find a function that we can essentially substitute y
and x for, their relative functions with respect to t,
and then we'll have the force from the field at any
point or any time t.
So let's do that.
So this guy right here, if I were to write it as a function
of t, this is going to be equal to y of t, right? y is a
function of t, so it's sine of t, right? that's that.
Sine of t times i plus-- or actually minus x, or x of
t. x is a function of t.
So minus cosine of t times j.
And now all of it seems a little bit more
straightforward.
If we want to find this line integral, this line integral is
going to be the same thing as the integral-- let me pick
a nice, soothing color.
Maybe this is a nice one.
The integral from t is equal to 0 to t is equal
to 2pi of f dot dr.
Now, when you take the dot product, you just multiply the
corresponding components, and add it up.
So we take the product of the minus sign and the sine of t--
or the sine of t with the minus sine of t dt, I get-- you're
going to get minus sine squared t dt, and then you're going
to add that to-- so you're going to have that plus.
Let me write that dt a little bit.
That was a wacky-looking dt.
dt, and then you're going to have that plus these two guys
multiplied by each other.
So that's-- well, there's a minus to sign here so plus.
Let me just change this to a minus.
Minus cosine squared dt.
And if we factor out a minus sign and a dt, what is
this going to be equal to?
This is going to be equal to the integral from 0 to 2pi of,
we could say, sine squared plus-- I want to put the t --
sine squared of t plus cosine squared of t.
And actually, let me take the minus sign out to the front.
So if we just factor the minus sign, and put a minus
there, make this a plus.
So the minus sign out there, and then we factor dt out.
I did a couple of steps in there, but I think you got it.
Now this is just algebra at this point.
Factoring out a minus sign, so this becomes positive.
And then you have a dt and a dt.
Factor that out, and you get this.
You could multiply this out and you'd get what we
originally have, if that confuses you at all.
And the reason why I did that: we know what sine squared of
anything plus cosine squared of that same anything is.
That falls right out of the unit circle definition of
our trig function, so this is just 1.
So our whole integral has been reduced to the minus integral
from 0 to 2pi of dt.
And this is-- we have seen this before.
We can probably say that this is of 1, if you want to
put something there.
Then the antiderivative of 1 is just-- so this is just going to
be equal to minus-- and that minus sign is just the same
minus sign that we're carrying forward.
The antiderivative of 1 is just t, and we're going to evaluate
it from 2pi to 0, or from 0 to 2pi, so this is equal to
minus-- that minus sign right there-- 2pi minus t
at 0, so minus 0.
So this is just equal to minus 2pi.
And there you have it.
We figured out the work that this field did on the particle,
or whatever, whatever thing was moving around in this
counterclockwise fashion.
And our intuition held up.
We actually got a negative number for the work done.
And that's because, at all times, the field was actually
going exactly opposite, or was actually opposing, the movement
of, if we think of it as a particle in its
counterclockwise direction.
Anyway, hopefully, you found that helpful.