Divergence (article)

Calculus 2 – Integral Test For Convergence and Divergence of Series
Calculus 2 – Integral Test For Convergence and Divergence of Series

Main content

Multivariable calculus

Divergence

Divergence measures the change in density of a fluid flowing according to a given vector field.

Background

What we’re building to

  • Interpret a vector field as representing a fluid flow.
  • The divergence is an operator, which takes in the vector-valued function defining this vector field, and outputs a scalar-valued function measuring the change in density of the fluid at each point.
  • This is the formula for divergence:Here, , , are the component functions of .

Changing density in fluid flow

Take a look at the following vector field:

So that’s the picture, but what’s the function?

The inputs to are points in two-dimensional space, , and the outputs are two-dimensional vectors, which in the vector field are attached to the corresponding point .

A nice way to think about vector fields is to imagine the fluid flow they could represent. Specifically, for each point in two-dimensional space, imagine a particle sitting at flowing in the direction of the vector attached to that point, . Moreover, suppose the speed of the particle’s movement is determined by the length of that vector. The following animation shows what this might look like for our given function for just a brief instant:

Notice, during this fluid flow, some regions tend to become less dense with dots as particles flow away, such as the upper middle section. On the other hand, down and to the left of that region, particles tend to flow towards each other and the dots get more dense.

Key question: For a given vector-valued function , how can we measure the change in density of particles around a point as these particles flow along the vectors given by ?

We can answer this question using a variation of the derivative called divergence. We’ll talk more about fluid flow below, but first, let’s establish the notation and formula used to express this concept.

Notation and formula for divergence

The notation for divergence uses the same symbol “” which you may be familiar with from the gradient. As with the gradient, we think of this symbol loosely as representing a vector of partial derivative symbols.

We write the divergence of a vector-valued function like this

This is mildly nonsensical since isn’t really a vector. Its entries are operators, not numbers. Nevertheless, using this dot product notation is super helpful for remembering how to compute divergence, just take a look:

More generally, the divergence can apply to vector-fields of any dimension. This means can have any number of input variables, as long as its output has the same dimensions. Otherwise, it couldn’t represent a vector field. If we write component-wise like this:

Then the divergence of looks like this:

Let’s summarize this with a quick diagram:

Interpretation of divergence

Let’s say you evaluate the divergence of a function at some point , and it comes out negative.

This means a fluid flowing along the vector field defined by would tend to become more dense at the point . For example, the following animation shows a vector field with negative divergence at the origin.

On the other hand, if the divergence at a point is positive,

the fluid flowing along the vector field becomes less dense around . Here’s an example:

Finally, the concept of zero-divergence is very important in fluid dynamics and electrodynamics. It indicates that even though a fluid flows freely, its density stays constant. This is particularly handy when modeling incompressible fluids, such as water. In fact, the very idea that a fluid is incompressible can be tightly communicated with the following equation:

Such vector fields are called “divergence-free.” Here’s an example of what that might look like:

Sources and sinks

Sometimes, for points with negative divergence, instead of thinking about a fluid getting more dense after a momentary fluid motion, some people imagine the fluid draining at that point while the fluid flows constantly. Here’s what this might look like:

As such, points of negative divergence are often called “sinks.”

Likewise, instead of thinking of points with positive divergence as becoming less dense during a momentary motion, these points might be thought of as “sources” constantly generating more fluid particles.

Divergence in higher dimensions

Although all the diagrams and animations I’m making show the two-dimensional case, you should understand that all these concepts could apply to three or more dimensions as well.

Try this as a good mental exercise to test if you understand what divergence represents: Imagine a three-dimensional vector field, and picture what points of positive, negative, and zero divergences might look like.

Example 1: Compute and interpret divergence

Vector field for Example 1

Problem: Define a vector field by

Compute the divergence, and determine whether the point is more of a source or a sink.

Step 1: Compute the divergence.

Step 2: Plug in .

Step 3: Interpret. Is the fluid more of a source or a sink at ?

Confusing signs

It always trips me up that positive divergence indicates a negative change in density, and that a negative divergence indicates a positive change in density. Isn’t that confusing? The sources/sinks interpretation helps a bit, because points of positive divergences are generating more fluid, while points of negative divergence are sucking it away.

Personally, the way I always remember is to think of the case when is the identity function, taking the point to the vector . The resulting vector field has all vectors pointing away from the origin (can you see why?), and it’s relatively quick to compute .

So each time I return to divergence after not having seen it for a while and think “hmm, is it positive or negative divergence that indicates a loss in density,” I go through this little exercise and remember, “Ah yes, that’s how it goes, positive divergence indicates an outward flow.”

Further resources

In the next article, I’ll give an intuition for why the formula for divergence has anything to do with fluid flow.

Later on, once line integrals and surface integrals are covered, I talk about the formal definition of divergence.

Summary

  • Interpret a vector field as representing a fluid flow.
  • The divergence is an operator, which takes in the vector-valued function defining this vector field, and outputs a scalar-valued function measuring the change in density of the fluid at each point.
  • The formula for divergence iswhere , , are the component functions of .

Keep in mind, though, divergence is used in all sorts of contexts which can have nothing to do with fluid. Electrodynamics is a big one, for example. The fluid flow interpretation is very useful, and gives a much stronger intuition than a blind use of symbols would, but it should be taken with a grain of salt from time to time.

Want to join the conversation?

  • Will there be exercises for multivariable calculus in the future?(49 votes)
    • I’m almost sure that KA’s goal is to develop practice and then mastery exercises for every subject, but since it is a work in progress, they are probably focusing on what they feel is most important at the moment. I’m guessing that the majority of users on KA are not here for more advanced math like this course, so they may be trying to focus on other subjects, or lower level math. For example this July/August they are coming out with quite a few more exercises here all the way up to BC Calculus. You can find this here:
      https://khanacademy.zendesk.com/hc/en-us/articles/115007408888
      It seems in the past six months the team has been working more on statistics, history, and more tools for teachers/coaches. It must be a tough task to try to work on so many things at once, but hopefully they can get some exercises for this stuff in the next few years as well!(20 votes)
  • Why not just call the negative of divergence the “convergence” and eliminate all confusion? You can look at a source or sink and instantly tell if the particles are converging, coming toward each other. Faster than telling if they are doing the opposite of that, and eliminates confusion (converge = high density).(16 votes)
    • On the contrary, it will be more confusing.
      Example 1. Consider the inverse of what the author uses as a reminder, the function which takes the point (x, y) to the vector (-x,-y):
      f(x,y)=-xi-yj
      The resulting vector field has all vectors pointing to the origin, the divergence is negative and equals to -2. In this case the divergence is negative at any point of the field but intuitively you think about it as coverging only at the origin.
      Example 2. Consider the function which takes the point (x, y) to the vector (-exp(x), 0):
      f(x,y)=-exp(x)i
      The resulting vector field has all vectors pointing horisontally to the left since theres no y component and the divergence is again strictly negative at any point. Nevertheless this flow never converges anywhere (except maybe when x equals minus infinity).(10 votes)
  • Technically operators are functions. When I first learned about them, functions are anything that takes in something and outputs an unambiguous something else. For example, there was f(Paul) = Mary or something like that. So functions probably can also input and output other functions. Therefore, divergence is a function that inputs and outputs functions that input and output vectors and scalars, respectively.
    Right……?(3 votes)
    • Not quite. Operators are more fundamental… The plus sign “+” is an operator, for example, although it is “infix”, meaning the first argument/parameter goes in front of it rather than after. If it wasn’t infix, x+y would look something like this: +(x,y) or more clearly, sum(x,y). Likewise with multiply(x,y) and subtract(x, y), etc. Other operators are not infix, such as derivative(x) or grad(x), written with their respective symbols. But how would you define these “functions” with only other symbols, without explaining their abstract concepts?
      I mean, some function f(x) could be defined as f(x)=3+x. Simple. g(y) = 4/y. and so on. But notice how I had to use those fundamental operators to define them? (+ and /)
      Yet those operators can’t be written in such a way. What’s the definition of sum(x,y)? “You just gotta add them”. F(x) might be equal to 1, and derivative(x) also. But can you write out a function f( ) that always puts out exactly what derivative( ) puts out? Try it.
      Something that “takes something in and outputs something else” is not specific enough to define functions, nor operators, for this reason. You will see that they are not the same thing. You can describe a function in terms of operators (“this function adds three to its input”), but you can’t describe those operators without more operators (“what do you mean, ‘adds’? What is this ‘addition’ you speak of?”)
      You could think of operators as “verbs”. They’re like “actions” you can take on some function/expression that keeps it a function/expression. Like, “take the derivative”. That’s a verb that does things to functions, not just variables and constants.
      Sure, you can define a function like f(x) in terms of another, such as f(x) = g(x) +3, where g(x) is x+2. But for x=7 you’d first evaluate g(7)=9 and pass it into f(7)=9+3=12, whereas you cannot do that with deriv( m(x) ) where m(x) = x^2, because passing the constant (7)^2=49 into deriv(49) gets you zero, when you should have passed the x^2 as it is, getting you deriv(x^2) = 2x, which you can then evaluate to get 14. Operators cannot be “evaluated” at a value like functions, they fundamentally change the function (x^2 –> 2x) and must always be done first (highest precedence, so before anything else in PEMDAS) so are called left-associative instead of right-associative (done from the outside in. instead of instead out). So in F(deriv(x(y(t)))+2), that derivative must be done before its insides (x,y…) and even before it can be passed to the function outside (F) that contains it. It’s kind of like the difference between “pass by reference” and “pass by value” in computer science. You work directly on the input function itself (“reference”) rather than it’s output (“value”).(20 votes)
  • The “quick diagram” is so tiny that it’s practically impossible to see…(3 votes)
  • I would suggest remembering the sign-divergence stuff just by understanding that the word ‘divergence’ means ‘the quality of going out from a single point,’ and when there is a positive divergence, that means there IS divergence, whilst when there is a negative one, that means there IS a sort of ‘anti-divergence.'(3 votes)
  • why don’t we use the y coordinate in the first partial derivative, and the x coordinate in the second partial derivative for the divergence?(2 votes)
  • what is the difference between divergence and gradient? are they same(2 votes)
    • The gradient of a function is a vector that consists of all its partial derivatives.
      For example, take the function f(x,y) = 2xy + 3x^2. The partial derivative with respect to x for this function is 2y+6x and the partial derivative with respect to y is 2x. Thus, the gradient vector is equal to <2y+6x, 2x>. Divergence, on the other hand, is described above in the article and can be thought of as the dot product between a vector of partial derivatives and the vector function that determines the vector field. Hope this helps!(1 vote)
  • Hi, I would like to know if I have the function
    vf(x,y) = [xy, y^2], why it is being done just by two partial derivatives like:
    [y,2y] but not it this way [[y,x],[2y,0]](1 vote)
    • You do not get a 2×2 matrix of derivatives (called the Jacobian, and referenced in this article), because you are not taking all possible derivatives when calculating divergence. You just take d/dx(vsubx) + d/dy(vsuby), where vsubx is the function that is the x-component of v and vsuby is the y-component of v. Hope this helps!(2 votes)
  • Is it correct to say that on simple addition of the terms of gradient ,we obtain the divergence?
    And also why is it that the summation of these terms determines why the fluid is getting collected or distributed…?
    *The summation in itself doesn’t appear to be something so significant in terms of first impressions..*(1 vote)
    • To answer your first question, it is not quite accurate to say that we are adding the terms of the gradient, because the gradient is only defined for functions that output scalar values, and divergence is defined for vector-valued functions.(1 vote)
  • Looking at the Incompressible Fluid Flow Example; it appears that both the X and Y coordinate values of the vectors change while moving from left-to-right through any point on the graph, yet neither the X or Y coordinates change while moving from bottom-to-top through any point on the graph. That seems to imply that the partial derivative of the first vector coordinate v1 with respect to x is nonzero, while the partial derivative of of the second vector coordinate v2 with respect to y remains zero. The divergence is defined as the sum of these two partial derivative scalars (is that correct?). Adding the two scalars yields a nonzero scalar everywhere on the graph, thus the divergence would be nonzero everywhere, indicating some divergence or convergence (compressibility). This must reflect an incorrect understanding of divergence, as the example is for incompressibilty. How is this incorrect?(1 vote)

You are watching: Divergence (article). Info created by THVinhTuy selection and synthesis along with other related topics.

Rate this post

Related Posts