# Use the Stokes's theorem to evaluate the line integral $\oint_c y dx + x dy + (x^2 + y^2 + z^2) dz$

I am using the Stokes's theorem to evaluate the following line integral, $$\oint_c y dx + x dy + (x^2 + y^2 + z^2) dz$$ where $$C$$ is the curve $$x^2 + y^2 = 1, z = xy$$ directed clockwise as viewed from the point $$(0,0,1)$$. I have

$$\oint_c y dx + x dy + (x^2 + y^2 + z^2) dz = \int \int_{S} \operatorname{curl}(y, x, x^2 + y^2 + z^2) \cdot \bar{n} dS$$

I am not looking to solve the full question right now, but I'm just wondering how to get $$\bar{n}$$ and $$\operatorname{curl}$$.
For $$\bar{n}$$ the solution is $$\bar{n} = \frac{(y, x, -1)}{\sqrt{x^2 + y^2 + 1}}.$$ How do we get this result?
For the $$\operatorname{curl}$$ we have

$$\begin{split} \operatorname{curl}(y, x, x^2 + y^2 + z^2) &= \begin{bmatrix} i & j & k \\ \frac{d}{dx} & \frac{d}{dy} & \frac{d}{dz} \\ y & x & x^2 + y^2 + z^2 \end{bmatrix}\\ \\ &= \begin{bmatrix} i & j & k \\ 0 & 0 & 2z \\ y & x & x^2 + y^2 + z^2 \end{bmatrix} \\ \\ & = i(-2zx) + j(2zy) + 0k \equiv (-2zx, 2zy, 0) \end{split}$$ while the stated answer of the exercise is $$(2y, -2x, 0).$$ What did I do wrong?

For any surface, eg $$F(x,y,z)=f(x,y)-z=0$$, the vector $$\nabla F= \left(\dfrac{\partial F}{\partial x},\dfrac{\partial F}{\partial y},\dfrac{\partial F}{\partial z}\right)=\left(\dfrac{\partial f}{\partial x},\dfrac{\partial f}{\partial y},-1\right)$$ is perpendicular to this surface, so, a vector normal and unitary is

$$\bar n=\nabla F/|\nabla F|=\bar{n} = \dfrac{(y, x, -1)}{\sqrt{x^2 + y^2 + 1}}$$

With $$F(x,y,z)=xy-z$$

I am not sure how you understood the determinant to calculate the curl but this is how the shorthand works (it's a purely formal device to facilitate calculations: we aren't in fact writing vectors into the determinant).

$$\operatorname{curl}(y, x, x^2 + y^2 + z^2) = \begin{vmatrix} i & j & k \\ \dfrac{\partial}{\partial x} & \dfrac{\partial}{\partial y} & \dfrac{\partial}{\partial z} \\ y & x & x^2 + y^2 + z^2 \end{vmatrix}=$$

$$=\left(\dfrac{\partial (x^2+y^2+z^2)}{\partial y}-\dfrac{\partial x}{\partial z}\right)i+\left(\dfrac{\partial y}{\partial z}-\dfrac{\partial (x^2+y^2+z^2)}{\partial x}\right)j+\left(\dfrac{\partial x}{\partial x}-\dfrac{\partial y}{\partial y}\right)j=2yi-2xj$$

As expected.