# Biot-Savart for two infinite wires with U turn

Consider this arrangement

\begin{axis}[axis lines=middle,xmin=-4,xmax=4,ymin=-4,ymax=4,
xtick={-1.5,1.5},ytick={0},xticklabels={},axis equal,xlabel=$x$,ylabel=$z$]
{-sqrt( 1.5^2 - x^2 )};

\addplot[black,very thick] coordinates {(-1.5,0)(-1.5,3.5)} node[pos=1,above]{$$\infty$$};
node[pos=1,above]{$$\infty$$};

\addplot[mark=*,domain=0:0] {0} node[pos=1,above,right]{$$P$$};
\end{axis}


Current flows from the left wires downward in negative $$z$$-direction and continues like that through the U-turn and then upwards the second straight wire.

I want to determine the magnetic field due to this contraption in the origin, i.e. at position $$\vec{p} = (0,0,0)^T$$. According to Biot-Savart, it can be calculated using

$$\vec{B}(\vec{p}) = \vec{B}(0) = \frac{\mu_0 I}{4 \pi} \int \frac{d\vec{l} \times (\vec{p} - \vec{r}^\prime)}{(r^\prime)^3} = -\frac{\mu_0 I}{4 \pi} \int \frac{d\vec{l} \times \hat{r}^\prime}{(r^\prime)^2}$$

For the left wire, introduce the angle $$\alpha$$ as

\begin{axis}[axis lines=middle,xmin=-4,xmax=4,ymin=-4,ymax=4,
xtick={-1.5,1.5},ytick={0},xticklabels={},axis equal,xlabel=$x$,ylabel=$z$]
{-sqrt( 1.5^2 - x^2 )};

\addplot[black,very thick] coordinates {(-1.5,0)(-1.5,3.5)}node[pos=1,above]{$$\infty$$};
node[pos=1,above]{$$\infty$$};

{$$\alpha$$};

\node[below] at (-0.75,0) {$$R$$};
\node[left] at (-1.5,0.75) {$$z$$};
\node[above] at (-0.75,0.75) {$$r$$};
\end{axis}


We find that $$d\vec{l} = -dz \hat{z}$$, as well as $$r^\prime = \sqrt{R^2 + z^2}$$ and

$$\hat{r}^\prime = \begin{pmatrix} -\cos(\alpha) \\ 0 \\ \sin(\alpha) \\ \end{pmatrix}$$

$$d\vec{l} \times \hat{r}^\prime = dz \begin{pmatrix} 0 \\ \cos(\alpha) \\ 0 \\ \end{pmatrix}.$$

Making use of the definition of the cosine, we additionally find that $$\cos(\alpha) = \frac{R}{\sqrt{R^2 + z^2}}$$. Then, the magnetic field due to the left wire is

$$\vec{B}_1(0) = -\frac{\mu_0 I R}{4 \pi} \hat{y} \int_{\infty}^{0} \frac{dz}{(R^2 + z^2)^{3/2}}.$$

Carrying out the integration, however, tells us that the magnetic field points in the positive $$y$$-direction. By the right hand rule though, it should point in the negative $$y$$-direction. That would mean that there is a minus sign missing somewhere. I could imagine that the integration bounds are chosen wrongly, i.e. one would have to integrate from $$0$$ to $$\infty$$, not the other way around. However, I think the integration should follow the current direction, which is exactly as in the integral above.

Have I missed anything here? Thank you in advance.

• Hello TeamPhysics and welcome to Physics SE. The code you have provided doesn't make any sense to many of us. You should at minimum provide something that would at least signpost us to the right direction to replicate your problem or provide some viable solution. For us that have absolutely no idea what this is about it is extremely difficult to do so. May 27 at 17:53
• @ZaellixA I was hoping it would be possible to copy-paste it into a tikz-enviornment. My apologies, but I haven't yet figured out how to make tikz-code actually compile within this forum. Perhaps you know how it works and can share your wisdom with me. May 28 at 10:15
• To be honest, I have no idea how to do that. In fact, I didn't even know what Tikz is until 2 minutes ago (which changed just because I checked it to answer your comment :D). Maybe someone else knows though if it is possible at all. May 28 at 17:57
• It must be, I've seen it before. May 29 at 14:35

It has to do with the way you have it written. If you want to write it with the vector $$\vec{p}$$, then it should be written as

$$\vec{B}\left(\vec{p}\right)=\frac{\mu_0}{4\pi}\int \frac{Id\vec{l}\times (\vec{p}-\vec{r})}{\left|\vec{p}-\vec{r}\right|^3}=\frac{\mu_0}{4\pi}\int \frac{Id\vec{l}\times \vec{r}'}{\left|\vec{r}'\right|^3}$$

where $$\vec{p}$$ is the point where you are trying to determine the field at and $$\vec{r}$$ is the position of the current element.

$$\vec{p}-\vec{r}=\vec{r}'$$ where $$\vec{r}'$$ is the vector pointing from the element current to the point that we with to know the field at. If you are using $$\vec{p}-\vec{r}$$ and letting $$\vec{p}=\vec{0}$$, the that leaves you with

$$\vec{B}\left(\vec{0}\right)=-\frac{\mu_0}{4\pi}\int \frac{Id\vec{l}\times \vec{r}}{\left|\vec{r}\right|^3}=-\frac{\mu_0}{4\pi}\int \frac{Id\vec{l}\times \hat{r}}{\left|\vec{r}\right|^2}$$

Here, $$\hat{r}$$ points toward the current element, not toward the location of the field. This is where you sign issue is.

If you were to write the formula in

$$\frac{\mu_0}{4\pi}\int \frac{Id\vec{l}\times \vec{r}'}{\left|\vec{r}'\right|^3}=\frac{\mu_0}{4\pi}\int \frac{Id\vec{l}\times \hat{r}'}{\left|\vec{r}'\right|^2}$$

Then $$\hat{r}'$$ points in the direction you provided.

[EDIT] Sorry. I miss interpreted your $$\hat{r}'$$ because of the first formula you provided. Your $$\hat{r}'$$ is correct, but your bounds are not. They need to be flipped. This is where the sign issue is. When you integrate, you go from the least value to the greater value, even if your $$d\vec{l}$$ is pointed in the opposite direction. Sorry for any confusion earlier. That being said, the formulas should not be written in the form you have it, which was

$$\vec{B}\left(\vec{p}\right)=\frac{\mu_0}{4\pi}\int \frac{Id\vec{l}\times (\vec{p}-\vec{r}')}{(r')^3}$$

It should be

$$\vec{B}\left(\vec{p}\right)=\frac{\mu_0}{4\pi}\int \frac{Id\vec{l}\times (\vec{p}-\vec{r})}{\left|\vec{p}-\vec{r}\right|^3}$$

Hope this helps.

• It helps a lot. Thank you. I always thought that $\vec{r}$ was the position vector from which the field is observed and $\vec{r}^\prime$ is the one integrated over. Thus I chose $\vec{r}^\prime$ to be within the integral. Theoretically, it should not matter what I name the variables, as long as the integration is carried out correctly and confusions are avoided by not naming two separate variables identically. May 28 at 10:17