Closed line integral with spherical coordinates So I had this question in my homework, but I could not solve it.
The question is as follows:
There is a closed path going from (0,0,0) to (1,0,0) to (0,1,0) to (0,1,2) to (0,0,0).
I have first transformed this to spherical coordinates
This gets me (with $(r,\theta,\phi)$ with theta the angle with the z-axiom and $\phi$ with the x): $$1:(0,0,0) $$$$ 2:(1,\pi/2,0)$$$$ 3:(\sqrt5,\arctan(1/2),\pi/2)$$$$ 4:(0,0,0)$$
There is a vector field : $$\mathbf A = r\cos^2\theta\,\boldsymbol{\hat r}-r\cos\theta\sin\theta\,\boldsymbol{\hat\theta}+3r\,\boldsymbol{\hat\phi}$$
And I have to solve the line integral of A over this path.
I have tried solving it by dividing the closed integral in 4 different ones and summing those up.
For each of these integrals I have defined a different ds-vector.
For the first one , $$ds=rd\phi\boldsymbol{\hat\phi}$$
For the second one, $$ds=dr\hat r$$
For the 3rd and 4th ones, $$ds=rd\theta\hat\theta+dr\hat r$$
I struggle with the 3rd and 4th integrals, because I only have a d$\theta$ but in my integral r isn't constant in this interval; I don't know how to solve this. I thought of entering my r values together with my $\theta$ values even though I don't integrate those. Doing this I came up with the answer $$1+1.5\pi$$ , but the correct answer is only $$1.5\pi$$
Could someone help me out?
Hi I'm really sorry I forgot to mention that all paths are straight lines, except the one from (1,0,0) to (0,1,0). This one is a quarter of a circle.
 A: Vector field $\vec F = r\cos^2\theta\,\boldsymbol{\hat r}-r\cos\theta\sin\theta\,\boldsymbol{\hat\theta}+3r\,\boldsymbol{\hat\phi}$
Th given path $\gamma: A(0, 0, 0) \to B (1, 0, 0) \to C(0, 1, 0) \to D (0, 1, 2) \to A \ $ (where all are straight lines except path $B \to C$ which is on a circle).
An easier solution is to convert this into two closed paths and do double integral,
$\gamma_1: A \to B \to C \to A$ in $XY$ plane  ($BC$ is a circular arc)
$\gamma_2: A \to C \to D \to A$ in $YZ$ plane
Please note segment $C \to A$ in path $\gamma_1$ and $A \to C$ in path $\gamma_2$ and line integrals over these segments cancel out each other and hence $ I(\gamma) = I(\gamma_1) \cup I(\gamma_2)$.
Now using Stokes' Theorem,
$ \displaystyle I(\gamma_1) = \int_{\gamma_1} \mathbf A \cdot dr = \int_{ABC} (\nabla \times \vec F) \cdot \hat n \ dS \ $
$ \displaystyle I(\gamma_2) = \int_{\gamma_2} \mathbf A \cdot dr = \int_{\triangle ACD} (\nabla \times \vec F) \cdot \hat n \ dS$
Using the formula for curl in spherical coordinates, $\nabla \times \vec F = 3 \cot \theta \ \hat r - 6 \ \hat \theta$
As surface $ABC$ is in $XY$ plane, $\theta = \frac{\pi}{2}$ and $\hat n = (\cos\theta \ \hat r - \sin\theta \ \hat \theta) = - \ \hat \theta$
So the first integral is $6$ times area of surface $ABC$. Surface area of $ABC$ is quarter of a unit circle = $6 \cdot \frac{\pi}{4} = \frac{3 \pi}{2}$.
As surface $ACD$ is in $YZ$ plane, $\phi = \frac{\pi}{2}$ and,
$\hat n = \sin\theta \cos\phi \ \hat r + \cos\theta \cos\phi \ \hat \theta - \sin \phi \ \hat \phi = - \hat \phi$
So the second integral is zero.
That leads to the final answer of $\frac{3 \pi}{2}$.
