# Divergence of magnetic field

1. Apr 14, 2010

### bon

1. The problem statement, all variables and given/known data

Ok well all im told in the question is that the magnetic field B at a distance r from a straight wire carrying current I has magnitude uoI/2pi r..

The lines of force are circles on the wire and in planes perpendicular to it..

Show that divB = 0

2. Relevant equations

3. The attempt at a solution

So I've not actually done any electromag, but it should be possible to do the question without it...

Im just unsure on how to write the vector B..i.e. how can i write it down in vector form using the information theyve given me?

thanks :)

2. Apr 14, 2010

### RoyalCat

The magnetic field at a distance $$r$$ from a long current carrying wire, has magnitude $$|B|=\frac{\mu_0 I}{2\pi} \frac{1}{r}$$

Its direction is always perpendicular to the radial direction.

All that remains is to write this out in Cartesian coordinates and to take the divergence of the resulting function.

If you're not asked for much rigor, you could simply say that the magnetic field lines have no beginning and no end, there is no volume element in space that has more inwards magnetic flux than it does outwards magnetic flux, as there are no magnetic monopoles, therefore, the condition that $$\vec \nabla \cdot \vec B$$ is satisfied.

Going for the more rigorous approach, let's first make life simple for ourselves. We'll set the current carrying wire along the +x axis and adopt a right-handed coordinate system ($$\hat x \times \hat y = \hat z$$)

For a vector originating at the x axis, making an angle theta with the xy plane, its components are:$$\hat r = \cos{\theta} \hat y + \sin{\theta} \hat z$$

The vector perpendicular to this vector would be $$\hat \phi = -\hat r \times \hat x$$ (Convince yourself that this is true using a right-hand-rule)

All that remains from here is to take the divergence of the resulting function, $$\vec B = \frac{\mu_0 I}{2\pi}\frac{1}{r}\hat \phi$$ and to prove that it equals 0 for general values, $$r$$ and $$\theta$$, thus proving that the divergence of B is zero everywhere.

Last edited: Apr 14, 2010
3. Apr 14, 2010

### JaWiB

In cylindrical coordinates:
$$\vec{B} = \frac{{\mu}_0I}{2{\pi}r}\hat{\theta}$$
Since the magnetic field is always perpendicular to the r and z vectors. You can look up the formula for divergence in cylindrical coordinates or derive it yourself

Edit: Got distracted while posting...I see I've been beaten to it :D

4. Apr 14, 2010

### RoyalCat

This is much more useful as it gets turns into a BIG mess of partial derivatives if you try and do it in Cartesian coordinates instead of the system's natural cylindrical coordinates:

http://en.wikipedia.org/wiki/Cylindrical_coordinates

What should matter to you is $$\vec\nabla = \boldsymbol{\hat \rho}\frac{\partial}{\partial \rho} + \boldsymbol{\hat \varphi}\frac{1}{\rho}\frac{\partial}{\partial \varphi} + \mathbf{\hat z}\frac{\partial}{\partial z},$$

And then take the divergence with $$\vec \nabla \cdot \vec B$$ as usual.

5. Apr 14, 2010

### bon

Thanks..how do i derive it myself?

Also how did you get that the vector perpendicular to that vector is -r x x?
thanks a lot for all your help!

6. Apr 14, 2010

### bon

Thanks ok so the working is just

div B = 1/r times d/dtheta of (uoI/2pir)

but since this contains no thethas, this just = 0?

confused :S

7. Apr 14, 2010

### bon

Please could you explain this a bit more? or derive it?

thank you again for your help! much appreciated :)

8. Apr 14, 2010

### RoyalCat

Haha, okay, one thing at a time!

There's nothing to derive about $$\hat \phi = -\hat r \times \hat x$$ Just use the right hand rule to take the cross product and you'll see that the azimuthal direction is the cross product described.

As for deriving the del operator in cylindrical coordinates yourself, that takes a bit of trigonometry and a whole lot of patience. It's a pretty messy derivation that requires you to pretty much work it out backwards, starting from the cartesian del operator: $$\vec \nabla = \frac{\partial}{\partial x}\hat x+\frac{\partial}{\partial y}\hat y+\frac{\partial}{\partial z}\hat z$$, you should put things in terms of the cylindrical coordinates by first translating the cylindrical coordinates into cartesian coordinates and then rearranging your original expression.

And as for the third part, you forgot to multiply by the original function, but you still get 0 as a result! $$\frac{\partial (x)}{\partial y}=0$$ because x is not a function of y, same thing applies here.