If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Divergence notation

Learn how divergence is expressed using the same upsidedown triangle symbols that the gradient uses. Created by Grant Sanderson.

Want to join the conversation?

  • blobby green style avatar for user Ahmed Sheta
    Isn't it strange that the formula for divergence is the same as the formula for the directional derivative?
    I can get the reason behind the formula of each one independently, but I can't make the connection why the two different ideas (divergence-directional derivative) have exactly the same formulas!
    (15 votes)
    Default Khan Academy avatar avatar for user
    • winston baby style avatar for user Andrew
      They have different formulas:
      The divergence formula is ∇⋅v (where v is any vector).

      The directional derivative is a different thing. For directional derivative problems, you want to find the derivative of a function F(x,y) in the direction of a vector u at a particular point (x,y). It can be any number of dimensions but I'm keeping it x,y for simplicity. The directional derivative is the -dot product- of the GRADIENT of F with the UNIT VECTOR of u: ∇F(x,y) ⋅ u(unit).

      I always believe that working through actual problems is the best way to understand something, so for the sake of your understanding and my own, let's do an example:

      Suppose F(x,y) = x^2 * y. What is the derivative of F(x,y) in the direction of (1,2) at the point (3,2)?
      Firstly we have to calculate the gradient of F(x,y). The gradient of F(x,y) is basically the vector field of all of F(x,y)'s partial derivatives: (∂F/∂x, ∂F/∂y). ∂F/∂x = 2xy. ∂F/∂y = x^2.
      Since we want to evaluate the directional derivative at point (3,2): ∂F/∂x = 2(3)(2) = 12 and ∂F/∂y = (3)^2 = 9. Thus ∇F(x,y) = (12,9)
      Now, we have to evaluate the derivative at the direction of (1,2), so let's assign vector u the direction (1,2). The unit vector of u is:
      u/|u| = (1,2)/√ (1^2 + 2^2) = (1,2)/√ 5 = (1/√ 5 , 2/√ 5 ).
      The directional derivative is :
      ∇F(x,y) ⋅ u(unit) = (12,9) ⋅ (1/√ 5 , 2/√ 5 ) = 12/√ 5 + 18/√ 5 = 30/√ 5

      Calculating divergence is much simpler:
      If we want to calculate the Divergence for F(x,y) = (x^2 * y, xy) at (5,4), all we need to do is take the dot product of F(x,y) with the (∂/∂x, ∂/∂y) operator:
      Div (F(x,y)) = ∂/∂x (x^2 * y) + ∂/∂y (xy) = 2xy + x = 2(5)(4) + (5) = 40 + 5 = 45. No unit vectors vectors or directional vectors needed.

      I hope this oversized explanation helped a little bit
      (52 votes)
  • hopper cool style avatar for user Dhaval Furia
    Imagining the divergence as a dot product implies that the divergence can't be defined when the number of components in the input and output are different.
    How can we think of this intuitively ?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • leafers seedling style avatar for user Alexey Tanashkin
      When we have a function which has the same number of input and output components, we can think about it as it takes a point in space and associates a vector with this point which tells a direction of movement and speed of a particle placed in this point. That is what vector fields are all about. Therefore the output vector and the input point should be in the same space otherwise associating a vector with a point will make no sense. Hope it helps!
      (4 votes)
  • duskpin seedling style avatar for user Harish Madhavan
    I have a really weird question. According to the definition for dot product, a. b = |a||b|cost, where t is the angle b/w the vectors a and b.

    Now, my question is "What happens if I sub nabla for a and some vector field v for b?" It seems so meaningless and absurd to ask what angle a partial differential operator makes with respect to a vector field.
    (3 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user eugene
    Video says you take partial derivatives of a function and then add them together. But..it looks like you are taking only the partial derivative of one variable, say x, of only one function, P in the video. It's like the partial derivative with respect to the other functions Q and R (for variable x) is just..skipped. Question: so does the divergence formula require partial derivative of a variable, x or y or z, with respect to only 1 function, either Q or R or P? I mean...do we just pick and choose? How about situations where you have two variables, x and y, but three functions, P, Q, and R?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Suyash Kumar
      A function in (x,y) which has three outputs (P(x,y), Q(x,y), R(x,y)) is an example of a parametric surface. We don't need to define divergence for a parametric surface, because divergence is a concept solely modeled for vector fields. It is valid however to take partial derivatives of parametric surfaces with respect to its two parameters, which has been discussed in an earlier series.
      (3 votes)
  • leafers ultimate style avatar for user efmriccio
    If the input and output have different dimensions, could you just think of the term at the mismatched dimension(s) to be zero in the respective set for the dot product and just have that dimension not weigh in on the divergence?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • spunky sam blue style avatar for user Mohammad Saad
    does the divergence/curl value of a vector field change on changing the coordinate system? suppose there is a field whose divergence is zero in Cartesian, then will the divergence remain the same in cylindrical/spherical coordinate systems?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Mez Cooper
    Does the nabla vector mean anything on its own? What do partials with respect to x, y, z (the different components of nabla) mean if there is no function to operate on?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Briek De Malsche
      The nabla-operator, like all operators, doesn't mean anything on its own. Operators are just a symbol that represents a certain operation, so they only make sense when they're accompanied by something to operate on. You can compare the nabla-operator to a factorial operator (!): the operator on its own has no meaning, but when you use the operator on a number (like '5!') it does.
      (1 vote)
  • leaf blue style avatar for user Jason.Louie.Earle
    I get tripped up by notation a lot. For instance, I sometimes see a nabla symbol squared (for the Laplacian operator), and I have to remember if that means that I'm squaring the result of a single operation, or if I'm applying the operator twice. Same with 2nd derivatives and 2nd partial derivatives!

    Is it preferred to use "div" or "nabla dot" when writing this operation?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • male robot donald style avatar for user Venkata
      I usually prefer writing $DivF$ when solving problems. $\nabla \cdot F$ is only a way to write the formula for divergence shorthand (and a shorthand way to remember it too. It helps in deriving it if you forget the formula). However, if you can remember how to calculate divergence given a vector field, you don't need to use $\nabla \cdot F$

      As for second derivative and second partials, see that second partials are just second derivatives with d replaced by $\partial$. So, I think that shouldn't be too confusing
      (1 vote)

Video transcript

- [Voiceover] So I've said that if you have a vector field, a two-dimensional vector field with component functions P and Q, that the divergence of this guy, the divergence of v, which is a scalar-valued function of x and y, is by definition, the partial derivative of P, with respect to x, plus the partial derivative of Q, with respect to y. And there's actually another notation for divergence that's kind of helpful for remembering the formula. And what it is, is you take this nabla symbol, that upside down triangle that we also use for the gradient, and imagine taking the dot product between that and your vector-valued function. And as we did with the gradient, the loose mnemonic you have for this upside down triangle, as you think of it as a vector, full of partial differential operators, and that sounds fancy but all it means is you kind of take this partial, partial x, a thing that wants to take in a function and take its partial derivative, and that's its first component, and the second component is this partial, partial y, a thing that wants to take in a function and take its partial derivative with respect to y. And, you know, loosely this isn't really a vector, these aren't numbers, or functions, or things like that, but it's something you can write down and it'll be kind of helpful symbolically. And you imagine taking the dot product with that, and, you know, v who has components, these scalar-valued functions, P of xy, and Q of xy. And when you imagine doing this dot product, and you're kind of lining up terms and the first one multiplied by the second, right, quote unquote multiplied, because, in this case, when I say this first component multiplied by p, I really mean you're taking that partial derivative operator partial, partial x, and evaluating it at p. That's kind of what multiplication looks like in this case. So, you take that, and as per the dot product you then add, what happens if you take this partial operator, this partial, partial y, and quote unquote, multiply it with q. Which, in the case of an operator, means you kind of give it the function q and it's gonna take its partial derivative. So, we see we get the same thing over here, it's the same formula that we have, and it's just kind of a nice, little, you can think of it as a mnemonic device for remembering what the divergence is. But another nice thing, this can apply to higher-dimensional functions, as well. Right? If we have something that, let's see, something that's a vector-valued function, and it's gonna be a three-dimensional vector field. So, it's got x, y, and z as its inputs, and its output then also has to have three dimensions. So, it might be like, P, Q, and R, and all of these are functions of x and y. So, that's P of x and y, Q, oh no, x, y, and z, right? So, P of x, y, kind of got in the habit of two dimensions there, P of x, y and z, Q of x, y, and z, and then R of x, y, and z. And I haven't talked about three-dimensional divergence. But if you think of this and then you imagine doing your nabla, dotted with the vector-valued function, it can still make sense. And in this case, that nabla you're thinking of as having three different components. It's gonna be, on the one hand this partial, partial x, I should say partial x there, partial x, now the second component is partial, partial y, and the last component is partial, partial z. And the ordering of these, of the variables, here, x, y and z is just whatever I have here. So, even if they didn't have the names x, y, z, you kinda out them in the same order that they show up in your function. And when you imagine taking the dot product between this, and your P as a function, Q as a function, and R as a function, vector-valued output, what you get, and I'll write it over here, you take that partial, partial x and kind of multiply it, with P, which means you're really evaluating at P. So, partial x here. Then you add partial, partial y. And you're evaluating at Q, because you're kind of imagining multiplying these second components. And you'll add what happens when you multiply by these third components, or that's partial, partial z, by that last component. And, you know, since I haven't talked about three-dimensional vector fields, with three-dimensional divergence, this last term, maybe it's not given that you'd have as strong an intuition for why this shows up in divergence as the other two, but it's actually quite similar, you're thinking about changes to the z component of a vector as the value z, of the input, as you're kind of moving up and down and that direction changes. But this pattern will go for even higher dimensions that we can't visualize, four, five, 100, whatever you want. And that's what makes this notation here quite nice, is that it encapsulates that and gives a really compact way of describing this formula that, it has a simple pattern to it, but would otherwise kind of get out of hand to write. See you next video.