Complex integral, looking to evaluate it by antidifferentiation AND by parameterizing it 
Say I have a semi circle, oriented counter clockwise, $C_R$ that goes from R on the positive real axis to -R on the negative real axis. I am looking for -
$\int_{C_R}dz$
I have the answer from class as $\pi R$ and I can see from intuition that that is correct, as it is basically the perimeter of a semi circle.
But I when I try to work out the integral I am having trouble. I would like to be able to do it by two separate methods, parameterizing it, and using an antiderivative. Here's my attempts using both methods -


*

*As f(z) = dz has an antiderivative of z I have
$\int_{C_R}dz = z$ ("evaluated from -R to R") $= R - (-R) = 2R$, which is not equal to $\pi R$
This has me confused, I thought there is supposed to be path independence when you do it     using an antiderivative. But I cant see how their can be path independence because if f(z) = 1, as it in in this case, the integral of f(z) is the length of the contour. But if you go from -R to R along the axis the length is 2R, yet if you go along the curve it is $\pi R$. So path independence doesn't seem applicable here?

*Using the parameterization method I parameterized the curve with $z(t) = Re^{it}, ( 0 <= t <= \pi)$
Then using the integration formula $\int f(z(t))z'(t)$ with
$f(z(t)) = 1$ and $ z'(t) = (R)(it)e^{it}$ I have
$\int$ (from 0 to $\pi$) of $(R)(it)e^{it}$
I dont know where to go from here...
Is anyone able to do this integral using the antiderivative method and the parameterization method? $\int_{C_R}dz$
 A: The integral that would give you $\pi R$ would be this one 
$$
\int_{C_R} |dz|
$$
because this is "the length of the path". To compute it, you would need the fact that by letting $z = Re^{i\theta}$, you get $dz = iRe^{i\theta} \, d \theta$ hence $|dz| = R d\theta$. Therefore,
$$
\int_{C_R} |dz| = \int_0^{\pi} R d \theta = \pi R.
$$
This function does not admit a primitive because you can see it does not satisfy the path-independence property (if you go in a straight line from the complex numbers $R$ to $-R$ instead of taking the path $C_R$, your integral will indeed give you $2R$.
The integral
$$
\int_{C_R} dz
$$
is indeed equal to $-2R$ : the reason why is because you "add up the imaginary parts in the path", and the part where the path is "imaginary going up" cancels with the part that "imginary going down. (Notice the minus sign since you're going from right to left.) To describe precisely this phenomenon, if we replace $z = Re^{i\theta}$, $dz = i R e^{i\theta} d\theta$ and
$$
\int_{C_R} dz = \int_0^{\pi} Ri e^{i\theta} d\theta = \int_0^{\pi} Ri (\cos \theta + i \sin \theta) \, d \theta = R \left( \left( \int_0^{\pi} -\sin \theta d \theta \right) + i \left( \int_0^{\pi} \cos \theta d \theta \right) \right) = R \left. \left( \cos \theta + i \sin \right) \right|_{0}^{\pi} = -2R. 
$$
Notice how the imaginary part of the integral cancels out, as I predicted with my "going up going down" intuition that comes from the cosine integral.
Now that I think your fuzziness is probably gone, you can, without any problems (I hope) compute the integral
$$
\int_{C_R} dz = \left. z \right|_{R}^{-R} = -R - (-R) = -2R. 
$$
Hope that helps,
