# Derivation of magnetic field caused by a current carrying wire

When we derive the equation of a magnetic field produced by a long straight current-carrying wire, we do something like this:

Imagine a wire carrying a constant current $$I$$. Take a point at a distance of $$r$$ from the wire, this is the point where we want to find the magnetic field. So, draw a circle with radius $$r$$ and center at the wire (from which the point's distance is $$r$$). Applying the Ampere's Law $$\oint \mathbf{B} \cdot d\mathbf{l} = \mu_{0} ~I$$

Since the magnitude of $$\mathbf{B}$$ is constant at every line element of the loop (circle) and it dot product with the line element is $$B~dl$$ everywhere, therefore $$\oint B~dl = \mu_0 ~I$$ $$B~\oint dl = \mu_0 ~I$$ $$B~ 2\pi r = \mu_0 ~I$$ $$B = \frac{\mu_0}{2\pi r} ~I$$

Now, the problem is how do we know that the magnitude of B is going to be constant and its direction will be the same as a line element. I think it's this assumption that has really solved the problem and not the mathematics . Is it an experimental fact? How can we ever made such an assumption when the only thing that we have is Elcetrostatics (I mean that electrostatics was the precursor of magnetostatics and magnetostatics always takes the analogy of static charges in electrostatics) where the field varies with distance.

I want to state my problem once more: How do we know that magnetic field's strength gonna be constant all around the loop and always tangential to the loop? .

Thank you. Any help will be much appreciated.

EDIT: Following @Dale answer, we can do something like this $$d\mathbf{B} = \mu_0 /4\pi ~ I ~ \frac {d\mathbf{l} \times \mathbf{r}} {r^3}$$ Since, r can be written as $$\mathbf{r} = (rcos\theta, rsin\theta , z)$$ and dl as $$d\mathbf{l} = ( dl,0,0)$$ And now, if we take the cross product we would get $$d\mathbf{l} \times \mathbf{r} = -z ~dl \hat j + rsin\theta \hat k$$ and therefore the magnitude of dB is equal to $$dB = \mu_0/4\pi ~I~ |d\mathbf{l} \times \mathbf{r}| /r^3 = \mu_0/4\pi ~I ~ \sqrt{z^2+r^2sin^2\theta} dl/ r^3$$

Thus, magnetic field is depending on $$r, \theta, z$$ . Please help.

• Wire is along the z direction. So dl = (0, 0, dl) Dec 11 '19 at 6:52
• @aditya_stack Okay, but it doesn't make any difference if we take the wire in $x$ direction or $z$ direction, all it gonna change is to swap the components in cross product.
– user240696
Dec 11 '19 at 7:13
• It will make a difference. Notice that the loop is always going around the wire. So if you take the wire in x direction so that dl = (dl, 0, 0) then to apply Ampere's Law correctly you must also change r to be r = (x, rcos$\theta$, rsin$\theta$) Dec 11 '19 at 7:18

how do we know that the magnitude of B is going to be constant and its direction will be the same as a line element

We know that the magnitude is constant by symmetry. Since there is cylindrical symmetry (axisymmetric) the magnitude can only depend on $$r$$, and therefore cannot depend on $$\theta$$ or on $$z$$.

For the direction, that is a little more complicated. If we break $$\vec B$$ into $$\hat r$$, $$\hat \theta$$, and $$\hat z$$ components, then we see that the $$\hat z$$ component must be zero because the Biot Savart law requires $$\vec B$$ to be perpendicular to $$\vec I$$. If the $$\hat r$$ component were nonzero then we would have a nonzero divergence which would violate Gauss’ law for magnetism. So only the $$\hat \theta$$ component can be nonzero. And its magnitude is determined by the integral you posted.

• Coincidentally, I was writing an answer with the same argument as yours. But, why should the $\hat{z}$ component be zero by symmetry? The direction of the current brings an asymmetry in that direction. Dec 11 '19 at 3:47
• Oh, right. I forgot that. The current is a vector not a scalar. I need to fix that part. The rest should be good. Hold on
– Dale
Dec 11 '19 at 3:49
• @Knight I think you are mixing up $d\vec l$ and $d\vec I$. $d\vec I$ is a differential element of current in the straight wire. $d\vec l$ is a differential length of the loop of wire. Or alternatively (depending on your notation) there are two different $d\vec l$ one for the wire and one for the loop.
• In my edit i used $dl$ with your meaning of $dI$. I used $dl$ as the element of current carrying wire not the Amperean loop.