Solution (source code)

= Solution

For an oriented piecewise smooth <surface> $S$ with boundary $\partial S$, and a <vector field> $F$ continuously differentiable on a neighborhood of $S$, <Stokes theorem> states
$$
\boxed{\int_S(\nabla\times F)\cdot n\,dS=\oint_{\partial S}F\cdot dr.}
$$
Here $n$ is the chosen unit <normal vector>, $dS$ is the unsigned <surface area element>, and $dr$ is the tangent displacement along the boundary. The <right-hand rule> pairs the boundary orientation with $n$. If there are several boundary components, the <line integral> includes all of them with their induced orientations.

A <simply connected> <surface> is connected and every closed loop on it can be continuously contracted to a point while remaining on the <surface>. A disc is an example. An annulus is not <simply connected>: a loop winding once around its hole cannot contract within it.

\b[Stokes' theorem is valid for both types of surface], under the smoothness and orientation hypotheses above. Simple connectivity is not a requirement of the theorem. For a concrete annular example, take $F=(-y/2,x/2,0)$ and $a\leq r\leq R$ in the horizontal plane. Its <curl> is $(0,0,1)$, so the left side is $\pi(R^2-a^2)$. The right side is the counterclockwise outer-circle integral $\pi R^2$ minus the counterclockwise inner-circle integral $\pi a^2$, giving exactly the same answer. Omitting the inner boundary would be an incorrect application of the theorem.