What Divergence Computes
A three-dimensional vector field assigns a vector to each point in a region of space. In Cartesian coordinates, write the field as \(\mathbf{f}(x,y,z)=(P(x,y,z),Q(x,y,z),R(x,y,z))\). Computing its divergence means taking one particular partial derivative from each component and adding the three results.
The procedure is compact, but the component-coordinate matching matters: differentiate the first component with respect to \(x\), the second with respect to \(y\), and the third with respect to \(z\). The result is a scalar-valued function, not another vector field.
For calculations, it is often useful to abbreviate the result as \(\operatorname{div}\mathbf{f}\). Both notations refer to the same scalar function. The definition asks for three partial derivatives only; it does not ask for every partial derivative of every component.
Why the Formula Has This Form
The formula follows from how the Cartesian differential operator acts component by component. Treat \(\nabla\) as the ordered list of coordinate derivatives. Its dot product with the ordered components of the field pairs the first entries, the second entries, and the third entries. Those pairings are exactly \(P_x\), \(Q_y\), and \(R_z\).
This is a complete componentwise derivation: the dot product adds corresponding entries, and each derivative operator acts on the corresponding component. In particular, \(\partial P/\partial y\) is not one of the terms in this formula. It may exist, but it is not used when computing divergence in Cartesian coordinates.
A Reliable Calculation Sequence
When asked for divergence at a point, first find the divergence as a function of \((x,y,z)\), then substitute the point. This separates differentiation from evaluation and makes it easier to catch errors. For a rational field, also check that the point is in the field’s domain: a formula cannot be evaluated where one of its components is undefined.
Write the field as \(\mathbf{f}=(P,Q,R)\), in the same order as its \(x,y,z\) coordinates.
Calculate \(P_x\), \(Q_y\), and \(R_z\), holding the other coordinates fixed in each partial derivative.
Form \(P_x+Q_y+R_z\). If a point is specified, substitute its coordinates into this scalar expression.
Worked Examples
Worked Example: A Polynomial Vector Field
Find the divergence of \(\mathbf{f}(x,y,z)=(x^2y+3z,\;xy^2-z^3,\;4xz+y)\), then evaluate it at \((1,2,-1)\).
First identify \(P=x^2y+3z\), \(Q=xy^2-z^3\), and \(R=4xz+y\). Differentiate each component with respect to its matching variable. In \(P_x\), hold \(y,z\) fixed; in \(Q_y\), hold \(x,z\) fixed; in \(R_z\), hold \(x,y\) fixed:
Adding gives \(\operatorname{div}\mathbf{f}=2xy+2xy+4x=4xy+4x\). At \((1,2,-1)\), the \(z\)-coordinate does not appear in the result, so
Check the component derivatives at the specified coordinates: \(P_x(1,2,-1)=2(1)(2)=4\), \(Q_y(1,2,-1)=2(1)(2)=4\), and \(R_z(1,2,-1)=4(1)=4\). Their sum is \(4+4+4=12\), agreeing with the evaluated divergence.
Worked Example: A Trigonometric Vector Field
Let \(\mathbf{f}(x,y,z)=(\sin x\cos y,\;\sin y\cos z,\;\sin z\cos x)\). Find its divergence and evaluate it at \((0,\pi/3,\pi/3)\).
Differentiate the first component with respect to \(x\), the second with respect to \(y\), and the third with respect to \(z\). The other variable in each product is held constant:
Therefore, \(\operatorname{div}\mathbf{f}=\cos x\cos y+\cos y\cos z+\cos z\cos x\). At the requested point, \(\cos 0=1\) and \(\cos(\pi/3)=1/2\), so the three terms are
Thus \(\operatorname{div}\mathbf{f}(0,\pi/3,\pi/3)=\frac12+\frac14+\frac12=\frac54\). Checking against the three partial derivatives individually gives the same values, \(\frac12,\frac14,\frac12\), whose sum is \(\frac54\).
Worked Example: A Rational Component and Its Domain
Consider \(\mathbf{f}(x,y,z)=(x^2y+\sin z,\;e^{xy}+yz^2,\;(x+1)/(z+2))\). Find its divergence and evaluate it at \((1,0,0)\).
The third component is undefined when \(z=-2\), so the field is defined only where \(z\ne-2\). The requested point has \(z=0\), and is therefore in the domain. Now differentiate the components with respect to their matching coordinates:
For \(Q_y\), the chain rule gives \(\partial e^{xy}/\partial y=e^{xy}\cdot x\), while \(\partial(yz^2)/\partial y=z^2\). For \(R_z\), \(x+1\) is constant with respect to \(z\), and differentiating \((z+2)^{-1}\) gives \(-(z+2)^{-2}\). Hence
At \((1,0,0)\), the terms evaluate as \(2(1)(0)=0\), \(1\cdot e^0=1\), \(0^2=0\), and \(-(1+1)/(0+2)^2=-2/4=-1/2\). Therefore
As a check, the three partial derivatives at the point are \(P_x=0\), \(Q_y=1\), and \(R_z=-1/2\). Their sum is \(1/2\), as obtained above.
Common Mistake: Differentiating the Wrong Component
A frequent error is to differentiate each component with respect to the same variable, or to use a cross-partial derivative in place of one of the required terms. For example, consider \(\mathbf{f}=(x^2y,\;xy^2,\;z^3)\). A mistaken calculation might use \(Q_x\) instead of \(Q_y\): at \((2,1,1)\), that gives \(P_x=2xy=4\), \(Q_x=y^2=1\), and \(R_z=3z^2=3\), for a wrong sum of \(8\).
The correction is to match the second component with \(y\), not \(x\). The correct derivatives are \(P_x=2xy\), \(Q_y=2xy\), and \(R_z=3z^2\). At \((2,1,1)\), these equal \(4\), \(4\), and \(3\), respectively, so
The incorrect derivative \(Q_x\) exists, but it does not belong in the Cartesian divergence formula.
Conditions and a Final Check
At a point, the displayed divergence formula requires the three indicated partial derivatives to exist there. For routine calculations on an entire region, it is convenient to assume that \(P,Q,R\) have continuous first partial derivatives throughout that region. Do not silently include points where a component is undefined: a rational expression with a zero denominator is not a value of the field at that point.
Before accepting a calculation, check that you have one derivative from each component, that each derivative uses its matching coordinate, and that you added the results before substituting the evaluation point. When evaluating, compute each term carefully, including negative signs and denominator squares. These checks address the main sources of error without changing the definition.
Check Your Understanding
For each question, identify the matching component and coordinate before carrying out the calculation.
- For \(\mathbf{f}=(x^3,\;y^3,\;z^3)\), find \(\operatorname{div}\mathbf{f}\).
- For \(\mathbf{f}=(xy,\;yz,\;zx)\), find the divergence as a function of \((x,y,z)\), then evaluate it at \((1,2,3)\).
- For \(\mathbf{f}=(\sin x,\;\cos y,\;e^z)\), compute and evaluate the divergence at \((0,0,0)\).
- For \(\mathbf{f}=(x,\;y,\;z/(z-1))\), state where the field is defined before computing its divergence.
- A calculation uses \(P_y+Q_y+R_z\) for \(\mathbf{f}=(P,Q,R)\). Which derivative is mismatched, and what is the correct formula?