# Calculating the magnetic field of an infinite wire

I'm sure this is a well known problem in the physics world. I'm struggling to calculate the magnetic field that an infinite wire with current $$I$$ creates, and I'd like to hear some ideas of yours.

Here's the problem:

So, we have an infinite wire carrying $$I$$ current just above (the height is $$h$$ above the $$x$$ axis) and parallel to the $$x$$ axis. I want to calculate the magnetic field vector at random point in the $$X-Y$$ plain using Biot-Savart law. (I know its easier using Ampere's rule - but I'm curious to see how this two methods gives the same result).

So, from Biot-Savart's law:

$$dB=\frac{\mu_{0}I}{4\pi}\cdot\frac{\overrightarrow{dl}\times\overrightarrow{r}}{r^{3}}$$.

Now, I'm gonna choose a point $$P$$ as you can see in the figure, in the plain $$X-Y$$. $$P\left(x,y,0\right)$$. I want to calculate the magnetic field at P. So I'm gonna choose a point on the infinite wire with the same $$x$$ value as the point P. That would be the point $$A\left(x,0,h\right)$$ as you can see in the figure. And I'm gonna make a little change in the direction of the $$x$$ axis and choose the point $$B\left(x+dx,0,h\right)$$. Thus, the vector $$dl$$ is the vector that connects between $$A$$ and $$B$$, aka $$dl=\left(dx,0,0\right)$$. The vector $$r$$ is the vector that connects between $$P$$ and $$A$$. aka $$r=\left(0,y,-h\right)$$.

Now:

$$\overrightarrow{dl}\times\overrightarrow{r}=\left(0,hdx,ydx\right)$$ (I've done the calculations). And thus from Biot-Savart's law:

$$dB=\frac{\mu_{0}I}{4\pi}\frac{\left(0,hdx,ydx\right)}{\left(y^{2}+h^{2}\right)^{\frac{3}{2}}}$$.

Now if I want to calculate the $$y$$ or the $$z$$ term of the magnetic field I should do the integral $$dx$$ and the boundaries would be $$-\infty$$ and $$\infty$$, but that integral is definitely going to diverge, which means that I made a mistake with my calculations so far.

I'll be glad if someone can show me where I'm wrong and whats the right way to do it.

This was the result from my calculations by using Ampere's rule:

$$B_{z}=\frac{\mu_{0}Iy}{2\pi\left(h^{2}+y^{2}\right)}$$

$$B_{y}=\frac{\mu_{0}Ih}{2\pi\left(h^{2}+y^{2}\right)}$$

And of course $$B_x=0$$.

Note: I'm interested specifically in the method of using the vector's multiplication, because I feel like I have to know this skill in order to make a progress with my physics studies.

The $$\mathbf r$$ vector points from your observation point to the point on the wire which is generating $$dB$$. If your observation point is $$(x,y,-h)$$ and $$dB$$ is being generated at $$(x',y',0)$$, then you would have $$\mathbf r = (x-x')\hat x + (y-y') \hat y + (-h) \hat z$$.

It's true that at the single specific point along the wire which you mention, $$x-x'=0$$ - but of course, this is not generally true because you will be integrating over all values of $$x'$$.

• Okay actually it worked and I got the same result. Thanks ! Aug 28, 2020 at 16:59