# Mathematically Proving Gauss's Law of Magnetism is Indeed Zero, Not working out

Gauss's Law of Magnetism shows us that the divergence of Magnetic field is $0$, $\bigtriangledown \cdot \vec{B}=0$

Then how do you derive that statement by showing the divergence of a magnetic field upon an axis of a current carrying coil where radius is much smaller that distance so that we can use,

$$B_z=\frac{\mu_oI}{2z^3}\hat{z}$$

$\therefore$

$$\bigtriangledown \cdot B \equiv \frac{\partial}{\partial z}\cdot \frac{u_oI}{2z^3}\hat{z} \neq0$$

This doesn't equal zero? What am I missing?

• – Qmechanic Apr 17 '17 at 22:11

When you compute the divergence, it's not enough to know the field at a given point or on an axis. As you need to compute all possible directional derivatives, you need to know the field in a neighbour of the point where you are calculating the divergence*. In your case, you only know the field on the axis, so no derivatives on the orthogonal plane. Your formula for divergence only have $\partial_z B_z$: surely the other components (that you are not able to calculate) will take care of bringing the divergence to zero.
*Actually, you just need to be able to perform some derivatives: in Cartesian coordinates, you need to know $B_x$ in a 1D neighbour of the point along the $\hat x$ axis, and analogously for $B_y$ and $B_z$ substituting the versor appropriately.