# Ampere's law on infinite path

I was calculating the magnetic field of a circular current loop using Biot-Savart law and obtained it straightforwardly. If the loop is in the $$xy-$$plane, centered at the origin, the field at a point on its axis a distance $$z$$ from the center is given by $$\vec{B} = \frac{\mu_0 I R^2}{2(R^2 + z^2)^{3/2}}\hat{k}.$$ If we now calculate $$\int_{-\infty}^{\infty}B\;dz$$ we get $$\mu_0 I$$, which is what we get using Ampere's law around a closed path. I don't understand this result. How is the path indicated in the integral closed? And what does this result mean? Usually when we use Ampere's law to find the field we want to have symmetry. The only symmetry I can think of is that the field always points in the $$z-$$direction on this axis, but that's not enough because it's magnitude depends on $$z$$. Also, I tried to reason that this path could be treated like half of an infinite circle. Ampere's law for the other half would be obtained by reversing the boundaries of the integral, which gives a minus sign. So if we add them up, we get zero, which is what we should expect for the field at infinity. But I feel like it's a loose interpretation because that would mean that calculating the integral over the whole path does not give $$\mu_0 I$$, unless $$I=0$$. Is this result just a coincidence or is there something deeper going on?

Well, you can assume that the path is a closed paralelogram, with one side passing though $$x=y=0$$ and parallel to $$z$$. The main point here is to make the other 3 sides be so far away from the loop that we consider them at infinity.
Now, if the other sides are that far away, the magnetic field there will be pratically $$0$$, and the contribuitions to the integral from these three sides, say $$(z = \infty, x=0, y = (0 \rightarrow \infty); z = (\infty \rightarrow -\infty), x = 0, y = \infty; z = -\infty, x = 0, y = (\infty \rightarrow 0))$$, being zero, and the fourth side being the one we integrate,
This is not an accident. Maybe this is what you meant by a path that is "half of an infinite circle", but let me try to describe it more precisely so we are on the same page. Suppose we choose an Amperian loop with two segments: the first is a straight line along the axis of the current loop, from $$z = -r$$ to $$z = r$$. The second segment is a semi-circle of radius $$r$$, completing the loop from $$z = r$$ to $$z = -r$$. We assume $$r$$ is large: much larger than $$R$$: the current loop radius. Since $$r>R$$, the current encircled by the Amperian loop is $$I$$.
The magnetic field expression you have only applies on the axis of the current loop. For the off-axis field on the semi-circular segment of the Amperian loop, since $$r\gg R$$, we can safely approximate the current loop as a magnetic dipole:
$$\vec B = \frac{\mu_0}{4\pi r^3}\left[3\hat r\left(\vec m\cdot\hat r\right)-\vec m\right].$$ where the magnetic dipole moment is $$\vec m=\pi R^2I\hat k$$. The important point is that $$B$$ drops off as $$1/r^3$$ with radial distance. On the other hand, the length of the semicircular path is proportional to $$r$$, so the integral of $$\vec B$$ on this path decays as $$1/r^2$$ as you increase $$r$$. In the limit $$r\to0$$, this integral goes to zero, and the integral along the Amperian loop is just $$\int\limits_{-\infty}^\infty B_z dz$$.