# Divergence
Recall the idea of a [vector field](Vector-Fields.md). Consider the vector field below and think of it as representing a fluid flow.

### Sources and Sinks
Notice that the fluid seems to behave in a very strange, non physical way. Around some points the fluid seems to simply spring into existence from nothingness (as if there is some kind of **source** there):

And around others it appears to disappear into nothingness (as if there is a **sink** there):

### Divergence
The **divergence** of a vector field at a particular point in the plane tells you how much this imagined fluid tends to flow *out of* or *into* small regions of near it:

So, the divergence of our vector field at all points that act like sources will give a positive number. On the other hand, points that act like sinks would be negative. Also, we would have a positive divergence if the flow that was coming into it from one side was slower than it exiting!

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 us a new function*! One that takes in a single 2-d 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 analgous to a *derivative*. That output is just a single number: how much does that point act as a source or sink.
### Notation
We often write divergence as the dot product between a particular operator (the vector derivative, i.e. [the gradient](https://en.wikipedia.org/wiki/Gradient#)), $\nabla$, and our field $F$:



Watch [here](https://youtu.be/rB83DpBJQsE?t=653) for more details.
### Computation/Mechanics
These 3 videos do a good job of explaining the computation of divergence:
* [Divergence formula part 1](https://www.youtube.com/watch?v=uOX7SijjH9w&list=PLSQl0a2vh4HC5feHa6Rc5c0wbRTx56nF7&index=51)
* [Divergence formula, pt 2](https://www.youtube.com/watch?v=TKlpZ0UUJTQ&list=PLSQl0a2vh4HC5feHa6Rc5c0wbRTx56nF7&index=52)
We can roughly summarize as:
> A positive divergence corresponds to a positive partial derivative.


#### Example


---
Links to: [Curl](Curl.md) [Laplacian](Laplacian.md)
References:
* [Divergence and Curl - 3b1b](https://www.youtube.com/watch?v=rB83DpBJQsE&t=286s)
* [Divergence intuition 1, 3b1b khan](https://www.youtube.com/watch?v=c0MR-vWiUPU)
* [Divergence intuition 2, 3b1b khan](https://www.youtube.com/watch?v=Yeie-aJT2eU)
* [Divergence formula, pt 1](https://www.youtube.com/watch?v=uOX7SijjH9w&list=PLSQl0a2vh4HC5feHa6Rc5c0wbRTx56nF7&index=51)
* [Divergence formula, pt 2](https://www.youtube.com/watch?v=TKlpZ0UUJTQ&list=PLSQl0a2vh4HC5feHa6Rc5c0wbRTx56nF7&index=52)
* [Divergence computation, 3b1b khan](https://www.youtube.com/watch?v=AlXVrAOls-8)
* [Whiteboard notes 1, why divergence only depends on partials](https://photos.google.com/photo/AF1QipMNn2e-b-SanN6eOLuU-m-VH8a-KgjYkClNoUxf)
* [Why divergence only depends on partials]](https://sites.google.com/site/butwhymath/calculus/divergence)