# Vector calculus

Vector calculus is the extension of differentiation and integration to vector fields. The techniques are primarily employed for vector fields in two and three dimensions, but the theory applies to any number of dimensions.

## Intro

Maxwell's equations is a set of four equations that describe and unite the concepts of electricity and magnetism. In terms of both theoretical and practical value, these equations are priceless.

Giants like Albert Einstein and Richard Feynman have put Maxwell on a pedestal for laying the foundation of electrodynamics, and so would most people aware of their consequences.

Without these pieces of vector calculus, you would not be reading this right now, since your phone would not exist. Even if it did, there would be no telecommunication nor internet. Literally all electronic advancements, and many more, are built upon the framework they provide.

## Concept

Functions whose output consist of more than one component give rise to vector fields, describing the function at each point. Vector calculus is the study of these fields.

One of its most important concepts is that of conservative v.s. non-conservative vector fields. Consider this mind-bending piece of art by M.C. Escher:

Walking clock-wise, one would move upwards, requiring a lot of energy to counter-act gravity. Walking in the opposite direction, down the stairs, is much easier. Still, after a full lap, we would end up at the same position?

This makes no sense because gravity is in fact a conservative field, and is therefore path independent. However we move from some point to another point should require the exact same amount of energy. It turns out that conservative fields have no circulation in them.

In the picture above, the left vector field is conservative, while the right is not.

## Math

Vector calculus is all about differentiating and integrating vector fields. In this course, our vector fields will be in or .

There are a few new concepts that deal with differentiation and vector fields. They are

1. Gradient: . Measures the rate of change and its direction for scalar fields.

2. Divergence: . Measure how much a vector fields "spreads out" in a point.

3. Curl: . Measure how much a vector field rotates or "swirls" in a point.

Let . Then, the divergence is

and the curl is

## Divergence

To paint the full picture of the rate of change of a scalar function of several variables, we turned to the gradient, forming a vector of 's partial derivatives.

Now with the same goal, but for a vector valued function , the approach we take is a bit different.

A function takes the form

and therefore has first partial derivatives.

These are handled by handpicking and grouping those of more interest into two different concepts: divergence and curl.

This lecture note is devoted to divergence, only dealing with these three partial derivatives:

They give a measure of how strongly a field is intensified or dampened at each point, that is, how the inflow and the outflow differ at the point.

Divergence is a measure of a point's tendency to act as a source in the vector field

A source gives back more field strength than it takes in, and the divergence there is positive.

In contrast, a sink swallows more of the field strength than it spits out, which is signified by a negative divergence.

If the divergence is zero, an equal amount flows in and out at the point.

So, how do we go about finding the divergence?

To extract the three partial derivatives

we utilize two concepts we have seen before: The del operator and the dot product:

In more detail:

Note that the result is a scalar function, giving the divergence of at each point in the field.

### Example

Find the divergence at the origin in the following vector field:

Using the formula for divergence we get

and evaluating at the origin yields

## Curl

As you're having your evening bath, you usually light scented candles and listen to classical music. You start moving your hand in a circular motion, as if you were conducting the orchestra. And then - look! - there's an eddy on the surface. If you'd draw a vector field, you'd get something like this:

The water seems to be swirling around a point. Since it's swirling clockwise, we say the vector field has negative curl at that point.

In contrast, if there'd be a current in the bath tub, your vector field might look as follows:

Here, curl is . There's no swirling going on. Just a normal current.

The notion of curl extends to 3D too; it's just that we use a vector. The vector points in the direction of your thumb as you curl the fingers of your right hand and stick the thumb out. The magnitude indicates how much the water swirls.

The curl of a vector field is written and is computed as follows:

If the vector field is in , , we can still compute its curl using the same formula. Just let . This gives the significantly more concise curl:

### Example

Find the curl at the point in the following vector field

using the formula for curl we get

and evaluating at yields

## Conservative vector fields

Since the gradient of a scalar field is a vector field, do we have that all vector fields are gradients of some scalar field?

The answer is no! Only conservative vector fields are, which results in them having some special characteristics.

First of all, gradients have no curl. So a conservative vector field is irrotational:

This signifies that in 2D:

In 3D, two more conditions apply:

As a consequence, line integrals over vector fields that are conservative are path independent.

In other words, what ever curve we integrate over, given some specific start and end point, the integral will always evaluate to the same value.

The circulation of a conservative vector field around a closed loop is 0

This means that the integral is fully determined by the start and end points alone. It further means that if we integrate conservative vector fields over closed loops, it's as though we didn't integrate at all:

One example of a conservative vector field is the gravity of Earth which, as we will see in the following example, is therefore path independent.

### Example

Near the surface of the Earth, the gravitational acceleration is approximately constant at about . It points toward the Earth's center, but for in a small enough region we can imagine it pointing straight down. Let therefore:

be the field of gravitational acceleration. Now how much energy is needed to transport someone weighing kg up to the top of a slide at the point , from the starting position at ?

Force is obtained by multiplying mass and acceleration, and so the force field asserted by the Earth's gravitation on the person will be:

A line integral over the vector field then gives the change in energy as we move along some path.

To highlight the fact that any corresponding line integral is independent of the path, we will consider two cases.

First, the person can walk up some stairs, in which case the path resembles the line given by .

Second, there is an elevator going straight up to the point , where after the person will have to walk horizontally down a platform to reach the point.

Case 1

We parametrize the path by letting

Giving us that

And so the integral becomes

Case 2

This path is piece-wise parametrized as

Meaning that we have

The line integral then evaluates to

The fact that the integrals are negative here, means that the integral goes against the vector field. Thus, the energy of joules has to be provided from some outside force. Here, it's provided by the person themselves and the elevator.

The concepts of changes in energy and how it relates to the sign of the line integral will hopefully become more clear in the next lecture note, where we discuss the scalar potential.

## Scalar potential

We introduced conservative vector fields by pointing out that they are all gradients of a scalar field. The scalar field in question is referred to as the scalar potential of the conservative vector field.

To see what this means in practice, let's return to the person making their way up to the top of the slide.

The scalar field , of which the force field is the gradient, gives the potential energy at each point compared to some reference point.

The scalar potential in a point is the line integral over the corresponding vector field, to some reference point of zero potential

Let's for simplicity say this reference point is at . The scalar field then gives a measure of how much energy you get, as you slide back down to from the point .

This is exactly what the line integral over the vector field calculates. Like we said before, this line integral is path independent.

### Finding the scalar potential

Evaluating a line integral over a vector field is a piece of cake if we know the scalar potential function .

But if this is not given to us, how do we go about finding it?

We know per definition that

Now what we can do is to first integrate with respect to . The constant of integration can then depend on and , but not .

Next, we differentiate what we get with respect to , which must be equal to

From this we have

which implies that

We now have

If we then take

and rearrange the expression, whereafter we integrate with respect to we get

Hence, the scalar potential in its full and final form will be

It involves a bit of work, but we are able to determine the scalar potential function exactly, apart from some constant .

This is fine, however, because when we use the scalar potential to evaluate line integrals of its gradient vector field, will cancel out.

After all, scalar potential is all about differences between points in the field, and not so much about the actual values there.

## Vector potential

So let's say you've got yourself some vector, .

And now you want to find whatever vector, when crossed with , gives . That vector is the vector potential.

Oh, and by the way, the vector potential is arbitrary. If you're obsessed with the number , you might as well add to every term in the vector potential. And here's a fun fact: if you'd take the divergence of , it'd be .

But why care about vector potentials? They're widely used in electromagnetism and fluid dynamics, and they can vastly simplify our calculations (which is always good). So yeah, it's worth learning about vector potentials.

Just to hammer home the point, let's do a bit of physics. So assume you've got a current and a magnetic field . Then those white arrows represent the vector potential.

### Example

We can find many different vector potentials for a vector field which has a vector potential.

Below, we show that the two vector fields and give rise to the same vector field and therefore both are vector potentials to .

If we compute the curl of the two vector fields, we find that

## Vector calculus rules

Without proving them, we provide here a useful set of equalities to use when solving vector calculus problems.

In the following equations, and are scalar fields while and are vector fields, none of them related to each other in any particular way, and each having continuous partial derivatives.

1.

2.

Curl has no divergence

3.

4.

5.

6.

7.

8.

9.