If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Line integrals in a vector field

After learning about line integrals in a scalar field, learn about how line integrals work in vector fields.

What we are building to

This animation will be described in more detail below.
Animation credit: By Lucas V. Barbosa (Own work) [Public domain], via Wikimedia Commons
Let's say there is some vector field F and a curve C wandering through that vector field. Imagine walking along the curve, and at each step taking the dot product between the following two vectors:
  • The vector from the field F at the point where you are standing.
  • The displacement vector associated with the next step you take along this curve.
If you add up those dot products, you have just approximated the line integral of F along C
The shorthand notation for this line integral is
CFdr
(Pay special attention to the fact that this is a dot product)
The more explicit notation, given a parameterization r(t) of C, is
abF(r(t))r(t)dt
Line integrals are useful in physics for computing the work done by a force on a moving object.
If you parameterize the curve such that you move in the opposite direction as t increases, the value of the line integral is multiplied by 1.

Whale falling from the sky

Let's say we have a whale, whom I'll name Whilly, falling from the sky. Suppose he falls along a curved path, perhaps because the air currents push him this way and that.
In this example, I am assuming you are familiar with the idea from physics that a force does work on a moving object, and that work is defined as the dot product between the force vector and the displacement vector.
Key question: What is the work done on Whilly by gravity as he falls along the curved path C?
Usually, computing work is done with respect to a straight force vector and a straight displacement vector, so what can we do with this curved path? You can start by imagining the curve is broken up into many little displacement vectors:
Go ahead and give each one of these displacement vectors a name,
Δs1, Δs2, Δs3,
The work done by gravity along each one of these displacement vectors is the gravity force vector, which I'll denote Fg, dotted with the displacement vector itself:
FgΔsi
The total work done by gravity along the entire curve is then estimated by
n=1NFgΔsn
But of course, this is calculus, so we don't just look at a specific number of finite steps along the curve C. We consider what limiting value this sum approaches as the size of those steps shrinks smaller and smaller. This is captured with the following integral:
CFgds
This is very similar to line integration in a scalar field, but there is the key difference: The tiny step ds is now thought of as a vector, not a scalar length. In the integral above, I wrote both Fg and ds with little arrows on top to emphasize that they are vectors. A more subtle and more common way to emphasize that these are vector quantities is to write the variable in bold:
CFgds
Key takeaway: The thing we're adding up as we wander along C is not the full value of Fg at each point, but the component of Fg pointed in the same direction as the vector ds. That is, the component of force in the direction of the curve.

Example 1: Putting numbers on Whilly's fall.

Let's see how this plays out when we go through the computation.
Suppose the curve of Whilly's fall is described by the parametric function
s(t)=[100(tsin(t))100(tsin(t))]
The vector ds representing a tiny step along the curve can be given as the derivative of this function, times dt:
ds=dsdtdt=s(t)dt
If these seem unfamiliar, consider taking a look at the article describing derivatives of parametric functions. The way to visualize this is to think of a tiny increase to the parameter t of size dt. This results in a tiny nudge along the curve described by s(t), which is given by the vector s(t)dt.
Evaluating this derivative vector simply requires taking the derivative of each component:
dsdt=[ddt100(tsin(t))ddt100(tsin(t))]dsdt=[100(1cos(t))100(1cos(t))]
The force of gravity is given by the acceleration 9.8ms2 times the mass of Whilly. Not that it matters, but I looked up the typical mass of a blue whale, and it's around 170,000kg, so let's use that number.
Since this force is directed purely downward, gravity as a force vector looks like this:
Fg=[0(170,000)(9.8)]
Let's say we want to find the work done by gravity between times t=0 and t=10. What do you get when you plug in all this information to the integral integral CFgds and evaluate the integral? Take a moment to try writing this out for yourself before peeking at the answer.
(To those physics students among you who notice that it would be easier to just compute the gravitational potential of Whilly at the start and end of his fall and find the difference, you are going to love the topic of conservative fields!)

Visualizing more general line integrals through a vector field

In the previous example, the gravity vector field is constant. Gravity points straight down with the same magnitude everywhere. With most line integrals through a vector field, the vectors in the field are different at different points in space, so the value dotted against ds changes. The following animation shows what this might look like.
(Note, the animation uses the variable r instead of s to parameterize the curve, but of course, it does not make a difference.)
Animation credit: By Lucas V. Barbosa (Own work) [Public domain], via Wikimedia Commons
Let's dissect what's going on here. The line integral itself is written as
CF(r)dr=abF(r(t))r(t)dt
where
  • F is a vector field, associating each point in space with a vector. You can think of this as a force field.
  • C is a curve through space.
  • r(t) is a vector-valued function parameterizing the curve C in the range atb
  • r(t) is the derivative of r, representing the velocity vector of a particle whose position is given by r(t) while t increases at a constant rate. When you multiply this by a tiny step in time, dt, it gives a tiny displacement vector, which I like to think of as a tiny step along the curve. Technically it is a tiny step in the tangent direction to the curve, but for small enough dt this amounts to the same thing.
  • Note, in this animation the length of r(t) stays constant. This is not necessarily true for most parameterizations of C, which may have you speeding up or slowing down as your position varies according to r. For example, Whilly was probably speeding up during his fall, making the velocity vector grow over time.
  • The rotating circle in the bottom right of the diagram is a bit confusing at first. It represents the extent to which the vector F(r(t)) lines up with the tangent vector r(t). The grey x and y vectors are shown to see how these vectors are oriented relative to xy-plane as a whole.
Concept check: What does the dot product F(r(t))r(t)dt represent?
Choose 1 answer:

In physics terms, you can think about this dot product
F(r(t))r(t)dt
as
dW
That is, a tiny amount of work done by the force field F on a particle moving along C.

Example 2: Work done by a tornado

Consider the vector field described by the function
F(x,y)=[yx]
The vector field looks like this:
Thought of as a force, this vector field pushes objects in the counterclockwise direction about the origin. For example, maybe this represents the force due to air resistance inside a tornado. This is a little unrealistic because it would imply that force continually gets stronger as you move away from the tornado's center, but we can just euphemistically say it's a "simplified model" and continue on our merry way.
Suppose we want to compute a line integral through this vector field along a circle or radius 1 centered at (2,0).
I should point out that orientation matters here. The work done by the tornado force field as we walk counterclockwise around the circle could be different from the work done as we walk clockwise around it (we'll see this explicitly in a bit).
If we choose to consider a counterclockwise walk around this circle, we can parameterize the curve with the function.
r(t)=[cos(t)+2sin(t)]
where t ranges from 0 to 2π.
Again, to set up the line integral representing work, you consider the force vector at each point, F(x,y), and you dot it with a tiny step along the curve, dr:
CFdr

Step 1: Expand the integral

Concept check: Which of the following integrals represents the same thing as CFdr?
Choose 1 answer:

Step 2: Expand each component

Concept check: Based on the definitions above, what is F(r(t))?
Choose 1 answer:

Concept check: What is r(t)?
Choose 1 answer:

Step 3: Solve the integral

Concept check: Put the last three answers together to solve the integral.
CFdr =

This final answer gives the amount of work that the tornado force field does on a particle moving counterclockwise around the circle pictured above.
Reflection question: Why should it be intuitive that this answer is positive?

Orientation matters

What would have happened if in the preceding example, we had oriented the circle clockwise? For instance, we could have parameterized it with the function
r(t)=[cos(t)+2sin(t)]
You can, if you want, plug this in and work through all the computations to see what happens. However, there is a simpler way to reason about what will happen. In the integral
CFdr,
each vector dr representing a tiny step along the curve will get turned around to point in the opposite direction.
Concept check: Suppose you have two vectors v and w, and vw=3. You turn v around to point in the opposite direction, getting a new vector vnew=v. What happens to the dot product?
vneww=

Since the dot product inside the integral gets multiplied by 1 when you swap the direction of each dr, we can conclude the following:
Key Takeaway: The line integral through a vector field gets multiplied by 1 when you reverse the orientation of a curve.

Summary

  • The shorthand notation for a line integral through a vector field is
CFdr
abF(r(t))r(t)dt
  • Line integrals are useful in physics for computing the work done by a force on a moving object.
  • If you parameterize the curve such that you move in the opposite direction as t increases, the value of the line integral is multiplied by 1.

Want to join the conversation?

  • spunky sam blue style avatar for user Shreyes M
    How was the parametric function for r(t) obtained in above example? Thank you
    (4 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user I. Bresnahan
      We have a circle with radius 1 centered at (2,0). From the Pythagorean Theorem, we know that the x and y components of a circle are cos(t) and sin(t), respectively. Thus we can parameterize the circle equation as x=cos(t) and y=sin(t). Note, however, that the circle is not at the origin and must be shifted. Since each x value is getting 2 added to it, we add 2 to the cos(t) parameter to get vectors that look like <cos(t) + 2, sin(t)>. Also note that there is no shift in y, so we keep it as just sin(t). You can look at the early trigonometry videos for why cos(t) and sin(t) are the parameters of a circle.
      (16 votes)
  • starky sapling style avatar for user yvette_brisebois
    What is the difference between dr and ds? Thank you:)
    (5 votes)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user Yusuf Khan
      dr is a small displacement vector along the curve.
      ds is a small scalar step along the curve.

      Fdr would be a vector times a vector, or force times displacement.
      fds would be some curve evaluated at a height of f times a vertical step.
      (7 votes)
  • blobby green style avatar for user janu203
    How can i get a pdf version of articles , as i do not feel comfortable watching screen
    (5 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Mudassir Malik
    what is F(r(t))graphically and physically?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user Yusuf Khan
      F(x,y) at any point gives you the vector resulting from the vector field at that point. F(x(t),y(t)), or F(r(t)) would be all the vectors evaluated on the curve r(t).
      Imagine a transparent curve and place it onto of a vector field. Then erase all the vectors in the vector field that do not have tails starting on the curve.
      That should be F(r(t))
      (3 votes)
  • blobby green style avatar for user festavarian2
    The math all makes sense, but what is causing the particle to move along the curve in the first place. Wouldn't there have to be another force moving the particle along the curve , so that it could "experience" the force of the vector field?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • starky ultimate style avatar for user PadenFlood
      smart question. The example of this being a particle and it moving along a curve breaks down when you think about how the particle is actually moving through the field. So you are right to have this question.

      The curve is a path that was choosen by people who made the problem and we are just asking suppose a particle moved along this curve through this field then what work would the field to the particle.

      I think what you are imagining is something like the field being a body of water with flow and current then we drop a buoy into the water. Then the buoy is going to follow a certain natural curve in the water dictated by the force vectors of the water (the field) at every point so how are we forcing the buoy through a specific curve?( i think this is where you are at in your thought process)

      Now imagine we dropped a boat into the water rather than a buoy. since a boat has a motor with a propeller it does not need to follow the natural curve of the water. But to go on the curve that we want it to follow the boat must use it's engine (do work). AHHA! When we solve these integrals for the work done by the field on the particle we are symmetrically solving for the amount of work the particle would have to do to follow that curve. Hence in the example of the boat we could solve for how much work the engine and propeller would have to do to go up river vs down river.
      (2 votes)
  • blobby green style avatar for user dynamiclight44
    I think that the animation is slightly wrong: it shows the green dot product as the component of F(r) in the direction of r', when it should be the component of F(r) in the direction of r' multiplied by |r'|.
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user mukunth278
    dot product is defined as a.b = |a|*|b|cos(x) so in the case of F.dr, it should have been, |F|*|dr|cos(x) = |dr|*(Component of F along r), but the article seems to omit |dr|, (look at the first concept check), how do one explain this?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user pb
    what if we parameterize the circle as cos(t-2)i+ sin(t)j? why doesn't it give the same result?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user festavarian2
    The question about the vectors dr and ds was not adequately addressed below. The article show BOTH dr and ds as displacement VECTOR quantities. Are they exactly the same thing? If not, what is the difference?
    (1 vote)
    Default Khan Academy avatar avatar for user