# How to explain that ∇ ⋅ B = 0 but ∂Bz/∂z can be non zero?

1. Nov 22, 2012

### Dyon

It is known that Gauss's law for magnetism is ∇ ⋅ B = 0.
If we write this in component form it becomes (∂Bx/∂x)i + (∂By/∂y)j + (∂Bz/∂z)k = 0, where i, j, k are unit vectors in a cartesian coordinate system and Bx, By, Bz are the components of the magnetic field on these axes.
It would follow then that all the partial derivatives must be zero: (∂Bx/∂x) = 0, (∂By/∂y) = 0 and (∂Bz/∂z) = 0 for this equation [ (∂Bx/∂x)i + (∂By/∂y)j + (∂Bz/∂z)k = 0 ] to obtain.
But we know that there are magnetic fields with spatial gradients as, for example, in Stern-Gerlach experiment, where the magnetic force on a dipole of magnetic moment F is m⋅(∂Bz/∂z).
How to reconcile mathematically ∇ ⋅ B = 0 with the fact that ∂Bz/∂z can be non-zero?
Thank you.

2. Nov 22, 2012

### andrien

∂Bx/∂x+∂By/∂y+∂Bz/∂z=0,there is no vector here because the product is scalar as implied by ∇.B

3. Nov 22, 2012

### K^2

It's a dot product. That should tell you right away that the answer needs to be a scalar.

$$\nabla \cdot B = \frac{\partial B_x}{\partial x} + \frac{\partial B_y}{\partial y} + \frac{\partial B_z}{\partial z} = 0$$

Any of these can individually be non-zero. So long as the sum is zero.

4. Nov 22, 2012

### Dyon

Thank you, andrien and K^2. I completely overlooked that ∇ ⋅ B is regarded as a dot product.