# A Physics Student’s Guide to Line Integrals

There are two kinds of line integrals — those you see in your math course and then there are real line integrals that we use in physics. OK, I’m just joking. But really, let’s do some line integrals.

Definition of Work

Let me start off with the most common example of a line integral in physics — the work. Work is defined as:

The work is important as it is part of the Work-Energy Principle:

But let’s just focus on the work part. This is a path integral of some force F over some path from a to b with dr being a short displacement along the path. Maybe I should give a quick refresher for dot products. Assume that I can write F and dr as the following vectors.

Then the dot product (also called the scalar product) for these two vectors is just the sum of the product of their components.

There is an alternative calculation for the dot product. If you know the angle between the two vectors, then you get:

So in a sense, the work due to some force is the force in the direction of the path added up along that path. Let’s do some examples. We can start with some easy stuff.

Simple Vertical Example

Suppose I have an object near the surface of the Earth such that there is a downward gravitational force (mg). Let’s say I want to calculate the work done by the gravitational force moving from point A to point B.

Let’s just think this one through (and then we will do it with formal notation). The gravitational force is in the same direction as the path. Also, the force is constant and the path is a straight line. The means that the stuff in the integral is constant (for the most part). I can actually write the work as the product of force and total displacement.

Since these vectors are in the same direction, it’s just the magnitude of the force multiplied by the magnitude of the displacement. I will just call the distance from point A to B the value h.

This is a positive quantity which means the object would gain in energy — that makes sense (and this is what you would see in an introductory physics course).

Using an Actual Line Integral

But let’s not take short cuts. Let’s do this the right way and see if we get the same answer. I will start with the dot product of force and displacement.

Notice that the force in this case only has a y-component. Now, I can put this dot product into the integral.

Since mg is constant, this just becomes the integral of dy — which is y evaluated from y1 to y2.

Notice that y2 is lower than y1 such that the difference will be negative h. This gives a total work of mgh just like before. Simple.

Line Integral for a Non-Vertical Path

OK, now let’s do another one that’s just a little bit more complicated (but not much). Suppose I move point B over to the side.

This diagram is a little misleading. I drew the vector dr as in the direction of the path. However, dr is always the vector < dx, dy, dz > if we are using Cartesian coordinates (which we are). But since dr didn’t change and the force didn’t change, the only change is in the limits of integration.

So, how do I deal with this start and ending points in 2 dimensions? Really, it becomes a sum of two integrals.

Since the x-component of the dot product is zero, that integral is also zero. That leaves us with the integral in the y-direction. Integrating and evaluating at the limits, we get:

Notice that y2 is lower than y1 making the difference negative. But there is also the negative component of the gravitational force. This means the overall work is positive — just like the other method.

Oh, yeah — in this case the work doesn’t depend on the motion in the x-direction. You know why? What if you go from point A to B along a different path. Suppose you go straight down and then turn and go horizontal to point B? We already did the work along a path that is straight down (mgh). For the horizontal path, the force and the displacement are perpendicular. The dot product of two perpendicular vectors is zero. So, the sum of the work along the two paths is just mgh. Yes, the work done by the gravitational force doesn’t depend on the path (we can talk about that later).

Non-Trivial Line Integral

I hate to move away from real situations, but let’s look at a more complicated force. Suppose I have a 2 dimensional force that looks like this:

I just made up something in which the force depends on the position of the object. The “c” is just some constant so that the units work out (c would have units of N/m). Oh, did you notice my vector notation? I hope that doesn’t freak you out. I just picked that up from my introductory physics class.

It might help to see of vector field plot for this force. I need to write a post about how to make these, but for now I will just use this one from WolframAlpha.

Let’s find the work going in a straight line from point A at (2,0) to point B at (0,2). Here we go. Step 1 is to find the dot product of F and dr.

When I put this into the integral, I get three separate integrals (but the one for the z-direction is zero, so I will drop that one).

But wait! I can’t integrate either of these. The first integral is over x, but I have a y in there. The second integral is over y, but there’s an x. What shall I do? I’m going to fix it of course. Here, check out this diagram.

Since the path is a straight line from point A to B, I can write it in a standard format. The slope of this line will be -1 as you can see:

The y-intercept is pretty obvious (it’s 2). This means:

I can use this relationship to fix my two integrals. The first integral is in the x-direction so I can replace the y with (-x +2). For the y-integral, I can solve for x and substitute that (x = 2-y).

Both of these are now “integratable”. I won’t go over the integration details, but here’s what you should get.

I think that’s correct, but I’m only 97 percent sure. Well, the method is legit at least. Oh, notice that you don’t need to worry about the direction of the dr vector. That’s all taken care of with the limits of integration. If you went the opposite direction along that path, you would reverse the limits and get a different value.

A More Complicated Path

Let’s spice it up a little. Suppose I have the same force and the same starting and ending points — but I want to take a different path. Maybe a curve, like this.

How do we handle this? Well, the first step is to get a relationship between x and y along that path. Since it’s a circle with a radius of 2, the following would be true.

From this, I can get the following expressions for x and y.

Now I just do the same thing as before — substitute for the x and the y in the integrals to get the following.

Notice that this isn’t as simple to integrate — but it is possible. I’m not going to do it, but I will tell you that the work done along this path is different than the work done along the straight line.

That’s enough for now. This should be enough to get you started on line integrals.

Written by