Ampère's circuital law in differential form I'm having trouble understanding how certain conclusions are made in the explanation of Ampère's circuital law. Here's part of what's in my book:

Consider a magnetic field with induction $\vec B$. Find the circulation along the edges of an infinitesimal rectangle $PQRS$ in the xy-plane (The length of $SR$ is the length of $PQ$ which is $dx$). The circulation (if the direction you're going in is from $R$ to $S$) is:
$\Lambda_B=\oint_{PQRS}\vec B \cdot d\vec l = \int_{PQ}+\int_{QR}+\int_{RS}+\int_{SP}$
Now, along $QR$, parallel with the Y-direction, $d\vec l=\vec e_y dy$ and:
$\int_{QR}\vec B \cdot d\vec l=\vec B \cdot \vec e_ydy = B_yd_y$
Along $SP$, parallel with the -Y direction, $d\vec l=-\vec e_y dy$ so that:
$\int_{SP}\vec B \cdot d\vec l=-\vec B' \cdot \vec e_ydy = -B'_yd_y$
And so:
$\int_{QR}+\int_{SP}=(B_y-B'_y)dy$
But because $PQ = dx$, $B_y-B'_y = dB'_y = (\partial B_y/\partial x)dx$
...

Here are the things I don't understand:

*

*I assume that the magnetic field isn't homogeneous, since that isn't specified and since a differentiation is made between $B_y$ and $B'_y$ in resp. $QR$ and $SP$.
Why is that not taken into account when integrating over $QR$ and $SP$? The magnetic field isn't constant along the line. I first figured that this is why it's explicitly stated we're working with an "infinitesimal" rectangle and then it made sense to me, except for the fact that now I'm confused as to why $B_y$ and $B'_y$ aren't the same.


*How do you go from $dB'_y$ to $(\partial B_y/\partial x)dx$?
 A: I don't know which book you're reading from. I think you don't have to consider $B(x,y)$ as homogenous. Consider that when you integrate along your path, only the component $B_y$ will contribute along segment $QR$ and $SP$, while $B_x$ will contribute along $PQ$ and $RS$.
Consider the integral along $QR$.
$$
\tag{1}
\Gamma_{QR}=\int_{QR} \vec B(x,y)\cdot d\vec l=\int_{QR} B_y(x,y)dy
$$
If you consider that the segment $QR$ is small and $B_y$ doesn't vary very much along it, you can substitute $B_y$ with its mean value $\bar B_{y,QR}$ and you get:
$$
\tag{2}
\Gamma_{QR}=\bar B_{y,QR}dy
$$
Now at $Q$ we have $B_y(x,y)$, while at $R$ we have $B_y(x,y+dy)$ and we can write:
$$
\tag{3}
\bar B_{y,QR}=\frac{1}{2} [B_y(x,y)+B_y(x,y+dy)]=B_y(x,y)+\frac{1}{2}\frac{\partial B_y}{\partial y}dy
$$
where I've used Taylor expansion. At $S$ we have $B_y(x+dx,y+dy)$ and at $P$ we have $B_y(x+dx,y)$. With the same reasoning we get:
$$
\tag{4}
\bar B_{y,SP} =\frac{1}{2} [B_y(x+dx,y+dy)+B_y(x+dx,y)]=\\
=B_y(x,y)+\frac{\partial B_y}{\partial x}dx+\frac{1}{2}\frac{\partial B_y}{\partial y}dy
$$
Similarly to (2), the line integral along $SP$ is
$$\tag{5}
\Gamma_{SP}=-\bar B_{y,SP}dy
$$
Finally from (3) and (4)
$$
\tag{6}
\Gamma_{QR}+\Gamma_{SP}=-\frac{\partial B_y}{\partial x}dxdy
$$
The same reasoning for $B_x$ along $PQ$ and $RS$ will give:
$$
\tag{7}
\Gamma_{PQ}+\Gamma_{RS}=\frac{\partial B_x}{\partial y}dxdy
$$
Your line integral along the path will give
$$\tag{8}
\oint_{PQRS} \vec B(x,y)\cdot d\vec l=\Bigg(\frac{\partial B_x}{\partial y}-\frac{\partial B_y}{\partial x}\Bigg)dxdy
$$
