How to find a normal vector to a surface at a given point? Suppose we define a curve $C$ by letting $C$ be the intersection of the unit sphere $x^2+y^2+z^2=1$ and the cylinder $x^2+y^2=x$ that takes place for $z>0$.
Now I want to use Stoke's theorem to be able to compute a line integral around $C$ and as such I will need to find a unit normal vector to any point in the interior of $C$ this region we can call $S$.
I'm really struggling on how to find a unit normal vector for $S$ so that I can calculate: 
$$\iint_S~(\nabla \times \vec{F})~\hat{n}~dS$$
I have got a parametrization for the curve $S$ but I don't really know if that will be of any use. 
 A: This results in an interesting curve: 

One surface $S$ with $\partial S = C$ is that bit of the cylinder sticking out of the unit sphere. It has easy normal vectors as well.
Another choice is the part of the unit sphere within the cylinder.
A: A vector normal to the surface of the sphere $x^2 + y^2 + z^2 = 1$,
$<x,y,z>$ would do it.
Or $<x/z, y/z, 1>$, or $<x/(1-x^2+y^2)^{1/2} , y/(1-x^2-y^2)^{1/2}, 1)$
$<-\partial z/\partial z,-\partial z/\partial y,1>$ is a generic approach for any surface in Cartesian coordinates.
Asked to provide more information...
It is high-school geometry that a vector from the center of a sphere will be normal to the surface. So, $<x,y,z>$ jumps out as a quick go-to...
$<x/z, y/z, 1>$ is nice because then a square unit in the x,y plane corresponds to the sq units above it.
But, if you are going to integrate in terms of $x$ and $y$ then it is handy to replace any $z$ terms as functions of $x,y$
To find the vector perpendicular to a more complicate surface... F(x,y,z) = K,
$\nabla F = <\partial F/\partial x,\partial F/\partial y,\partial F/\partial z>$ will be perpendicular to the surface.
If you can parameterize your surface in terms of $u$ and $v$ then:
$\partial S = <\partial x/\partial u,\partial y/\partial u,\partial z/\partial u>\times<\partial x/\partial v,\partial y/\partial v,\partial z/\partial v>$
and finally, you can use the existing $x,y$ that you already as your parameters.
$\partial S = <\partial x/\partial x,\partial y/\partial x,\partial z/\partial x>\times<\partial x/\partial y,\partial y/\partial y,\partial z/\partial y>$
which equals $<1,0,\partial z/\partial x>\times<0,1,\partial z/\partial y> = <-\partial z/\partial y,-\partial z/\partial y,1>$
Hope this helps
A: Typically when doing this you solve for $\hat{n}\cdot dS$ all at once rather than just the normal vector. When doing this there are a few ways.
If You Know A Normal Vector
Say you already know a normal vector to the surface, $\vec{N}$. Then
$$\hat{n}\cdot dS=\pm\frac{\vec{N}}{\vec{N}\cdot \hat{k}}$$
where the $\pm$ changes based on how you orient the surface.
Using the Gradient
You may have just thought the last method was counter intuitive, but you do know a normal vector to the surface! Say you have a function $g(x,y,z)=f(x,y,z)$, change it to the form $F(x,y,z)=c$ where $c$ is a constant. Then you are just looking at a level curve for the function $F$, and remember that gradients are always normal to level curves, so
$$\hat{n}\cdot dS=\pm\frac{\nabla F}{F_z}$$

You Have an Explicit Function for Z
Another common case would be if you were to be given the surface in the form $z=f(x,y,z)$. Then
$$\hat{n}\cdot dS=\pm<-z_x,-z_y,1>$$
You Have The Parametrization of the Surface
There is one last way that I know of that is for if you're given the parametrization of the function. Say the surface $S$ is defined by
$$S:\begin{cases}
x=x(u,v) \\
y=y(u,v) \\
z=z(u,v)
\end{cases}$$
Or in position vector notation we have the position vector,
$$\vec{r}=<x(u,v),y(u,v),z(u,v)>$$
Then
$$\hat{n}\cdot dS=\pm\left(\frac{\partial \vec{r}}{\partial u}\times\frac{\partial \vec{r}}{\partial v}\right)\text{d}u\text{d}v$$
A: This surface is called Viviani's window.
There are different ways of dealing with this. The best option, I believe, is to parametrize it in cartesian coordinates:
$$
x=x,\quad y=y, \quad z=\sqrt{1-x^2-y^2},\quad (x,y)\in D
$$
with
$$
D=\{(x,y)\;|\;x^2+y^2\le x \}
$$
This way
$$
\int_C \vec{F}\cdot d\vec{r}=\iint_S \nabla\times \vec{F}\cdot d\vec{S}
=\iint_D \nabla\times \vec{F}(x,y)\cdot \vec{r}_x\times\vec{r}_y\; dA
$$
This is where parametrizing in cartesian coordinates is handy: computing the normal vector (which is what you asked for)  $\vec{r}_x\times\vec{r}_y$ is always very simple as you have $1$'s and $0$'s in your vectors:
$$
\vec{r}_x\times\vec{r}_y = 
(1,0,\frac{-x}{\sqrt{1-x^2-y^2}})\times 
(0,1,\frac{-y}{\sqrt{1-x^2-y^2}})
=(\frac{x}{\sqrt{1-x^2-y^2}},\frac{y}{\sqrt{1-x^2-y^2}},1)
$$
You end up with 
$$
\iint_D \nabla\times \vec{F}(x,y)\cdot \vec{r}_x\times\vec{r}_y\; dA=\iint_D f(x,y)\; dA
$$
and from there a switch to polar coordinates and you are done:
$$
D=\{(r,\theta)\;|\; -\pi/2\le \theta \le \pi/2, 0\le r\le \cos{\theta} \}
$$
