Stokes' Theorem
July 31st, 2017
Stokes’ Theorem is one of the most fundamental ideas in calculus, and it is an incredibly elegant generalization of quite a few different theorems that are covered in a typical calculus course. In my experience as a student, this theorem was explained by shuffling of symbols, which is baffling, because I think there is a fairly intuitive explanation that doesn’t require any equations at all. Once we have crystallized our intuition, we can dive into the world of differential forms, ultimately expressing our intutions succinctly in the following form:
$$ \int_{\partial R} \omega = \int_{R} d \omega $$
The goal of this post is to get you to see the basic idea of the theorem in all its different forms: the Fundamental Theorem of Calculus, Greens’ Theorem, the Kelvin Stokes Theorem, and the Divergence Theorem.
Intuition Behind Stokes’ Theorem
Imagine you’re at a party in a huge mansion and want to see how many people are leaving or entering the party in a 10 minute time span.
You could assign a guard at each door in the mansion, who reports +1 when a person enters through the door and -1 when a person leaves through that same door.
Unless the person is leaving or entering the party, whenever you see a -1 reported, there must be a +1 reported shortly afterwards (since once you leave one room, you enter another). So if we add up each guard’s contribution, since all traffic within the mansion cancels, we get a “net flow” quantity, or the number of people leaving or entering the mansion.
Alternatively, you could save a lot of money by assigning a guard at each door on the boundary of the house (in other words, every exit/entrance), and just ask them to record similar contributions. We’ll get the same answer; the net flow of people into or out of the mansion.
Now imagine the rooms are infinitely small. Then, Stokes’ Theorem is expressing exactly above analogy in a very simple manner. To get a “net flow” quantity, you can add up flows within each tiny region, or instead add up flows on the boundary.
This is, by no coincidence, a very similar idea to the fundamental theorem of calculus, which says that in order to get the net change of a function between two points, you can simply add up (integrate) the infinitesimal change of the function at each point.
A Crash Course in Differential Forms
To formalize this theorem, we need to explain what exactly is the meaning of $dx$, and to do so we have to explain differential forms.
It’s likely that $dx$ was explained to you as “an infinitesimal amount of $x$”, and while that is not inaccurate, we need to flesh out that definition a bit more in order to write down Stokes’ Theorem. The following definitions perhaps do not make sense on their own; it is by applying these constructions that we realize they have value. Differential forms do possess a geometric meaning, but as far as vector calculus is concerned, they’re just useful symbols we can use to express other ideas.
Definition: A function $f(x)$ is linear if:
- $f(x+y) = f(x)+f(y)$ for any $x,y$.
- $f(cx) = cf(x)$ for any constant $c$.
The best example of linear maps is matrix multiplication, which satisfies the distributivity conditions above. The linearity condition helps us define differential forms.
Let’s start with working in $3$ dimensions, like in the real world. We define $k$-forms in the following way.
Definition: A $0$-form is a scalar function $f(x,y,z)$.
A scalar simply means a number (as opposed to a vector). An example of a $0$-form is temperature. At every point, we have a defined temperature, which is a number. A $0$-form is kind of a special case. The rest of the definitions are more consistent.
Definition: A $1$-form is a linear function which sends every vector to a scalar.
Define $dx$ to be the $1$-form which acts on a vector $(x,y,z)$ by returning $x$.
It is clear that $dx$ is linear from the definition. In a similar way, we can define $dx,dy,dz$ to be the differential forms which return the $x,y,$ and $z$ coordinates of a vector respectively.
Definition: A $2$-form is a linear function which sends every pair of vectors to a scalar.
Now, if you know any linear algebra, then you can say that $dx,dy,dz$ form something like a basis for the $1$-forms. In other words, any $1$-form $\omega$ can be represented as $\omega = fdx + gdy + hdz$, where $f,g,h$ are functions.
Similarly, any $2$-form $\mu = fdxdy + gdxdz + hdxdz$, and any $3$-form is $\xi = fdxdydz$. I won’t worry for now about how $dxdy$ or $dxdydz$ work.
The Wedge Product
Now that we have some sort of structure, we can add $1$-forms together by adding their $dx$ components, $dy$ components, and $dz$ components; and the same goes for $2$-forms, etcetera. A defining feature of differential forms, however, is the way that multiplication works. Namely, the way that products like $dxdy$ work is different than you might expect.
Multiplication is not commutative – it is anti-commutative, meaning changing the order will change the sign of the result. Here, I will denote multiplication using $\wedge$, but whenever you see $dx \wedge dy$ you can feel comfortable saying $dxdy$ instead.
Fact: $\omega \wedge \mu = - \mu \wedge \omega$ for any differential $k$-forms $\mu, \omega$.
In particular this means that $dx \wedge dx = - dx \wedge dx = 0$! This fact also tells us that when we’re working in three dimensions, you can’t have a $4$-form or higher. This is because one of the factors $dx,dy,$ or $dz$ must appear twice, and thus the whole product is zero.
The Exterior Derivative
Now that we have defined addition and multiplication on forms, we only need to add in one more ingredient to get calculus: differentation!
Definition: For a $k$-form $\omega$, $d\omega$ is a $k+1$-form. $d$ is called the exterior derivative, and it is linear.
We will build up the exterior derivative of a $k$-form by defining the exterior derivative of a $0$-form, and using the following two properties:
- If $\alpha$ is a $k$-form, then $d(\alpha \wedge \beta) = d\alpha \wedge \beta + (-1)^k \alpha \wedge d\beta$.
- If $\omega$ is a differential form, then $d(d\omega) = 0$.
Let’s take a look at this definition in practice to get a better understanding of what’s going on.
$0$-Forms
Recall that $0$-form is a function $f(x,y,z)$. Then we define:
$$\begin{aligned} df &= \frac{\partial f}{\partial x}dx + \frac{\partial f}{\partial y}dy + \frac{\partial f}{\partial z}dz \\ &= f_x dx + f_y dy + f_z dz \end{aligned}$$
From now on I will denote the partial derivative of $f$ with respect to $x$ as $f_x$ as above. If this looks famiiar to you, it should! This is nothing more than the “total derivative” of $f$. The entries of this $1$-form read exactly as the gradient of $f$.
$1$-Forms
Recall that a $1$-form is written as $\omega = fdx+gdy+hdz$. Since $d$ is linear by definition, we can work on each part separately. From our above definition, we have:
$$\begin{aligned} d(fdx) &= d(f \wedge dx) = df \wedge dx + f\wedge d(dx) \\ &= df \wedge dx \end{aligned}$$
The second term cancels since said earlier that $d^2 = 0$. Substituting in the definition of $df$ earlier, we get:
$$\begin{aligned} d(fdx) &= (f_x dx + f_y dy + f_z dz) \wedge dx \\ &= - ( f_y dx \wedge dy + f_z dx \wedge dz) \end{aligned}$$
The minus sign here comes from the fact that $dx \wedge dy = - dy \wedge dx$. When we do this process for every term, we arrive at the horrifying expression:
$$\begin{aligned} d(fdx+gdy+hdz) = (h_y - g_z) dy\wedge dz + (f_z - h_x) dz \wedge dx + (g_x-f_y)dx \wedge dy \end{aligned}$$
This will make a lot more sense in a second! Also, I picked the order of the terms on purpose, as we will soon see.
$2$-Forms
Again, there’s a reason why we ordered the $2$-forms above the way we did. Using the same format, let’s write out a $2$-form as $\mu = fdy\wedge dz + gdz \wedge dx + h dx \wedge dy$. Taking the exterior derivative, we get:
$$\begin{aligned} d\omega = f_x dx \wedge dy \wedge dz + g_y dy \wedge dz \wedge dx + h_z dz \wedge dx \wedge dy \end{aligned}$$
Now we can swap around the order of the wedge product, tacking on a minus sign each time we swap the order of two terms, and finally arrive at:
$$\begin{aligned} d\omega = (f_x + g_y + h_z) dx \wedge dy \wedge dz \end{aligned}$$
You definitely should recognize this! This is nothing but the divergence of the function $F= (f,g,h)$.
Now that we have built up some basic knowledge of differential forms (addition, multiplication, differentiation), we’re ready to apply this knowledge to learn vector calculus the right way.
Div, Grad, and Curl
I’ll begin by noting that in the examples above, we had a somewhat odd ordering of the basis of differential forms. The reasoning behind this comes down to something called Hodge duality, which I won’t get into. However, I will define at the outset the “correct ordering” of differential forms below.
- A $0$-form is written as $f(x,y,z)$.
- A $1$-form is written as $\omega = fdx + gdy + hdz$.
- A $2$-form is written as $\mu = fdy\wedge dz + gdz \wedge dx + h dx \wedge dy$.
- A $3$-form is written as $\xi = fdx\wedge dy\wedge dz$.
Note that $1$-forms form a $3$-dimensional vector space, as do $2$-forms, while $3$-forms form a $1$ dimensional vector space.
Now, using this ordering, we can succinctly write all of the three main tools of vector calculus (div, grad, and curl) using just differential forms. This is one of the many uses of differential forms. As I said earlier, differential forms are a language which expresses mathematical truths in elegant ways.
Gradient
We pick a $0$-form as $f(x,y,z)$. Then, as we showed above, $df = f_x dx + f_y dy + f_z dz$. Using the ordering above, this means that:
Curl
We pick a $1$-form as $\omega = fdx + gdy + hdz$. Then, as we showed above:
$$\begin{aligned} d\omega = (h_y - g_z) dy\wedge dz + (f_z - h_x) dz \wedge dx + (g_x-f_y)dx \wedge dy \end{aligned}$$
But using our ordering above, we can write this as the “determinant” of the following matrix:
$$ d\omega = \det \begin{bmatrix} dy\wedge dz && dz \wedge dx && dx \wedge dy \\ \partial_x && \partial_y && \partial_z \\ f && g && h \end{bmatrix}$$
This should look familiar. If we define $F = (f,g,h)$, then its curl can be written:
$$ \nabla \times F = \det \begin{bmatrix} \textbf{i} && \textbf{j} && \textbf{k} \\ \partial_x && \partial_y && \partial_z \\ f && g && h \end{bmatrix}$$
So we get the following result:
Divergence
Now, let’s use the ordering to define a $2$-form $\mu = fdy\wedge dz + gdz \wedge dx + h dx \wedge dy$. Then we showed earlier that $d\mu = (f_x + g_y + h_z) dx \wedge dy \wedge d_z$. In other words:
In three dimensions, we can only take the exterior derivative of a $0,1,$ or $2$-form. In each case, we get the gradient, the curl, and the divergence respectively. We can even state complex ideas in vector calculus simply. For example, since $d^2 = 0$, we know that the divergence of a curl is $0$, and that the curl of a gradient is $0$. These are just some of the amazing things we can say with the language of differential forms. Now, let’s get to integration!
Integrating Differential Forms
My personal favorite definition of a differential form is as follows:
Differential forms are made to be integrated! Let’s see an example of how this works.
Example: Integrating $1$-Forms
Definition: If $\omega$ is a $1$-form, and $\alpha(t)$ is a curve which takes parameter $a\leq t \le b$, then we define the integral:
$$\begin{aligned} \int_\alpha \omega = \int_a^b \omega(\alpha'(t)) \end{aligned}$$
This makes sense, since $\omega$ sends a vector to a number. We can understand this definition by imagining a force field $F$. Recall that a force has a magnitude and a direction; for example, gravity points towards the center of the earth.
At every point $\alpha(t)$ on the curve, define $F(\alpha(t))$ to be the force on that point. Then we define $\omega(\alpha’(t)) = F(\alpha(t)) \cdot \alpha’(t)$. Integrating, we get:
$$\begin{aligned} \int_\alpha \omega = \int_a^b \omega(\alpha'(t)) = \int_a^b F(\alpha(t))\cdot \alpha'(t) \end{aligned}$$
This quantity is exactly the work done by the force $F$ along the curve $\alpha$. Integrating $1$-forms thus gives us line integrals.
Though I won’t get into it, we can similarly define integrals of $2$-forms as something like surface integrals. and integrals of $3$-forms as triple integrals. When you see a single integral sign, think of it as a short hand for whatever type of integration is appropriate given the context. When we integrate over a region, think of a double integral; integrating over a curve, a line integral; and integrating over a 3-dimensional region, a volume integral.
Stokes Theorem
Now, we get into the incredible Stokes’ Theorem, which says the following:
$$\begin{aligned} \int_R \omega = \int_{\partial R} d\omega \end{aligned}$$
$R$, here, represents a region which has a boundary. The boundary is $\partial R$. Some examples are:
- For a segment of the number line $[a,b]$, we define the boundary to be the points $a$ and $b$.
- For a circle, we define the boundary to be its perimeter.
- For a sphere, we define the boundary to be its surface.
So Stokes’ Theorem says: if you integrate $\omega$ inside a region, you will get the same answer as if you integrated $d\omega$ just on the boundary. In the “mansion” analogy, then, $d\omega$ represents something like the flow of people in and out of a room, and $\omega$ represents the flow of people in and out of the mansion.
The amazing thing about Stokes’ Theorem is that it contains everything you learned in vector calculus. Let’s look at some examples. First, let’s start with $1$ dimension.
The Fundamental Theorem of Calculus
Let’s say we have a function $f(x)$, which is a $0$-form. Then, taking the exterior derivative, we get that $df = (df/dx) dx$. Let’s integrate this $1$-form over an interval $a \leq x \leq b$, with boundary ${a,b}$ (a set of just two points). Then Stokes’ Theorem tells us:
$$\begin{aligned} \int_a^b \frac{df}{dx} dx = \int_{\{a,b\}} f(x) \end{aligned}$$
We never defined how to integrate a $0$-form. However, you would expect, since the integral is a “sum”, that integrating $f(x)$ at only two points should be something like $f(a) + f(b)$. Indeed, you’d have the right intuition, but integration requires something called orientation.
Avoiding getting too specific, this is exactly what we were setting up with the mansion analogy by defining outward and inward traffic with different signs. The real line goes left to right. So $a$ is something like an “exit” (negative) and $b$ is something like an entrance (positive). The right hand side becomes $f(b) - f(a)$, yielding:
$$\begin{aligned} \int_a^b \frac{df}{dx} dx = f(b) - f(a) \end{aligned}$$
This is exactly the fundamental theorem of calculus!
Let’s move on to two dimensions.
Gradient Theorem
In two dimensions, we can integrate both $0$-forms and $1$-forms. Let’s start with $0$-forms, which are functions. We showed earlier that the derivative of a $0$-form represents the gradient. In one dimension, that was just the same as the single-variable derivative.
Let’s start with a function or $0$-form $\varphi$ and find its derivative $d\varphi = \nabla \varphi$. Then, we can integrate $\nabla \varphi$ over a curve $\alpha$ whose boundary is a set of points ${a, b}$. As before, we pick $a$ to be negatively oriented, $b$ to be positively oriented. Then Stokes’ Theorem tells us:
$$\begin{aligned} \int_\alpha \nabla \varphi = \varphi(b) - \varphi(a) \end{aligned}$$
And since we know that the left hand side represents a line integral, this is exactly the gradient theorem! In physics, this is one of the ways you can define a conservative force: a conservative force is the gradient of some other function, and thus the work done by a conservative force along any path between two points is the same.
Note that integrating a $0$-form in three dimensions goes pretty much the same way, with the only difference being the number of dimensions.
Green’s Theorem
Now that we’re working in two dimensions, we can differentiate $1$-forms to get $2$-forms. In this case, a $1$-form looks like $Mdx + Ndy$, where $M,N$ are functions. Taking the exterior derivative, we get:
$$\begin{aligned} \int_{\partial R} Mdx + Ndy &= \int_{R} d(Mdx + Ndy) \\ &= \int_{R} (M_y - N_x) dx \wedge dy \end{aligned}$$
Replace the single integral with a double integral, and $dx \wedge dy$ with the familiar $dxdy$, and this is exactly Green’s Theorem! The discrepancy in sign can be explained using the earlier discussion of “orentiation”, which I will not get into right now; we can pick the curve going in the opposite direction to get the correct sign.
Let’s move on to three dimensions!
The (Classical) Stokes’ Theorem
Now we’re finally in three dimensions. Let’s first integrate a $1$-form. Recall that as we showed before, the derivative of a $1$-form represents the curl. So indeed, if we write $F= (f,g,h)$ to represent the $1$-form $\omega = fdx + gdy + hdz$, we get:
$$\begin{aligned} \int_{\partial R} \omega = \int_{\partial R} F \cdot dr = \int_{R} \nabla \times F \end{aligned}$$
Though we did not rigorously define integration of $2$-forms here, you could guess that it looks exactly like surface integration, and you’d be right. The left hand side, as we covered, represents the line integral of $F$ along a curve which is the boundary of $R$. Thus, we have arrived at nothing more than the Stokes’ Theorem which you learned in multivariable calculus.
The Divergence Theorem
Now, finally, there’s only one thing left to do: integrate a $2$-form. Let $F = (f,g,h)$ represent a $2$-form $\omega = f dy \wedge dz + g dz \wedge dx + h dx \wedge dy$. As we showed before, the derivative of a $2$-form represents the divergence. So Stokes’ Theorem tells us:
$$\begin{aligned} \int_{\partial R} \omega = \int_{R} \nabla \cdot F \end{aligned}$$
Again, we did not rigorously define the integration of a $2$-form on the left hand-side; but as you would expect, it is a surface integral, while the right hand side is a volume integral. What we have here is the divergence theorem. As a direct consequence, you get Gauss’ Law from electromagnetism.
As we’ve seen, pretty much everything in vector calculus can be represented using the generalized Stokes’ Theorem and differential forms; nevertheless, it is important to build up a geometric intuition first. The equations themselves are extremely abstract and are almost post hoc explanations of the phenomenon we first understood intuitively. The great thing about this formulation is that it puts five separate theorems (the Fundamental Theorem of calculus, the Gradient Theorem, Green’s Theorem, the classical Stokes’ Theorem, and the Divergence Theorem) in one. If anything, I would call Stokes’ Theorem the real fundamental theorem of calculus.
If you’re interested in reading more about calculus on surfaces, check out these notes I wrote on introductory differential geometry .
Download this Page as a PDF:
Note: Images are replaced by captions.
Share this on:
Recent Posts
- A Note on the Variation of Parameters Method | 11/01/17
- Group Theory, Part 3: Direct and Semidirect Products | 10/26/17
- Galois Theory, Part 1: The Fundamental Theorem of Galois Theory | 10/19/17
- Field Theory, Part 2: Splitting Fields; Algebraic Closure | 10/19/17
- Field Theory, Part 1: Basic Theory and Algebraic Extensions | 10/18/17