Main content

## Multivariable calculus

### Course: Multivariable calculus > Unit 4

Lesson 1: Line integrals for scalar functions# Introduction to the line integral

Introduction to the Line Integral. Created by Sal Khan.

## Want to join the conversation?

- Where do we actually use the line integral in engineering or physics?(103 votes)
- The classic problem for it is to calculate the work done on a particle traveling along some curve in a force field represented by a vector field. So it's a big thing in electromagnetics, for example, which does indeed have some use to it!(173 votes)

- Doesn't your function fail the vertical line test?(17 votes)
- I believe that in this case the functions that need to pass the vertical line test are the functions that produce the values of x and y. So h(t) & g(t) would pass the test, but the graphed values of x and y produced by the parametric equations are not required to pass the test.(56 votes)

- Can anyone explain why this would be called a queue integral? My prof said something like "If line integrals were named in modern times it would've been called a queue integral."(9 votes)
- It's a joke regarding the colloquial usage of both words today. It used to be that people would form "lines" in shops and when asked to be orderly. Now, it's more common - nearly ubiquitous in the UK, not so much in the US - to hear "if you could please form a queue."

Mathematically, it's nonsense - the idea of a line in math is very different from the idea of a line/queue of people, and therein lies the humour.(57 votes)

- Can You please tell me what is the difference between "delta x" and "dx"? (mentioned between0:35-0:45)(10 votes)
- Delta x is the change in x, with no preference as to the size of that change. So you could pick any two x-values, say x_1=3 and x_2=50. Delta x is then the difference between the two, so 47.

dx however is the distance between two x-values when they get infinitely close to eachother, so if x_1 = 3 and x_2 = 3+h, then dx = h, if the limit of h is 0.

I guess basically dx is the special case of delta x when delta x is infinitely small.(54 votes)

- so is the only reason that x and y need to be expressed parametrically (in terms of t) so you can get a term dx/dt and dy/dt?

so to evaluate an integral like this for a function z=f(x,y)(instead of z=f(x(t),y(t)) i'm guessing you would need to find a way to parametrize x and y?(7 votes)- It seems so. but remember, you can always parametrize a function trivially. Here's an example:

y = cos(x)sin(x)ln(x) [not parametrized]

y = cos(t)sin(t)ln(t) [parametrized]

x = t

So, you simply replace all the x's with t's, and then make x = t. This works in any case.

Hope this helps a bit.(16 votes)

- At3:27, Sal says you need to go and review parametric equations. What are parametric equations, and under what playlist are they?

I've watched the whole of the calculus playlist till here, and I never found it.(6 votes)- On a 2D graph, parametric equations are a set of two equations. One represents the x component of a curve and the other gives the y component for a curve. They are functions x(t) and y(t) respectively. t is often time in many problems, however, it can really be any parameter that produces the x and y components of

a curve. An x,y coordinate at a particular t value can represent vector components in physics problems.

They are located in the precalculus playlist starting with this video: http://www.khanacademy.org/math/precalculus/v/parametric-equations-1

In 3 dimensions, you also include a 3rd equation, z(t).(11 votes)

- At11:50, why is Sal using the Pythagorean theorem? Essentially he wants to measure the slope at that point right? That's what he means by 'arc length'. So why not differentiate the parametric equations right there which will give you the dS for that arc length? Because that's ultimately what he does in the end of the video at16:41and17:00but by then its mixed in with the Pythagorean theorem. It doesn't make sense to me because it doesn't seem consistent with how we're suppose to take the derivative of a parametric equation from the Taking Derivatives playlist.(2 votes)
I can sympathize with your position – Sal can be excruciatingly detailed at times – especially when the listener already has a good understanding of what is going on, like you seem to have here. However, not all listeners, in fact most I dare say, are such that when they get to this Line Integral introduction video, they are seeing the concept for the first time and usually do not yet have a well-developed sense of mathematical intuition about it nor the concepts leading up to it. Apropos, Sal takes a short step back to remind them of what they did in the Integral Calculus track, namely Arc Length (https://www.khanacademy.org/math/integral-calculus/area-and-arc-length-ic/arc-length-ic/v/arc-length-formula) and use that to show that something similar is going on here. This is a common “building on what you already know” style of teaching. Here is another example of a similarly done introduction to Line Integrals, though with less depth of the details (you need to page down to get to the part I am talking about: http://tutorial.math.lamar.edu/Classes/CalcIII/LineIntegralsPtI.aspx. I have collected some 40 Calculus Textbooks in my time, and I would say about a quarter take this “back story” approach (these would be the texts which are aimed at those students who only need calculus to graduate – the texts written for those students who are actually studying math do not repeat themselves as much, since, mathematicians are in some sense, lazy – say something once, why say it again?**On one hand**, have you ever gone back to watch one of Sal’s algebra videos? (Try it just for fun). Some concepts that should be obvious by that point are still explained in detail even though they are not directly about the video topic at hand, yet, their inclusion does not detract from the meaning of the message (they just make you roll your eyes and think “shouldn’t students know this by now?”. IMHO, it is the same thing with this video – we are reminded how**Now, on the other hand***dS***is**related to the Pythagorean Theorem, and how we have*previously*seen an example of it. This is done as a tool to boost the student’s intuition. From my assessment of the video, there is no confounding of this “back story” of the relation between*dS*and the Pythagorean Theorem with the introduction of the Line Integral formula.

So, perhaps, and hopefully, your situation is that you just found the “back story” a bit of a waste of your time (because you already knew what to do), and hopefully, it is not the case that the Pythagorean explanation truly "did not make sense” to you. If it really was confusing to you, that may mean your intuition in this area isn’t what you thought – but I doubt that, it sure seems from the details in your question that you already had a good idea of what was going on and it more likely that you are really just a bit annoyed at the “Pythagorean trip down memory lane.”

Anyway, something to think about, or not.(15 votes)

- In the final formula, why is x(t) and y(t) used instead of g(t) and h(t)(6 votes)
- It is common to use the variable name to refer to the component functions when you parametrize a curve, so x = x(t) and y = y(t). Here x(t) = g(t) and y(t) = h(t) defined earlier in the video.(5 votes)

- I was just wondering, why are we only taking the single integral and not the double integral for line integrals?(4 votes)
- Double integrals are for integrating over surfaces. Single integrals are for integrating over lines.(6 votes)

- How do we measure only the length of the path?(3 votes)
- If you are measuring the length of the path, it is the same as applying the constant function f(x)=1 and then integrating over the path. Intuitively, think of it as just "adding ones on your way across the path" and that is the same thing as just adding up all the arclengths of the path. What you get is the integral over the path of just the differential, ds. But since ds^2 = dx^2 + dy^2, pulling out a dx gives you ds^2 = dx^2 (1+(dy/dx)^2) or ds = dx sqrt(1+f'(x)), which is the same as the arc length equation!

If you want to parametrize it, just simply parametrize x and y. Then dy/dt and dx/dt can be found, dy/dx is found by chain rule, and substitutions will give you the required arc length formula for it.(6 votes)

## Video transcript

If we're just dealing with two
dimensions, and we want to find the area under a curve, we have
good tools in our toolkit already to do it, and I'll
just remind us of our tools. so let's say, that's the
x-axis, that's the y-axis, let me draw some arbitrary function
right here, and that's my function f of x. And let's say we want to find
the area between x is equal to a, so that's x equal to
a, and x is equal to b. We saw this many, many,
many videos ago. The way you can think about it,
is you take super small widths of x, or super small
changes in x. We could call them delta x's,
but because they're so small, we're going to call them a dx. Super, infinitesimally
small changes in x. And then you multiply them
times the value of f of x at that point. So you multiply it times the
height at that point, which is the value of f of x. So you get f of x times each of
these infinitesimally small bases, that'll give you the
area of this infinitesimally narrow rectangle right there. And since each of these guys
are infinitely small, you're going to have an infinite
number of these rectangles in order to fill the space. You're going to have
an infinite number of these, right? And so the tool we use was
the definite integral. The definite integral is a sum,
is an infinite sum of these infinitely small areas,
or these infinitely small rectangles. And the notations that we
use, they would go from a b. And we've done many videos
on how do you evaluate these things. I just want to remind
you, conceptually, what this is saying. This is conceptually saying,
let's take a small change in x, multiply it times the height at
that point, and you're going to have an infinite number of
these, because these x's are super small, they're infinitely
small, so you're going to have an infinite number of those. So take an infinite sum of all
of those, from x is equal to a to x is equal to b. And that's just our standard
definite integral. Now what I want to do in this
video is extend this, broaden this a little bit, to solve, I
guess it maybe could say a harder or a broader
class of problems. Let's say that we are, let's
go to three dimensions now. And I'll just draw
the x-y plane first. Maybe I'll keep this, just to
kind of make the analogy clear. I'm going to kind of
flatten this, so we have some perspective. So let's say that this right
here is the y-axis, kind of going behind the screen. You can imagine if I
just pushed on this and knocked it down. So that's the y-axis, and that
is my x-axis right there. And let's say I some
path in the x-y plane. And in order to really define a
path in the x-y plane, I'll have to parameterize both
the x and y variables. So let's say that x is equal
to, let me switch colors. I'm using that orange too much. Let's say that x is is equal to
some function of some parameter t, and let's say y is equal to
some other function of that same parameter t, and let's say
we're going to start, we're going to have t go from, t is
going to be greater than or equal to a, and then less
than or equal to b. Now this will define a path in
the x-y plane, and if this seems confusing, you might want
to review the videos on parametric equations. But essentially, when t is
equal to a, you're going to have x is equal to, so t is
equal to a, you're going to have x is equal to g of a,
and you're going to have y is equal to h of a. So you're going to have this
point right here, so maybe it might be, I don't know, I'll
just draw a random point here. When t is equal to a,
you're going to plot the coordinate point g of a. That's going to be
our x-coordinate. This is g of a, right here. And then our y-coordinate
is going to be h of a. Right? You just put t is equal to a
in each of these equations, and then you get a
value for x and y. So this coordinate right
here would be h of a. And then, you would keep
incrementing t larger and larger, until you get to b, but
you're going to get a series of points that are going to
look something like that. That right there is a curve, or
it's a path, in the x-y plane. And you know, you're saying,
how does that relate to that right now? What are we doing? Well, let me just write a c
here, for saying, that's our curve, our that's our path. Now, let's say I have another
function that associates every point in the x-y plane
with some value. So let's say I have some
function, f of x y. What it does is associate
every point on the x-y plane with some value. So let me plot f of x y. Let me make a
vertical axis here. We could do a different color. Call it the f of x y axis,
maybe we could even call it the z-axis, if you want to. But some vertical
axis right there. And for every point, so if you
give me an x and a y, and put into my f of x y function, it's
going to give you some point. So I can just draw some
type of a surface that f of x y represents. And this'll all become a lot
more concrete when I do some concrete examples. So let's say that f of x y
looks something like this. I'm going to try my
best to draw it. I'll do a different color. Let's say f of x y. Some surface. I'll draw part of it. It's some surface that
looks, let's say it looks something like that. That is f of x y. And remember, all this is, is
you give me an x, you give me a y, you pop it into f of x y,
it's going to give me some third value that we're going to
plot in this vertical axis right here. I mean, example, f of x y? It could be, I'm not saying
this is a particular case, it could be x plus y. It could be f of x y. These are just examples. It could be x times y. If x is 1, y is 2, f of
x y will be 1 times 2. But let's say when you plot,
for every point on the x-y plane, when you plot f of x y
you get this surface up here, and we want to do
something interesting. We want to figure out, not the
area under this curve, this was very simple when we
did it the first time. I want to find the area if you
imagine a curtain, or a fence, that goes along this curve. You can imagine this being a
very straight linear path, going just along the
x-axis from a to b. Now we have this kind of crazy,
curvy path that's going along the x-y plane. And you can imagine if you drew
a wall, or curtain, or a fence that went straight up from this
to my f of x y, let me do my best effort to draw that. Let me draw it. So it's going to go up to
there, and maybe this point corresponds to there. And when you draw that curtain
up, it's going to intersect it something like that. Let's say it looks
something like that. So this point right here
corresponds to that point right there. So if you imagine, you have a
curtain, f of x y is the roof, and this is a, what I've drawn
here, this curve, this kind of shows you the bottom of a wall. This is some kind
of crazy wall. And let me say, this point it
corresponds to, well, actually, let me draw it little
bit different. This point will correspond to
some point up here, so when you trace where it intersects, it
will look something maybe like that, I don't know. Something like that. And I'm trying my best to
help you visualize this. So maybe I'll shade this in
to make it a little solid, let's say f of x y is
little transparent. You can see. But you have this
curvy-looking wall here. And the whole point of this
video is, how can we figure out the area of this curvy-looking
wall, that's essentially the wall or the fence that happens
if you go from this curve and jump up, and hit the
ceiling at this f of x y? So let's think a little bit
about how we can do it. Well, if we just use the
analogy of what we did previously, we could
say, well look. Let's make a little change
in distance of our curve. Let's call that ds. That's a little change
in distance of my curve, right there. And if I multiply that change
in distance of the curve times f of x y at that point, I'm
going to get the area of that little rectangle right there. Right? So if I take the ds, my change
in my, you can imagine the arc length of this curve at that
point, so let me write, you know, ds is equal to super
small change in arc length of our path, or of our curve. That's our ds. So you can imagine, the area of
that little rectangle right there, along my curvy wall, is
going to be ds, I'll make it a capital S, ds times the
height at that point. Well, that's f of x y. And then if I take the sum,
because these are infinitely narrow, these ds's have
infinitely small width, if I were take the infinite sum of
all of those guys, from t is equal to a to t is equal to b,
right, from t is equal to a, I keep taking the sum of those
rectangles, to t is equal to b, right there, that
will give me my area. I'm just using the exact same
logic as I did up there. I'm not being very
mathematically rigorous, but I want to give you the intuition
of what we're doing. We're really just bending the
base of this thing to get a curvy wall instead of a
straight, direct wall like we had up here. But you're saying, Sal, this is
all abstract, and how can I even calculate something like
this, this makes no sense to me, I have an s here, I have
an x and a y, I have a t, what can I do with this? And let's see if we can
make some headway. And I promise you, when we do
it with a tangible problem, the end product of this video
is going to be a little bit hairy to look at. But when we do it with an
actual problem, it'll actually, I think, be very concrete, and
you'll see it's not too hard to deal with. But let's see if we can get
all of this in terms of t. So first of all, let's
focus just on this ds. So let me re-pick
up the x-y axis. So if I were to reflip the
x-y, let me switch colors, this is just getting
a little monotonous. So if I were to reflip the x-y
axis like that, actually, let me do that with that same
green, so you know we're dealing with the same x-y axis. So that's my y-axis,
that is my x-axis. And so this path right here, if
I were to just draw it straight up like this, it would
look something like this. Right? That's my path, my arc. You know, this is when t is
equal to a, so this is t is equal to a, this is
t is equal to b. Same thing, I just kind
of picked it back up so you can visualize it. And we say that we have some
change in arc length, let's say, let me switch colors. Let's say that this
one right here. Let's say that's some small
change in arc length, and we're calling that ds. Now, is there some way to
relate ds to infinitely small changes in x or y? Well, if we think about it, if
we really-- and this is all a little bit hand-wavy, I'm not
being mathematically rigorous, but I think it'll give you the
correct intuition-- if you imagine this is, you can figure
out the length of ds if you know the length of these
super small changes in x and super small changes in y. So if this distance right here
is ds, infinitesimally small change in x, this distance
right here is dy, infinitesimally small
change in y, right? Then we could figure out ds
from the Pythagorean Theorem. You can say that ds is going to
be, it's the hypotenuse of this triang.e It's equal to the
square root of dx squared plus dy squared. So that seems to make things a
little bit, you know, we can get rid of the ds
all of a sudden. So let's rewrite this little
expression here, using this sense of what ds, is really
the square root of dx squared plus dy squared. And I'm not being very
rigorous, and actually it's very hard to be rigorous with
differentials, but intuitively I think it makes
a lot of sense. So we can say that this
integral, the area of this curvy curtain, is going to be
the integral from t is equal to a to t is equal to b of f of x
y, instead of writing ds, we can write this, times the
square root of dx squared plus dy squared. Now we at least got rid of this
big capital S, but we still haven't solved the problem of,
how do you solve something, you know, an integral, a definite
integral that looks like this? We have it in terms of t
here, but we only have it in terms of x's and y's here. So we need to get
everything in terms of t. Well, we know x and y are both
functions of t, so we can actually rewrite it like this. We can rewrite it as from t is
equal to a, to t is equal to b. And f of x y, we can write it,
f is a function of x, which is a function of t, and f is also
a function of y, which is also a function of t. So you give me a t, I'll be
able to give you an x or y, and once you give me an x or y,
I can figure out what f is. So we have that, and then we
have this part right here. I'll do it in orange. Square root of dx squared
plus dy squared. But we still don't have
things in terms of t. We need a dt someplace
here in order be able to evaluate this integral. And we'll see that in the
next video, when I do a concrete problem. But I really want to give you a
sense for the end product, the formula we're going to get
at the end product of this video, where it comes from. So one thing we can do, is if
we allow ourselves to algebraically manipulate
differentials, what we can do is let us multiply
and divide by dt. So one way to think about it,
you could rewrite, so let me just do this orange
part right here. Let's do a little
side right here. So if you take this orange
part, and write it in pink, and you have dx squared, and then
you have plus dy squared, and let's say you just multiply
it times dt over dt, right? That's a small change in t,
divided by a small change in t. That's 1, so of course you
can multiply it by that. If we're to bring in this part
inside of the square root sign, right, so let me rewrite this. This is the same thing as 1
over dt times the square root of dx squared plus dy squared,
and then times that dt. Right? I just wanted to write it
this way to show you I'm just multiplying by 1. And here, I'm just taking this
dt, writing it there, and leaving this over here. And now if I wanted to bring
this into the square root sign, this is the same thing, this is
equal to, and I'll do it very slowly, just to make sure, I'll
allow you to believe that I'm not doing anything shady
with the algebra. This is the same thing as the
square root of 1 over dt squared, let me make the
radical a little bit bigger, times dx squared plus
dy squared, and all of that times dt, right? I didn't do anything, you could
just take the square root of this and you'd get 1 over dt. And if I just distribute this,
this is equal to the square root, and we have our dt at the
end, of dx squared, or we could even write, dx over dt squared,
plus dy over dt squared. Right? dx squared over dt
squared is just dx over dt squared, same thing
with the y's. And now all of a sudden,
this starts to look pretty interesting. Let's substitute this
expression with this one. We said that these
are equivalent. And I'll switch colors,
just for the sake of it. So we have the integral. From t is equal to a. Let me get our drawing back, if
I-- from t is equal to a to t is equal to b of f of x of t
times, or f of x of t and f of, or and y of t, they're both
functions of t, and now instead of this expression, we can
write the square root of, well, what's dx, what's the change in
x with respect to, whatever this parameter is? What is dx dt? dx dt is the same thing
as g prime of t. Right? x is a function of t. The function I wrote
is g prime of t. And then dy dt is same
thing as h prime of t. We could say that, you
know, this function of t. So I just wanted to
make that clear. We know these two functions,
so we can just take their derivatives with respect to t. But I'm just going to
leave it in that form. So the square root, and we take
the derivative of x with respect to t squared, plus the
derivative of y with respect to t squared, and all
of that times dt. And this might look like some
strange and convoluted formula, but this is actually something
that we know how to deal with. We've now simplified this
strange, you know, this arc-length problem, or this
line integral, right? That's essentially
what we're doing. We're taking an integral over
a curve, or over a line, as opposed to just an
interval on the x-axis. We've taken the strange line
integral, that's in terms of the arc length of the line, and
x's and y's, and we've put everything in terms of t. And I'm going to show you that
in the next video, right? Everything is going to be
expressed in terms of t, so this just turns into a
simple, definite integral. So hopefully that didn't
confuse you too much. I think you're going to see in
the next video that this, right here, is actually a
very straightforward thing to implement. And just to remind you where
it all came from, I think I got the parentheses right. This right here was just a
change in our arc length. That whole thing right
there was just a change in arc length. And this is just the height of
our function at that point. And we're just summing it,
doing an infinite sum of infinitely small lengths. So this was a change in our
arc length times the height. This is going to have an
infinitely narrow width, and they're going to take an
infinite number of these rectangles to get the area of
this entire fence, or this entire curtain. And that's what this definite
integral will give us, and we'll actually apply
it in the next video.