Multivariable calculus

Divergence of F = (x, y, z) / (x^2 + y^2 + z^2 + 1)

For F = (x, y, z) divided by x^2 + y^2 + z^2 + 1, write r squared for x^2 + y^2 + z^2. The divergence is (r squared plus 3) divided by (r squared plus 1) squared. Each quotient rule contributes r squared plus 1 minus twice one coordinate square, and adding the three collapses them into a single r squared.

F(x,y,z)=x, y, zx2+y2+z2+1\mathbf{F}(x,y,z) = \frac{\langle x,\ y,\ z \rangle}{x^{2}+y^{2}+z^{2}+1}
Px=(x2+y2+z2+1)2x2(x2+y2+z2+1)2\frac{\partial P}{\partial x} = \frac{\left(x^{2}+y^{2}+z^{2}+1\right)-2x^{2}}{\left(x^{2}+y^{2}+z^{2}+1\right)^{2}}
Qy=(x2+y2+z2+1)2y2(x2+y2+z2+1)2\frac{\partial Q}{\partial y} = \frac{\left(x^{2}+y^{2}+z^{2}+1\right)-2y^{2}}{\left(x^{2}+y^{2}+z^{2}+1\right)^{2}}
Rz=(x2+y2+z2+1)2z2(x2+y2+z2+1)2\frac{\partial R}{\partial z} = \frac{\left(x^{2}+y^{2}+z^{2}+1\right)-2z^{2}}{\left(x^{2}+y^{2}+z^{2}+1\right)^{2}}
F=x2+y2+z2+3(x2+y2+z2+1)2\nabla \cdot \mathbf{F} = \frac{x^{2}+y^{2}+z^{2}+3}{\left(x^{2}+y^{2}+z^{2}+1\right)^{2}}

One quotient rule, then relabel twice

Let r2=x2+y2+z2r^{2} = x^{2}+y^{2}+z^{2} and D=r2+1D = r^{2}+1, so the field is x,y,zD\frac{\langle x, y, z\rangle}{D}. Every component has the same denominator, and that denominator depends on all three variables.

x(xD)=1Dx2xD2=D2x2D2\frac{\partial}{\partial x}\left(\frac{x}{D}\right) = \frac{1 \cdot D - x \cdot 2x}{D^{2}} = \frac{D - 2x^{2}}{D^{2}}

The field is symmetric in the three variables, so the other two partials are the same formula with yy or zz in place of xx. Write them down rather than repeating the work.

Qy=D2y2D2,Rz=D2z2D2\frac{\partial Q}{\partial y} = \frac{D - 2y^{2}}{D^{2}}, \qquad \frac{\partial R}{\partial z} = \frac{D - 2z^{2}}{D^{2}}

Now add. Three copies of DD appear, and the three squares reassemble into r2r^{2}.

F=3D2(x2+y2+z2)D2=3(r2+1)2r2D2=r2+3(r2+1)2\nabla \cdot \mathbf{F} = \frac{3D - 2\left(x^{2}+y^{2}+z^{2}\right)}{D^{2}} = \frac{3\left(r^{2}+1\right)-2r^{2}}{D^{2}} = \frac{r^{2}+3}{\left(r^{2}+1\right)^{2}}

The mistake: using symmetry to multiply by three

Symmetry is real here, and it is tempting to compute Px\frac{\partial P}{\partial x} once and then triple it. That gives 3(D2x2)D2\frac{3\left(D-2x^{2}\right)}{D^{2}}, which is wrong except on the cone 2x2=y2+z22x^{2}=y^{2}+z^{2}, the one place where subtracting 2x22x^{2} three times happens to match subtracting 2x22x^{2}, 2y22y^{2} and 2z22z^{2} once each.

Test it at (1,12,1)\left(1,\tfrac{1}{2},-1\right), where r2=94r^{2} = \tfrac{9}{4} and D=134D = \tfrac{13}{4}. The correct divergence is 21/4(13/4)20.4970\frac{21/4}{(13/4)^{2}} \approx 0.4970, while tripling the first partial gives 0.3550\approx 0.3550. Not close.

What symmetry actually buys you is permission to relabel, not permission to multiply. Swapping xx and yy throughout turns the first partial into the second, so you may copy the formula with new letters and then add three different expressions.

Reading the answer, and the field it is smoothing

The divergence depends only on rr, which it must, since the field itself only knows about distance from the origin. At the origin it equals 31=3\frac{3}{1} = 3, matching the plain radial field x,y,z\langle x, y, z\rangle that this one imitates near the centre.

For large rr the numerator grows like r2r^{2} and the denominator like r4r^{4}, so the divergence decays like 1r2\frac{1}{r^{2}}. It is positive at every point, so the whole of space is a source, most strongly near the origin.

Compare the genuine inverse square field x,y,zr3\frac{\langle x, y, z\rangle}{r^{3}}, the one gravity and electrostatics use. Its divergence is 00 everywhere it is defined, with the entire source crushed into the undefined point at the origin. Replacing r3r^{3} with r2+1r^{2}+1 spreads that source out and makes the field defined everywhere.

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 can I not compute one partial and multiply by three?

Because the three partials differ: they subtract 2x22x^{2}, 2y22y^{2} and 2z22z^{2} respectively. At (1,12,1)\left(1,\tfrac{1}{2},-1\right) the true value is about 0.49700.4970 and the tripled one about 0.35500.3550.

What is the divergence at the origin?

It is 33. Setting r=0r = 0 gives 0+3(0+1)2=3\frac{0+3}{(0+1)^{2}} = 3, the same value as the simple radial field x,y,z\langle x, y, z \rangle, which this field resembles near the origin.