Now I'm getting confused! The "generalized Stoke's theorem"
says that [itex]\int_{\partial M}\omega= \int_M d\omega[itex]where M is a manifold, [itex]\partial M[/itex] is its boundary, [itex]\omega[/itex] is a differential form on [\partial M[/itex], and [itex]d\omega[/itex] is its differential. If we take [itex]\omega[/itex] to be f(x,y,z)dS on the boundary of some 3 dimensional manifold, we get the divergence theorem and if we take it to be f(x,y,z)ds on the boundary of a 2 dimensional manifold, then we get the original "Stoke's theorem".<br />
<br />
A lot of detail is given here:<br />
<a href="http://mathworld.wolfram.com/StokesTheorem.html" target="_blank" class="link link--external" rel="nofollow ugc noopener">http://mathworld.wolfram.com/StokesTheorem.html</a><br />
<br />
But, once again, whether the normal is to the surface or the curve bounding the surface, it is typically <b>not</b> constant.<br />
<br />
One specific question that was asked was "If I have the bottom hemisphere of a ball, z<=0. What would be its normal vector?"<br />
<br />
We can parametrize the sphere, of radius R, centered at the origin, using x, y themselves: x= x, y= y, z= [itex]-\sqrt{R^2- x^2- y^2}[/itex]<br />
Then the "fundamental vector product" (see <a href="http://www.math.duke.edu/education/ccp/materials/mvcalc/parasurfs/para3.html" target="_blank" class="link link--external" rel="nofollow ugc noopener">http://www.math.duke.edu/education/ccp/materials/mvcalc/parasurfs/para3.html</a>) <br />
[tex](i+ \frac{x}{\sqrt{R^2-x^2-y^2}}k)X(j\frac{x}{\sqrt{R^2-x^2-y^2}}k)[/tex][/itex][tex]
is a normal vector to the surface. That time dxdy is the vector differential.<br />
<br />
It would, perhaps be easier to use "spherical coordinates" with [itex]\rho= R[/itex]: [itex]x= Rcos(\theta)sin(\phi), y= Rsin(\theta)sin(\phi), z= Rcos(\phi)[/itex].<br />
<br />
Now the fundamental vector product is<br />
[tex](-Rsin(\theta)sin(\phi)i+ Rcos(\theta)sin(\phi)j)X(Rcos(\theta)cos(\phi)i+ Rsin(\theta)cos(\phi)j- Rsin(\phi)k)[/tex]<br />
Again, that is a vector normal to the ball. [itex]d\vec{S}[/itex] would be that times [itex]d\thetad\phi[/itex]. To integrate over the bottom, [itex]\phi[/itex] would range from [itex]\frac{\pi}{2}[/itex] to [itex]\pi[/itex]. [itex]\theta[/itex], of course, ranges from 0 to [itex]2\pi[/itex].[/tex]