# Angle measurement in deriving the magnetic field of a infinitely long solenoid

I'm facing a doubt in the derivation of the magnetic field inside an infinitly long solenoid of radius $R$.

To derive $B$ all the loops in the solenoid are considered: in a lenght $dx$ there are $n\,dx$ loops, each producing a magnetic field, so we have:

$$d B= \frac{\mu_0}{4 \pi} \frac{R^2}{(R^2+x^2)^{\frac{3}{2}}} n \,dx$$

In order to get $B$, consider separately cases $1$ and $2$ as in picture. In the two cases the current flows as indicated ($\times$ is entering the screen, $\odot$ goes out of the screen), but the angles (in case $1$ $\theta$, in case $2$ $\phi$) are measured from the two opposites sides of the solenoid. Case $1$:

$$\sqrt{R^2+x^2} \,\,\mathrm{sin \theta}=R$$

$$x-x_0=R \mathrm{cotg \theta} \to dx=-\frac{R}{\mathrm{sin^2 \theta}} d\theta$$

$$B(x_0)=\frac{\mu_0 n i }{2} \int_{\theta_1}^{\theta_2} -\mathrm{sin{\theta}} \,\,\,d\theta =\frac{\mu_0 n i }{2} (\mathrm{cos\theta_2}-\mathrm{cos\theta_1})$$

Case $2$:

$$\sqrt{R^2+x^2} \,\,\mathrm{sin \phi}=R$$

$$x-x_0=-R \mathrm{cotg \phi} \to dx=\frac{R}{\mathrm{sin^2 \phi}} d\theta$$

$$B(x_0)=\frac{\mu_0 n i }{2} \int_{\phi_1}^{\phi_2} \mathrm{sin{\phi}} \,\,\,d\theta =\frac{\mu_0 n i }{2} (\mathrm{cos\phi_1}-\mathrm{cos\phi_2})$$

Here is the problem: in both cases the limit condition of infinitely long solenoid is that the first angle ($\phi_1$ or $\theta_1$) is $0$ and the second angle ($\phi_2$ or $\theta_2$) is $\pi$.

Nevertheless making substituition in case $1$ I get

$$B=-\mu_0 n i$$

while in case $2$ I get

$$B=+\mu_0 i n$$

which is the correct result.

Is there a particular reason why the angle measurement must be done as in case $2$ and not as in case $1$ to get the correct result? Or are both method valid? If so, how is it possible to get a different result just because orientation of angle measurement?

• -1. I don't consider this to be a useful question. The 2 diagrams are the same, just reversed. This is a trivial confusion over mathematics. No useful physics here, in my opinion. – sammy gerbil Jan 6 '17 at 2:04

Since the only difference is a sign change, you really have to be very careful about conventions along the way. You didn't actually specify in your second integral whether you want to integrate from $\phi_1$ to $\phi_2$, or the other way around - and that will obviously affect your result.
I realize that is the pragmatic approach. If you want the careful approach, I recommend that you ask yourself about the order of integration. When you changed how you measured $\phi_1$, its complement was labeled as $\theta_2$... meaning you reversed the "start" and "stop" angles. Which will give you a sign change.
• Thanks for the answer, I'm sorry I fixed the order of integration also in the second integral which is from $\phi_1$ to $\phi_2$ – Sørën Jan 6 '17 at 1:35
• OK - so you are changing the direction of integration - anti-clockwise in $\theta$, clockwise in $\phi$. So of course you will get a sign change. – Floris Jan 6 '17 at 1:36
• The integral of $\int_0^1 dx = 1$, but $\int_1^0 dx = -1$. That's just how integrals work... – Floris Jan 6 '17 at 2:14