Calculating the complex line integral along a square Calculate the complex line integral of the holomorphic function g(z)=1/z along the counterclockwise-oriented square of side 2, with sides parallel to the axes, centred at the origin.
I parametrized the square as 4 lines in the complex plane, then integrated counterclockwise but ended with an answer of 0. However the answer in the back of the book says 2(pi)i, and I have no idea where this could have come from. Any help is appreciated.
 A: If you don't know the Cauchy Formula or the Residue theorem, you can split it into four separate integrals, one along each side of the square. You should get the expression below
$$
I = \int_{-1}^{1} \frac{i}{1+iy} dy + \int_{1}^{-1} \frac{dx}{x+i} + \int_{1}^{-1} \frac{i}{-1+iy} dy + \int_{-1}^{1} \frac{dx}{x-i} 
$$
Each of those four integrals evaluates to $i \pi /2$, giving $2 \pi i$.
These integrals follow from the fact that if $z=x+iy$, $dz=dx$ or $dz=i dy$ (respectively) on the horizontal and vertical edges of the square.
Alternately, you can combine the integrals pairwise, e.g. the two integrals with respect to x can be combined into
$$
\int_{-1}^{1} \frac{2i}{x^2+1} dx
$$
which evaluates to $i \pi$, as does the other pair of integrals with respect to y.
Added: One easy way to evaluate each of the four integrals above is to multiply by the complex conjugate of the denominator, so you make your denominator real. Then you'll only deal with real integrals (essentially). Eg.
$$
\int_{-1}^{1} \frac{dx}{x-i} \\
=\int_{-1}^{1} \frac{dx}{x-i} \frac{x+i}{x+i} \\
=\int_{-1}^{1} \frac{x+i}{x^2+1} dx \\
= 0 \text{(odd integral) } + i \tan^{-1}x |_{-1}^{+1} \\
= i (\pi/4 - (-\pi/4)) \\
= i \pi / 2 
$$
