Main content

# Divergence intuition, part 1

Vector fields can be thought of as representing fluid flow, and divergence is all about studying the change in fluid density during that flow. Created by Grant Sanderson.

## Want to join the conversation?

- On the topic of fluid density, is divergence used to model traffic density?(9 votes)
- I think it can. The fluid has to be incompressible though.(4 votes)

- How does he make these animations?(5 votes)
- He created his own Python package to do this. You can read more about it here http://www.3blue1brown.com/about/(10 votes)

- I think the property of a divergent vector field is there is some points in the graph that act like sinks or sources? But can a vector field has more than one sink or source?(2 votes)
- Yes, a vector field can have different divergences everywhere.(2 votes)

- The graph of the function f(x, y)=0.5*ln(x^2+y^2) looks like a funnel concave up. So the divergence of its gradient should be intuitively positive. However after calculations it turns out that the divergence is zero everywhere. This one broke my intuition. Why is it so?(2 votes)
- At1:00when showing the synodal curve, does the function change if I'm visualizing fluid in 3-D? So like cross-sectioning a river and looking down on the water versus looking at it from the side at depth?

I also just thought about something, can we account for changes in temperature(energy) and density(water to air)? mathematically?(2 votes) - what is the proper way to view divergence in the context of partial derivative of vector field "mentioned in previous videos"? not mathematically, rather conceptually(2 votes)
- The divergence of a vector field is a measure of the "outgoingness" of the field at all points. If a point has positive divergence, then the fluid particles have a general tendency to leave that place (go away from it), while if a point has negative divergence, then the fluid particles tend to cluster and converge around that point.(1 vote)

## Video transcript

- [Voiceover] Alright everyone. We've gotten to one of
my all-time favorite multi-variable calculus
topics, divergence. In the next few videos I'm gonna describe what it is mathematically
and how you compute it and all of that but
here I just want to give a very visual understanding of what it is that it's trying to represent. So I've got a picture in
front of us, a vector field. I've said before that a pretty neat way to understand vector
fields is to think of them as representing a fluid flow. What I mean by that is you can think of every single point in space as a particle, maybe an air particle or a water particle. Something to that effect. Since what a vector field does is it associates each point in space with some kind of vector and remember I mean, whenever
we represent vector fields, we only show a small subset
of all of those vectors, but in principle you should be thinking of every one of those infinitely
many points in space being associated with
one of these vectors. The fact that they're
kind of smoothly changing as you traverse across space ,means that showing this
very small finite subsample of those infinitely many vectors still gives a pretty good
feel for what's going on. So if we have these fluid particles and you have a vector
assigned to each one, kind of a natural thought
you might have is to say what would happen if you let
things progress over time where at any given instant
the velocity of one of these particles is given by
that vector connected to it. As it moves it will be
touching a different vector. So it's velocity might turn. It might go in a different direction. For each one it will kind
of traverse some path as determined by the vectors
that it's touching as it goes and when you think of all
of them doing this at once, it will feel like a certain fluid flow. For this you don't
actually have to imagine. I went ahead and put together
an animation for you. So we'll put some water molecules or dots to represent a small sample
of the water molecules throughout space here and then
I'm just gonna let it play where each one moves along the
vector that it's closest to. I'll just let it play forward here where each one is flowing along the vector that's touching the point
where it is in that moment. So for example, if we were to go back and maybe focus our
attention on just one vector like this guy, one particle, excuse me, he's attached to this
vector so he'll be moving in that direction but just for an instant because after he moves a little he'll be attached to a different vector. So if you kind of let it play
and follow that particular dot after a little bit you'll
find him elsewhere. I think this is the one, right. Now he's gonna be moving along this vector or whatever one is really attached to him. Thinking about all of the
particles all at once doing this gives a sort of global
view of the vector field. If you're studying math,
you might start to ask some natural questions about
the nature of that fluid flow. For example, you might
wonder if you were to just look in a certain region
and count the number of water molecules that
are inside that region, does that count of yours change as you play this animation, as you let this flow over time? In this particular example you can look and it doesn't look
like the count changes. Certainly not that much. It's not increasing over
time or decreasing over time In a little bit, if I
gave you the function that determines this vector field, you will be able to tell
me why it's the case that the number of
molecules in that region doesn't tend to change but if you were to look
at another example, like a guy that looks like this and if I were to say I want you to focus on what happens around the origin, in that little region around the origin, you can probably predict
how once I start playing it, once I put some water molecules in there and let them flow along the
vectors that they flow along, the density inside that region
around the origin decreases. So we put a whole bunch of vectors there and I'll just play it for a quick instant. Just kind of let it jump for an instant. One thing that characterizes
this field around the origin is that decrease in density. What you might say if you
wanted to be suggestive of the operation that I'm leading to here is that the water
molecules tend to diverge away from the origin. So the kind of divergence
of the vector field near that origin is positive. You'll see what I mean
mathematically by that in the next couple videos, but if we were to flip
over these vectors, right, if we were to flip them around, now if I were to ask about the density in that same region around the origin, we can probably see how
it's gonna increase. When I play that fluid flow
over just a short spurt of time, the density in the region increases. So these don't diverge away, they converge towards the origin. That fact actually has some
mathematical significance for the function representing
this vector field around that point. Even if the vector field
doesn't represent fluid flow, if it represents a magnetic field or an electric field or things like that, there's a certain meaning to this idea of diverging away from a point
or converging to a point. Another way that people
sometimes think about this, if you look at that same kind of outward-flowing vector field as rather than thinking
of a decrease in density, imagining that the fluid
would have to constantly be repopulated around that point. So you're really thinking of
the origin as a source of fluid and if I had animated this better, a whole bunch of other points
should be sources of fluid so that the density doesn't
decrease everywhere, but the idea is that points
of positive divergence where things are diverging away would have to have a source of that fluid in order to kind of
keep things sustaining. Conversely, if you were to look
at that kind of inward flow or what you might call
negative divergence example and you were to play it but
it were to go continuously, you'd have to think of
that center point as a sink where all the fluid kind
of just sort of flows away. That's actually a technical term. People will say the
vector field has a sink at such and such point or
the electromagnetic field has a sink at such and such point and that often has a certain significance. If we go back to that
original example here where there is no change
in fluid density, right, what you might notice,
this feels a lot more like actual water than the other ones because there is no
change in density there. If you can find a way to
mathematically describe that lack of a change in density, it's a pretty good way
to model water flow. Again, even if it's not water flow but it's something like
the electromagnetic field, there's often a significance to this no changing in density idea. So with that I think
I've jabbered on enough about the visuals of it
and in the next video I'll tell you what
divergence is mathematically, how you compute it, go
through a couple examples, things like that. See you next video.