### Video Transcript

Today, you and I are gonna get into divergence and curl, two central ideas from
vector calculus. But if you’ll indulge me, it’s worth sharing a little bit about the writing
trajectory that led me here. I originally started writing this video to be a follow-up to the last one about
alternate ways to think about the derivative. Namely, it was gonna be a view of what it means for a complex function to have a
derivative.

Now those functions are interesting once you know them. But until then, the words “complex derivative” aren’t exactly the best way to hold a
new learner’s attention. So I wanted to center it around some tangible motivating example for where these
functions pop up. And one that’s pretty interesting and fun to illustrate is that a certain
representation of a very simple function, 𝑧 plus one divided by 𝑧, can be seen as
giving an idealized model for fluid flow around a cylinder. I will explain what I mean by this fully later on.

But in a nutshell, these warped grid lines represent where the real and imaginary
parts of the output stay constant. And what arises from this is that the horizontal lines show these streamlines for
flow around a cylinder. And that flow is fast in regions where the vertical lines are closer together and
slow in regions where those vertical lines are farther apart. So that’s kind of interesting. But what’s more fun is that if you shift and scale this setup in the appropriate way
and then apply that same simple function, 𝑧 plus one divided by 𝑧, to
everything. What you now get is a simplified model for flow around this air-foil-looking
shape. Intriguing, right?

And more still, that same original warped grid also has a completely different
physical interpretation. Imagine you have a uniform electric field, pointing up. Meaning it would push positively charged particles upward, and it would pull
negatively charged ones down. If you put some copper wire into this field, one with a circular cross section. Then under the assumption that the charges in that wire are free to move around, the
negative charges are gonna accumulate in a certain way on the bottom, leaving the
top generally positively charged. And this will result in some change to the electric field around the wire.

Now those same warped horizontal lines that previously described streamlines for the
idealized flow around a cylinder happen to be exactly the lines of equal electric
potential for this new field. In other words, stepping from one of these lines to an adjacent one corresponds to a
constant voltage drop. Now this is cool, right? Cause it raises a lot of good questions. What does idealized fluid flow have to do with electric potential? And what do both of these have to do with complex numbers?

If you wanna understand what’s going on here, you need to be comfortable with two
central ideas from vector calculus: divergence and curl. Now for me writing this, scope creep eventually turned into a sort of scope meiosis
as the section giving the background grew out into its own video. And, well, here we are now. Anyway, you might be wondering why am I spending your precious minutes and my
precious hours to tell you about this, rather than just jumping straight into the
actual topic.

Well, individual topics tend to be less enlightening than the connections between
them. And learning about divergence and curl runs the risk of feeling kind of arbitrary if
it comes across as just some other thing that you do with derivatives. But there’s something more exhilarating while learning it, if from the get-go you
have some awareness for just how far-reaching these ideas will be.

To make sure we’re all on the same page, let’s begin by talking about vector
fields. Essentially, a vector field is what you get if you associate each point in space with
a vector, some magnitude and direction. Maybe those vectors represent the velocities of particles of fluid at each point in
space. Or maybe they represent the force of gravity at many different points in space, or
maybe a magnetic field strength.

Quick note on drawing these. Often if you were to draw the vectors to scale, the longer ones end up just
cluttering up the whole thing. So it’s common to basically lie a little and artificially shorten ones that are too
long, maybe using color to give some vague sense of length.

Now in principle, vector fields in physics might change over time. In almost all real-world fluid flow, the velocities of particles in a given region of
space will change over time in response to the surrounding context. Wind is not a constant. It comes in gusts. An electric field changes as the charged particles characterizing it move around. But here, we’ll just be looking at static vector fields, which maybe you think of as
describing a steady-state system.

Also, while such vectors could in principle be three-dimensional, or even higher,
we’re just gonna be looking at two dimensions. An important idea which regularly goes unsaid is that you can often understand a
vector field which represents one physical phenomenon better by imagining what if it
represented a different physical phenomenon. What if these vectors describing gravitational force instead defined a fluid
flow? What would that flow look like? And what can the properties of that flow tell us about the original gravitational
force? And what if the vectors defining a fluid flow were thought of as describing the
downhill direction of a certain hill? Does such a hill even exist? And if so, what does it tell us about the original flow?

These sorts of questions can be surprisingly helpful. For example, the ideas of divergence and curl are particularly viscerally understood
when the vector field is thought of as representing fluid flow, even if the field
you’re looking at is really meant to describe something else, like an electric
field. Here, take a look at this vector field, and think of each vector as describing the
velocity of a fluid at that point.

Notice that when you do this, that fluid behaves in a very strange nonphysical
way. Around some points, like these ones, the fluid seems to just spring into existence
from nothingness, as if there’s some kind of source there. Some other points act more like sinks, where the fluid seems to disappear into
nothingness. The divergence of a vector field at a particular point of the plane tells you how
much this imagined fluid tends to flow out of or into small regions near it.

For example, the divergence of our vector field evaluated at all of those points that
act like sources will give a positive number. And it doesn’t just have to be that all of the fluid is flowing away from that
point. The divergence would also be positive if it was just that the fluid coming into it
from one direction was slower than the flow coming out of it in another
direction. Since that would still insinuate a certain spontaneous generation.

Now on the flip side, if in a small region around a point there seems to be more
fluid flowing into it than out of it, the divergence at that point would be a
negative number. Remember, this vector field is really a function that takes in two-dimensional inputs
and spits out two-dimensional outputs. The divergence of that vector field gives you a new function, one that takes in a
single 2D point as its input. But its output depends on the behavior of the field in a small neighborhood around
that point. In this way, it’s analogous to a derivative. And that output is just a single number, measuring how much that point acts as a
source or a sink.

I’m purposefully delaying discussion of computations here. The understanding for what it represents is more important. Notice, this means that, for an actual physical fluid, like water, rather than some
imagined one used to illustrate an arbitrary vector field. Then if that fluid is incompressible, the velocity vector field must have a
divergence of zero everywhere. That’s an important constraint on what kinds of vector fields could solve real-world
fluid flow problems.

For the curl at a given point, you also think about the fluid flow around it. But this time, you ask how much that fluid tends to rotate around the point. As in, if you were to drop a twig in the fluid at that point, somehow fixing its
center in place, would it tend to spin around? Regions where that rotation is counterclockwise are said to have positive curl. And regions where it’s clockwise have negative curl. And it doesn’t have to be that all of the vectors around the input are pointing
counterclockwise or all of them are pointing clockwise.

A point inside a region like this one, for example, would also have nonzero curl. Since the flow is slow at the bottom but quick up top, resulting in a net clockwise
influence. And really, true proper curl is a three-dimensional idea. One where you associate each point in 3D space with a new vector characterizing the
rotation around that point according to a certain right-hand rule. And I have plenty of content from my time at Khan Academy describing this in more
detail, if you want.

But for our main purpose, which is gonna be showing the connection between these
vector calculus ideas and complex analysis. I’ll just be referring to the two-dimensional variant of curl, which associates each
point in 2D space with a single number rather than a new vector. As I said, even though these intuitions are given in the context of fluid flow, both
of these ideas are significant for other sorts of vector fields.

One very important example is how electricity and magnetism are described by four
special equations. These are known as Maxwell’s equations. And they’re written in the language of divergence and curl. This top one, for example, is Gauss’s law. Stating that the divergence of an electric field at a given point is proportional to
the charge density at that point.

Unpacking the intuition for this, you might imagine positively charged regions as
acting like sources of some imagined fluid and negatively charged regions as being
the sinks of that fluid. And throughout parts of space where there is no charge, the fluid would be flowing
incompressibly, just like water. Of course, there’s not some literal electric fluid. But it’s a very useful and a very pretty way to read an equation like this.

Similarly, another important equation is that the divergence of the magnetic field is
zero everywhere. And you could understand that by saying that if the field represents a fluid flow,
that fluid would be incompressible, with no sources and no sinks. It acts just like water. This also has the interpretation that magnetic monopoles, something that acts just
like a north or a south end of a magnet in isolation, don’t exist. There’s nothing analogous to positive and negative charges in an electric field.

Likewise, the last two equations tell us that the way that one of these fields
changes depends on the curl of the other field. And really, this is a purely three-dimensional idea and a little outside of our main
focus here. But the point is that divergence and curl arise in contexts that are unrelated to
flow. And side note, the back-and-forth from these last two equations is what gives rise to
light waves. And quite often, these ideas are useful in contexts which don’t even seem spatial in
nature at first.

To take a classic example that students of differential equations often study, let’s
say that you wanted to track the population sizes of two different species, where
maybe one of them is a predator of another. The state of this system at a given time, meaning the two population sizes, could be
thought of as a point in two-dimensional space, what you would call the “phase
space” of this system.

For a given pair of population sizes, these populations may be inclined to change
based on things like how reproductive are the two species or just how much does one
of them enjoy eating the other one. These rates of change would typically be written analytically as a set of
differential equations.

It’s okay if you don’t understand these particular equations. I’m just throwing them up for those of you who are curious, and because replacing
variables with pictures makes me laugh a little bit. But the relevance here is that a nice way to visualize what such a set of equations
is really saying is to associate each point on the plane, each pair of population
sizes, with a vector indicating the rates of change for both variables.

For example, when there are lots of foxes, but relatively few rabbits, the number of
foxes might tend to go down because of the constrained food supply. And the number of rabbits might also tend to go down because they’re getting eaten by
all of the foxes, potentially at a rate that’s faster than they can reproduce. So a given vector here is telling you how, and how quickly, a given pair of
population sizes tends to change.

Notice, this is a case where the vector field is not about physical space. But instead, it’s a representation of a certain dynamic system that has two variables
and how that system evolves over time. This can, maybe, also give a sense for why mathematicians care about studying the
geometry of higher dimensions. What if our system was tracking more than just two or three numbers?

Now the flow associated with this field is called the phase flow for our differential
equation. And it’s a way to conceptualize at a glance how many possible starting states would
evolve over time. Operations like divergence and curl can help to inform you about the system. Do the population sizes tend to converge towards a particular pair of numbers? Or there’re some values that they diverge away from? Are there cyclic patterns? And are those cycles stable or unstable?

To be perfectly honest with you, for something like this, you’d often want to bring
in related tools beyond just divergence and curl. Those would give you the full story. But the frame of mind the practice with these two ideas brings you carries over well
to studying setups like this with similar pieces of mathematical machinery.

Now if you really wanna get a handle on these ideas, you’d wanna learn how to compute
them and to practice those computations. Then I’ll leave some links to where you can learn about this and practice if you
want. Again, I did some videos and articles and worked examples for Khan Academy on this
topic during my time there. So too much detail here will start to feel redundant for me.

But there is one thing worth bringing up, regarding the notation associated with
these computations. Commonly, the divergence is written as a dot product between this upside-down
triangle thing and your vector field function. And the curl is written as a similar cross-product. Sometimes students are told that this is just a notational trick. Each computation involves a certain sum of certain derivatives. And treating this upside-down triangle as if it was a vector of derivative operators
can be a helpful way to keep everything straight. But it is actually more than just a mnemonic device. There is a real connection between divergence and the dot product and between curl
and the cross-product.

Even though we won’t be doing practice computations here, I would like to give you at
least some vague sense for how these four ideas are connected. Imagine taking some small step from one point of your vector field to another. The vector at this new point will likely be a little bit different from the one at
the first point. There will be some change to the function after that step, which you might see by
subtracting off your original vector from that new one. And this kind of difference to your function over small steps is what differential
calculus is all about.

Now the dot product gives you kind of a measure of how aligned two vectors are,
right? Now the dot product of your step vector with that difference vector that it causes
tends to be positive in regions where the divergence is positive, and vice
versa. In fact, in some sense, the divergence is a sort of average value for this dot
product of a step with a change to the output that it causes over all possible step
directions, assuming that things are rescaled appropriately.

I mean, think about it. If a step in some direction causes a change to that vector in that same direction,
this corresponds to a tendency for outward flow, for positive divergence. And on the other flip side, if those dot products tend to be negative. Meaning the difference vector is pointing in the opposite direction from the step
vector. That corresponds with the tendency for inward flow, negative divergence.

Similarly, remember that the cross-product is a sort of measure for how perpendicular
two vectors are. So the cross-product of your step vector with the difference vector that it causes
tends to be positive in regions where the curl is positive, and vice versa. You might think of the curl as a sort of average of this step vector–difference
vector cross-product. If a step in some direction corresponds to a change perpendicular to that step, that
corresponds to a tendency for flow rotation.

Alright, so with those as the intuitions for divergence and curl, our next step is
gonna be to understand how functions of complex numbers give us a really elegant way
to produce vector fields where the curl and the divergence are both zero throughout
a given region. Thought of in terms of flow, this describes fluids which are both incompressible and
irrotational. Thought of in terms of electromagnetism, this gives steady-state fields in a vacuum,
where there are no charges and no current. This is what I’ll be talking about in the next video. Where you and I will return back to those models for flow around a cylinder and
around an air foil. And importantly, we’ll talk about where those models fall short and why.