Solution (source code)

= Solution

For a smooth oriented surface $S$ with piecewise smooth boundary $C=\partial S$ and a continuously differentiable <vector field> $\mathbf G$, the <Stokes theorem> states
$$
\boxed{\int_S(\boldsymbol\nabla\times\mathbf G)\cdot\mathbf n\,dS
=\oint_{\partial S}\mathbf G\cdot d\mathbf r.}
$$
The <boundary orientation> is fixed by the <right-hand rule>: curling the fingers along the positive boundary direction makes the thumb point along the surface normal. For an outward upper cap, its boundary <ellipse> is traversed counterclockwise when viewed from the positive $z$ direction. The figure shows two possible caps with the same oriented boundary, anticipating the last part.

\Image[/past-exam-of-the-mathematics-course-of-the-year-1-of-the-natural-sciences-course-of-the-university-of-cambridge/2016/paper-1-stokes-orientation.png]
{title=Two outward-oriented caps share a counterclockwise boundary and the same curl flux}