In the last lesson, we discussed how curves and surfaces can be represented parametrically and how these representations can be used to calculate various geometric properties, such as arc length or surface area.
In this lesson, we’ll explore the concepts from the previous lesson more deeply by applying them to various types of integrals over both scalar and vector fields.
Then, the stuff you learn in this lesson can be directly applied to understand Stokes’ theorem and the divergence theorem, which will be topics of the next lesson.
A lot of the things in this lesson can be straightforwardly applied to physics and electromagnetism, such as in the form of Maxwell’s equations. We’ll look at some examples of this also to help you get some sense of what all of these concepts are useful for.
Lesson Contents
The first concept we’ll look at is the notion of a line integral. A line integral essentially consists of two things; a scalar field or a vector field and a curve to integrate over.
So, in principle, a line integral is a way to integrate either a scalar field or a vector field over a particular curve.
Mathematically, we can compute these line integrals by parameterizing the curve (in fact, we also have to parameterize the field we’re integrating, but more on this soon), which we talked about in the previous lesson.
Anyway, we’ll begin by looking at line integrals of scalar fields as these are the simplest to understand.
A line integral of a scalar field essentially means taking a scalar field and integrating its values over some curve in 3D space.
As a reminder, in the last lesson, we calculated the arc length of a curve by integrating over all of the little “line elements”, ds, along the curve:
On the other hand, the line integral of a scalar field f(x,y,z) is defined as:
We can visualize what this line integral represents by looking at a two-variable scalar field f(x,y) and thinking of it as a surface with the height (the z-coordinate) being the value of the function at any given point.
The way to interpret the line integral is then as follows; we have a scalar field f(x,y) describing some “surface” and a curve γ that runs along the surface.
We then take the “height of the curve”, f(x,y), and multiply it by a small piece of arc length along the curve, ds. This gives us a small piece of area, dA, under the curve (you can think of f(x,y)ds as height*length, which gives some small area):
Then, adding up (i.e. integrating) all of these little pieces gives us the total area under this curve, which is the value of the line integral:
Therefore, the area under this curve is:
Now, the question is; how do we calculate this line integral in practice?
Well, first of all, we need a parametric curve. In other words, we need the points (x,y,z) on the curve expressed in terms of a curve parameter t:
Using these, we parameterize the curve, but we also have to parameterize the scalar field we’re integrating.
In other words, we just write the scalar field in terms of the parameter t instead of x, y and z (by using the same parameterization as for the curve):
Also, remember from the last lesson where we concluded that the little “line element” ds can be written in terms of the magnitude of the parameterized tangent vector of the curve:
Therefore, the line integral or the area under the curve is then calculated as:
Below is an example of calculating a line integral of a scalar field in the context of electromagnetism.
Physics Example: Calculating The Total Charge of a Non-Uniformly Charged WireAn important physical application of the line integral of a scalar field is if we have a scalar field that describes, for example, an electric charge density along a curve (so charge per unit length).
Then, integrating along some curve, parameterized by t, (which could represent an electrically charged wire, in which the charge is distributed according to the charge density function) would give you the total charge of the curve or wire:
Let’s do a concrete example. Say we have an electrically charged wire that has the shape of a circle (a 2D curve) and the charge distribution along this wire is described by the charge density function λ(x,y):
The goal is to calculate the total charge along the entire wire. Now, a circle (of radius r) can be expressed parametrically by the relations:
So, the position vector of any point on this wire (circle) is given by:
And the tangent vector is:
Taking the magnitude of this, we get:
Now, before we can integrate to find the total charge, we have to also express the charge density function in terms of the curve parameter t. This can be done by using the parametric relations x=rcos(t) and y=rsin(t):
Let’s simplify this a little bit by cancelling out some factors of r and using the relation sin2t=1-cos2t. Doing this, we get:
The total charge on the wire is then obtained by taking the line integral from 0 to 2π (which goes over the full circle):
Inserting the charge density function λ(t) and the magnitude of the tangent vector (which is just the constant r), we have:
Let’s pull out these constants and split the integral into three parts:
From the first integral, we get 0. From the second one, we get 2π and from the third one, we get just π (you can verify this by using, for example, the online integral calculator at Wolfram Alpha):
So, the total charge on the wire is then:
Instead of a scalar field, we can also take the line integral of a vector field. The only difference with this is that we now have a dot product inside of the integral:
This dr-vector here essentially represent a small displacement along the curve. This vector is pointing in the direction of the curve (the same direction as the tangent vector).
If we have a parametric curve, the dr-vector can be calculated from the tangent vector:
The line integral is then calculated as:
Now, the right way to think about the line integral is that we “place” a curve in a vector field (similarly to how we “placed” a curve in a scalar field, which was represented as the height of some surface).
Then, at each point along the curve, we measure how much of that vector field is going along the curve. In other words, we can think of projecting the vector field onto the curve at each point. This is what the dot product is essentially doing.
Then, the integral itself is basically adding up all of these projections of the vector field onto the curve, so in some sense, the line integral describes the “total amount” of the vector field F along the curve.
Another way to sort of visualize the value of the line integral is by imagining that we take the value of F*dr/dt at each and every point along the curve (which is a scalar field, so at each point, it gives you some number) and plot those values as a function of the curve parameter t.
The value of the line integral would then be the area under this curve:
Now, it’s a little difficult to give meaning to the value of the line integral in terms of mathematics only, but for example, in physics, the line integral of the force (which is generally a vector field) gives the work done by that force along some curve.
Sidenote: For certain types of vector fields, the value of the line integral only depends on the start and end points (and NOT the curve itself). These vector fields are called path-independent (or conservative vector fields in physics as these are used to describe forces that conserve energy) and in fact, any vector field that has zero curl is a path-independent vector field. The explanation for this path-independence property comes from something called the gradient theorem and the fact that any vector field with zero curl can be written as the gradient of some scalar field. You'll explore this more in the problem set associated with this lesson.
Now, how do you calculate the line integral of a vector field in practice?
Well, you simply need a curve that is parameterized, but to do the actual integral, you also need to write the vector field in terms of the curve parameter.
Physics Example: Calculating The Work Done Along a CurveLet’s say we have a force field (a vector field) that depends on x and y:
We then want to calculate the work done by this force when some particle moves around a circle (from 0 to 2π). Now, a circle of a constant radius r can be parameterized by the relations:
Since we’re now talking about physics, we can imagine that the parameter t represents time. That’s why I’ve included this angular frequency, ω, here as it gives the correct units (note that this doesn’t change the shape of the curve at all).
So, as time increases, the particle moves around in a circular path, with its position given by the position vector:
The tangent vector of the curve is given by the derivative of this:
Physically, this is the derivative of position with respect to time i.e. the velocity vector of the particle (as a function of time).
Now, before we do any integrals, we have to write the force field in terms of the parameter t (time) as well. This is quite simple; just plug in the relations x=rcos(ωt) and y=rsin(ωt) into the expression for the force to get the force on the particle as a function of time:
We can now do the line integral to calculate the work by plugging the velocity vector and the force field into the integral and taking the dot product of these:
Let’s simplify this to get:
Now, before we go any further, let’s think about these integration limits a and b; we want to calculate the work done over a full circle. The time it takes for the particle to go one full cycle, T, can be calculated from the definition of the angular frequency:
Therefore, our integration limits are a=0 and b=2π/ω. Our integral is then:
We can write sin2ωt as 1-cos2ωt (based on the identity sin2ωt+cos2ωt=1), so that we get:
The nice thing here is that the first two integrals are actually zero and the last integral gives us π/ω. Therefore, the work done by this force field around one loop is simply:
Now, as a sidenote, if we really think about the physics behind this, a non-zero work would mean that the particle’s speed (magnitude of the velocity vector) changes. However, in that case, we couldn’t describe it as the velocity vector given by:
Why? Because this actually has constant magnitude. Therefore, the net work done of all forces in this situation must be zero, so there must be an additional force involved in this situation that would cancel this work done by the force field we just calculated.
It would, in this case, be some sort of tension force (you can think of this as a string attached to the particle) that keeps the particle moving in a perfect circle. This tension force would then have to have a component along the curve that would cancel the work done by our force vector field defined earlier.
An important special case of a line integral is a line integral around a closed curve or loop. This is called a circulation integral and we denote it as:
This is basically the same thing as an ordinary line integral, except that we’re doing the line integral over a closed curve. A closed curve is simply a curve that starts and ends at the same point.
In practice, calculating a circulation integral is exactly the same as calculating any line integral, the only thing is that the start and end points of the curve are the same:
Now, you may want to ask; shouldn’t this integral always be zero since we’re integrating from t=a to t=a, which is basically an interval of zero? Well, it would be the case for ordinary integrals (such as ∫aa F(x)dx=0).
However, when integrating over a closed curve, we have to keep in mind that a closed curve is always periodic in a sense, meaning that two different values of the curve parameter can still correspond to the same point.
In fact, we saw an example of this earlier already when we did a line integral over a circle and got the following result:
In reality, this is actually a circulation integral! This is because a circle is a closed curve with the “start” and “end” points, t=0 and t=2π, actually being the exact same point. Yet, we still got a non-zero result for the integral.
This is fundamentally explained by Stokes’ theorem, which actually tells us that for a vector field with non-zero curl, a closed line integral (circulation integral) will also generally have a non-zero value.
Therefore, the fact that a vector field may have a non-zero curl explains why a vector field may have some non-zero circulation value over a closed curve (I suppose this is where the name circulation comes from; the curl, in some sense, represents an infinitesimal notion of “circulation”).
Anyway, we’ll discuss these ideas more in the next lesson. For this lesson, we won’t need the notion of a circulation integral much.
A surface integral, just like a line integral, has to do with integrating either a scalar or a vector field. The difference here is that we’re now integrating along a surface instead of a curve.
Remember from the last lesson where we discussed how to parameterize a surface, calculate its normal vector and its surface area.
All of these concepts are applicable here also and if you learnt them well in the last lesson, the stuff we’ll discuss here shouldn’t be too difficult.
We’ll begin by discussing the surface integral of a scalar field. In the last lesson, we concluded that the surface area of a parametric surface S(u,v) can be calculated from the magnitude of the normal vector to the surface:
Let’s now imagine that we have some scalar field f(x,y,z) and we want to integrate values of the scalar field along some parametric surface S(u,v).
Now, the first thing we have to do is express the scalar field in terms of the surface parameters, u and v, so f(x,y,z)=f(u,v). Once that’s done, well, we simply “add” the scalar field inside the integral as follows:
Now, the geometric idea behind what such an integral actually represents is a bit difficult to define precisely.
Essentially, as the scalar field produces some number at each point in space, we are, in a sense, adding up all of these numbers along the surface.
Now, the way you could imagine this is by picturing the scalar field as a surface with its “height” describing the value of the scalar field. The surface integral would then give you the volume between the surface and the scalar field:
Now, personally I don’t want to always picture such a geometry. Sometimes it’s just convenient to do a calculation without thinking of the geometry behind it too much.
In fact, sometimes we like to represent different things with these scalar fields, in which case this geometric notion doesn’t even make much sense.
For example, if the scalar field has some physical meaning, such as the electric charge density (charge per surface area). So, f(x,y,z) would give you the charge density at each point in space.
Then, by taking the surface integral of f(x,y,z), we would get the total charge on the surface. In this case, we’re not really thinking of any kind of volume, we’re going by a physical representation.
Down below, I’ve included an example of how to use these surface integrals in physics.
Physics Example: Calculating The Total Charge on a Cone Using Surface IntegralsThis example goes as follows; we have a cone with its “curved sides” being electrically charged. The charge density on the surface is described by the function (scalar field):
Now, the cone, as we deduced in the previous lesson, was parameterized (in terms of the surface parameters u and v) by:
We also already calculated the magnitude of the normal vector in the last lesson, which was:
Before we can do the surface integral, we have to convert our charge density function into a function of u and v. This is done by simply plugging in the relations x=ucos(v), y=usin(v) and z=hu/R into σ(x,y,z):
So, our charge density function is then:
If we want to calculate the total charge on the surface of the cone, this can be done by taking the surface integral of this charge density function along the surface of the cone, which would be:
Plugging in the stuff we’ve obtained already, we have:
Now, the full surface of the cone runs from 0 to R (the limits of the parameter u) and 0 to 2π (limits of v). Therefore, this integral becomes:
From the u-integral, we get just R4/4. We can also split the v-integral into two:
Now, the first integral gives us just π (without having to do the actual integral, which is somewhat tedious and not really the point of this example) and the second integral gives us zero. Therefore, we then have:
This is the total charge on the surface of the cone (the curved part of the surface). Hopefully from this, you can get some ideas of how these surface integrals are used in physics.
It’s worth mentioning that if we’re doing a surface integral in some well-known coordinate system, such as polar or spherical, it’s much easier to use something called the Jacobian determinant to write down the correct form of the integral in terms of the u- and v- parameters.
We’ll talk about this more in the lesson on coordinate transformations.
Similarly to how we can take the line integral of a vector field along a curve, we can also take the surface integral of a vector field. However, this does not measure the vector field along the surface, but rather through the surface.
The surface integral of a vector field is calculated as:
Essentially, the surface integral of a vector field represents the amount of the vector field arrows passing through the surface. This is called the flux of the vector field.
We can visualize this by thinking about what the dot product here represents; the dot product between F and n tells you how much of the vector field (at any given point) is going in the direction of n.
Well, since n is the normal vector to the surface, this dot product also then represents how much of this vector field is passing through the surface at any given point:
Then, when we take the integral, we essentially get the total amount of flux through the surface.
In terms of physical intuition, you could think of this vector field as the velocity of some fluid at each point. The surface integral of this velocity field would then give the total amount of fluid flowing through the surface (per unit time).
However, I want to stress again that the notion of the flux of a vector field does not necessarily have to have any physical meaning. It’s simply just a mathematical concept that CAN be given physical meaning, depending on the application.
Important sidenote: Given a surface and its normal vector, we basically have a choice of which "side" of the surface we take our normal vector pointing out of. In the example above, the normal vector is chosen to point upwards from the "top part" of the surface, but equivalently, we could take it to point downwards from the "bottom" of the surface. This is the problem of choosing an orientation for the surface. This makes a difference when calculating dot products in these flux integrals; in particular, choosing the "oppositely pointing" normal vector will change the sign of the dot product (but not its actual value). The important thing is that you pick one orientation and stay consistent with it throughout the whole surface. In practice, when you're calculating the normal vector using the cross product, you're free to choose either a plus or a minus sign. Both will work, but usually I'll just choose the positive choice.Physics Example: Calculating The Mass of a Flowing Fluid Using Flux Integrals
Imagine a fluid in some 3D space that’s flowing around. Let’s now place a surface somewhere in this space and calculate the total mass of the fluid flowing through this surface in some period of time (in other words, we want to find the mass as a function of time).
The mass flux of a fluid is defined as the rate of change of the mass flowing through the surface per unit area:
If we integrate the mass flux over the surface area (i.e. flux integral), we then get the rate of change of the mass:
Now, expressed in terms of the surface parameter, this would be:
Let’s say we have a steady-state fluid (meaning that its velocity doesn’t vary with time, only with space) which has a velocity at each point (x,y,z) given by the vector field:
This describes a “source” of outwards-flowing fluid centered at the origin:
Now let’s place a sphere of radius r at the center and calculate the flux through its surface. This will give us the rate of change of the mass of the fluid flowing through the surface of the sphere.
The first thing to do is to parameterize the surface of the sphere. This can be done using spherical coordinates, r, θ and φ, which are defined as:
Since the radius r here is a constant, the only variables we have are θ and φ, which I’ll rename to u and v just to keep consistent with our notation. We then have the coordinates x, y and z expressed in terms of u and v:
The position vector of a point on the surface of the sphere is then:
Taking the partial derivatives of this, we get:
The components of the cross product between these two partial derivative vectors are:
So, the normal vector to the sphere is (using these cross product components):
Now, since this has all minus signs, this is actually an inwards pointing normal vector. Equivalently, we can simply choose the normal vector opposite to this (which is still a normal vector to the sphere, it’s just pointing outwards from the surface), which has all plus signs:
There isn’t really any content with this choice, all it does is change the overall sign of the flux integral, which will now be positive for this choice of the normal vector orientation.
Anyway, before we calculate the flux integral, we have to also parameterize our velocity field in terms of u and v. Doing this, we get (by using the relations between x,y,z and u,v):
This can be simplified a bit by using cos2u+sin2u=1 and cancelling some stuff, after which we have:
Before we do the integral, let’s take the dot product between this velocity field and the normal vector:
That’s the dot product. We can now calculate the flux integral to give us the rate of change of mass:
Inserting the dot product we calculated and the integration limits (0≤u≤2π and 0≤v≤π), we get:
Since nothing in the integrand depends on u, we get just 2π from the u-integral:
Moving some of these constants and splitting the integral into two, we get:
From the first integral, we get 2 and from the second integral, we get 4/3 (you can simply plug these integrals into a calculator, such as the online integral calculator at Wolfram Alpha). So, we have:
This can be simplified to the form:
This is the rate of change of the mass of the fluid flowing through the sphere’s surface. Now, this whole thing is just a constant, so we can simply integrate both sides to get:
This is the mass of the fluid flowing through the surface of the sphere as a function of time. Now, hopefully this example illustrates the use of these flux integrals, especially in physics (and as a side benefit, we also parameterized the surface of a sphere and calculated its normal vector).
I want to also mention some alternative notation we’re going to be using for these surface integrals.
Some equations may become a little bit cluttered if we always carry around these u and v parameters in every integral. Instead, we can simply write the surface integral of a vector field as follows:
Essentially, the only thing we’re doing is writing dudv=dS. You should, however, keep in mind that to actually calculate the surface integral, you have to still put back in this dudv-term. This is just a much nicer looking piece of notation.
Now, similarly to how we could take the line integral of a vector field over some closed curve, we can also take the surface integral of a vector field over a closed surface. We’re going to denote this as:
So, essentially, this “circle” here just stands for the fact that we’re integrating over a closed surface. To actually calculate such a surface integral, well, it’s exactly the same as for a “non-closed” surface integral; calculate the normal vector to your surface, take the dot product, integrate over u and v etc.
In fact, we already saw an example of this above with the integral over the surface of a sphere, which of course, is a closed surface.
Now, the important thing about these closed surface integrals is that a closed surface always encloses some volume with the surface being the boundary of that volume. This turns out to be the key thing for understanding the divergence theorem.
I’m going to also briefly mention volume integrals, particularly for the reason that they are necessary for the divergence theorem, which will be discussed in the next lesson.
A volume integral of a scalar field essentially just means integrating the values of the scalar field over some volume. In particular, this gives you a triple integral:
I think the best intuition for this comes from physics; for example, the scalar field f here could represent a mass density function of a fluid (mass/volume), so this triple integral over a volume would then give the total mass of the fluid inside this volume.
As far as how to calculate these volume integrals, well, in Cartesian coordinates, this would simply be the triple integral over x, y and z that we’ve covered already in the lesson on multivariable integrals:
Now, you can also do these triple integrals in other coordinate systems (such as spherical), but you’d have to convert them from Cartesian coordinates to that other coordinate system first using the Jacobian determinant (this will be covered in a later lesson).
In principle, you could also take the volume integral of a vector field, in which case, you’d get back another vector field (you would just be taking the volume integral of each of the components).
However, this is quite rarely used and we’re not going to need such a concept for any of the upcoming topics in this course.
There has been quite a bit of stuff covered in this lesson, but here are the key takeaways: