Ampere's Law question

If we have a current carrying wire through a rectangular loop, the magnetic field through the loop, according to Ampere's law, is $$\int B\,dl=\mu I$$.

But what if we have a second wire going through the loop in the opposite direction? Would the current through the loop be zero because the currents are going in different directions? In other words, is $$\int B\,dl=0$$?

If we have a current carrying wire through a rectangular loop, the magnetic field through the loop, according to Ampere's law, is $$\int B\,\text dl=\mu I$$

The equation is correct, but your words are wrong. This equation doesn't tell us the field "through the loop". The only field this equation deals with is the field that exists at points on the rectangular Amperian loop you are performing the line integral on. More specifically, it really only tells you what the line integral of this field is around the loop.

Ampere's law is always valid in the case of magneto-statics. However, it can only be used to determine the magnetic field in cases where symmetry allows you to do so. In your single wire case, Ampere's law in integral form cannot be used to determine the magnetic field at points on your rectangular Amperian loop.

But what if we have a second wire going through the loop in the opposite direction? Would the current through the loop be zero because the currents are going in different directions? In other words, is $$\int B\,\text dl=0$$

Yes, this is correct. If your Amperian loop has a net $$0$$ current moving through the surface that is bound by the loop, then the line integral $$\int B\,\text dl$$ must equate to $$0$$. However, based on the previous point, this does not mean that the field $$B$$ is $$0$$ at all points within the loop, or even on the loop. It just means that the line integral evaluates to $$0$$. Keep in mind, the value of an integral does not uniquely determine its integrand.

Let the two currents be $I_1$ and $I_2$, then $\oint \vec{B}\cdot d\vec{l}=\mu_0(I_1+I_2)$. If $I_1=-I_2$, then the RHS is just 0, so will the LHS.

We select the ampere loop in such a way that the field at all the point on the loop is same.

Yes you are correct, that, s what ampere circuit law says

Ampere's Circuital Law states the relationship between the current and the magnetic field created by it. This law states that the integral of magnetic field density (B) along an imaginary closed path is equal to the product of net current enclosed by the path and permeability of the medium.

Edit:) The equation is only valid when electric field in the region of loop doesn't changes with time

• The equation is only valid when electric field in the region of American loop doesn't changes with time. Oct 10, 2019 at 6:26
• I know that @unique Oct 10, 2019 at 6:27
• You must include in your answer that the equation is not valid in magneto-dynamics. Oct 10, 2019 at 6:33
• I am editing it. Oct 10, 2019 at 6:34