Multivariable calculus
Divergence of F = (xyz, y^2, z sin x)
For F(x, y, z) = (xyz, y^2, z sin x) the divergence is yz + 2y + sin x. Differentiating xyz with respect to x leaves yz, y^2 with respect to y leaves 2y, and z sin x with respect to z leaves sin x. Every other partial derivative of this field is irrelevant to the divergence.
Anything without the working variable rides along unchanged
This field is built so that each component is the working variable times something that does not contain it. That makes every diagonal partial a one-step calculation.
- differentiated in : the factor is frozen, so the answer is .
- differentiated in : no other variable is present, so the answer is .
- differentiated in : the factor is frozen, so the answer is .
Check it at a point to be sure the bookkeeping held. At the divergence is .
The mistake: differentiating the factor that is frozen
The third component is where this goes wrong. Seeing triggers the reflex to differentiate it, producing . But the third component is differentiated with respect to , and is a constant as far as is concerned.
The same trap sits in the first component: is , not or , because only the factor is differentiated and the rest stays put.
One reliable habit is to rewrite the component with the frozen part in brackets before you differentiate. Writing as makes it obvious that you are differentiating with a constant in front.
What the answer depends on
The divergence involves all three variables, even though no single component did. That is normal: divergence assembles contributions from three separate places.
It also shows why divergence cannot be read off the size of the field. The middle component is large when is large and negative, yet its contribution is negative there, pulling the divergence down. Magnitude and divergence are different measurements.
The surface where separates the source regions from the sink regions. Because oscillates, that surface repeats in bands as you travel along the axis.
Checked on every build: each component is differentiated numerically with respect to its own variable, and the sum is compared against the divergence above at six sample points.
Frequently asked questions
Why is sin x not differentiated in the third component?
Because that component is differentiated with respect to , and contains no . It behaves as a constant coefficient, so .
Does the divergence depend on all three variables?
Yes. The term brings in and , the term brings in again, and brings in . Each contribution comes from a different component of the field.