compute integral $\int_0^{2\pi} \frac{1}{z-\cos(\phi)} d\phi$ Can anybody help me to compute the integral 
$$\int_0^{2\pi} \frac{1}{z-\cos(\phi)} d\phi$$
where $z \in \mathbb{C}$ denotes a complex number? Thank you!! 
 A: I suppose that $z \notin [-1,1]$.
$$
I = \int_0^{2 \pi} \frac{d \theta}{z - \cos \theta} = 
\int_0^{2 \pi} \frac{ 2 e^{i \theta} d \theta}{2z e^{i \theta} - (e^{i \theta})^2 - 1} =
2i \int_\gamma \frac{d \zeta}{\zeta^2 - 2 z \zeta + 1}
$$
where $\gamma$ is the unitary circle. Since $z \neq \pm 1$, the meromorphic function $f(\zeta) = (\zeta^2 - 2 z \zeta + 1)^{-1}$ has two simple poles
$$
\zeta_{1,2} = z \pm \sqrt{z^2 - 1}.
$$
Now you have to compute the residues of $f$ in $\zeta_{1,2}$, to check when $\zeta_{1,2}$ are contained in the unitary disk, and to use residue theorem to calculate $I$.
A: HINT: This is doable by Weierstrass substitution, with an example similar to yours worked out on the linked page.
A: This won't finish the problem off, but it's far too long for a "comment", so I'm putting it here.
Initially it seems heartening that the $z$ just stays put as $\varphi$ goes from $0$ to $2\pi$, but later we may have problems.
So I tried the Weierstrass substitution:
$$
\sin\varphi = \frac{2t}{1+t^2},\qquad \cos\varphi= \frac{1-t^2}{1+t^2},\qquad d\varphi= \frac{2\,dt}{1+t^2}
$$
Then
$$ \int_0^{2\pi} \frac{d\varphi}{z-\cos\varphi} = \int_{-\infty}^\infty \frac{2\,dt}{(z+1)t^2 + (z-1)} $$
If you don't see where the bounds of integration come from then think about how the Weierstrass substitution works.
This becomes
$$
\frac{2}{z-1}\int_{-\infty}^\infty \frac{dt}{\left(\frac{z+1}{z-1}\right) t^2 + 1} = \frac{2}{\sqrt{z^2-1}}\int_{???} \frac{du}{u^2 + 1}
$$
Now we have to worry about the multiple-valued nature of the square-root function and maybe the arctangent function.  The path followed by $u$ through the plane will be an unbounded straight line.
The denominator has zeroes at $\pm i$.  I think one would look at whether the line along which $u$ moves goes between those or they're both on the same side of it.
Maybe I'll add more here later some day.
