Getting incorrect results applying Ampere's law

Let’s say we have a current wire with a current $$I$$ flowing. We know there is a field of $$B=\frac{\mu_0I}{2\pi r}$$ by using Ampère's law, and a simple integration path which goes circularly around the wire. Now if we take the path of integration as so the surface spans doesn’t intercept the wire we trivially get a $$B=0$$ which is obviously incorrect.

I see that I have essentially treated it as if there is no current even present. But a similar argument is used in other situations without fault.

Take for example a conducting cylinder with a hollow, cylindrical shaped space inside. By the same argument there is no field inside.

To further illustrate my point, the derivation of the B field inside of a solenoid requires you to intercept the currents. You can’t simply do the loop inside of the air gap.

This, at least to me, seems like the same thing, and I can’t justify why one is incorrect and the other is incorrect. Please point out why I am stupid.

You aren't stupid, you are just learning things the same way we all did: the school of hard knocks. Ampere's law says that the integral around that closed path is zero, not that the field is zero at every point. What the law tells us is that the field is sometimes "positive" and sometimes "negative" on that path, and when we add up contributions from everywhere on the path, we get zero.

• What about if you take a circularly symmetric path in the solenoid? – Jake Rose Jan 7 at 22:05
• Ahhh, the field is perpendicular, so B (in that direction) really does = 0.. – Jake Rose Jan 7 at 22:07
• @JakeRose In that case $\vec{B}$ is perpendicular to $d\vec{l}$, so the integral is 0 (without the field being 0) – Poon Levi Jan 7 at 22:09

Your argument is incorrect. $$\oint \vec B\cdot d\vec \ell$$ is $$0$$ when no current is enclosed but this does not imply $$B=0$$: you cannot use $$\oint \vec B\cdot d\vec \ell= B\times 2\pi r =\mu_0 I_{encl}$$ since $$\vec B$$ is not constant on the loop defined by the contour: in other words, $$\oint\vec B\cdot d\vec \ell$$ is not $$B\times 2\pi r$$ unless the contour is one where $$\vec B\cdot d\vec \ell$$ is constant.

• What if you take a circularly symmetric loop in the solenoid? – Jake Rose Jan 7 at 22:05
• Ahhh, the field is perpendicular, so B (in that direction) really does = 0 – Jake Rose Jan 7 at 22:07
• @JakeRose Yes... Ampere's law is always true, but it's now always useful in recovering $\vec B$: only in some specialized symmetric situations can one do this (see physics.stackexchange.com/q/318183/36194). – ZeroTheHero Jan 7 at 22:09

You basically have to evaluate a line integral $$\oint_{\rm C} \vec B \cdot d\vec l$$ over a closed loop which in general is difficult to do.

Here are two examples to show that even if there is a magnetic field present the line integral is zero. In the left hand case $$\oint_{\rm C} \vec B \cdot d\vec l = \int_{\rm WX} \vec B \cdot d\vec l+\int_{\rm XY} \vec B \cdot d\vec l+\int_{\rm YZ} \vec B \cdot d\vec l+\int_{\rm ZX} \vec B \cdot d\vec l = B\,2R+0+(-B\,2R)+0 =0$$

The right hand case is a little trickier.

$$\oint_{\rm C} \vec B \cdot d\vec l = \int_{0}^{2\pi} B\,Rd\theta \,\sin \theta = 0$$

and if one looks at a quadrant between $$\theta =0$$ and $$\theta = \frac \pi 2$$ the line integral is $$\displaystyle \int_{0}^{\frac{\pi}{2}} B\,Rd\theta \,\sin \theta = +BR$$

Then going round in $$\frac \pi 2$$ steps the integral around the closed loop is $$+BR+BR+(-BR)+(-BR) =0$$ as before.