Cauchy integral formula problem Let $C$ be the unit circle centered at the origin and $a \in \mathbb{R}$.
$$\int_0^{2\pi}\frac{dt}{1 + a^2 - 2a\cos(t)} = \int_C \frac{i\;dz}{(z-a)(az-1)}$$
Use Cauchy's integral formula to deduce if $0 \leq a < 1$ then,
$$\int_0^{2\pi}\frac{dt}{1 + a^2 - 2a\cos(t)} = \frac{2\pi}{1 - a^2}$$
I was unsure how to go about the first part. I could just try to compute both integrals and show they are equal but that doesn't seem to be what is wanted. Is there is a trick that I am missing?
As for the second part, I keep getting $0$. I use the first part, and see there are singularities at $z = a$ and $z = 1/a$. If $a < 1$ then the singularities lie within $C$ and Cauchy's integral formula can be used.
I think I can split the integral into two, where I take $1 / (z - a)$ to be my function and evaluate the integral around a circle centered at $1/a$, and vice versa take $1/(az - 1)$ to be my function and evaluate the integral around a circle centered at $a$.
Many thanks.
 A: Hints:
$$f(z):=\frac i{(z-a)(az-1)}\;\;;\;\;Res_{z=a}(f)=\lim_{z\to a}(z-a)f(z)=\frac i{a^2-1}\implies$$
$$\oint\limits_C f(z)dz=2\pi i\frac i{a^2-1}=\frac{2\pi}{1-a^2}$$
For the first part:
$$z=e^{it}\;,\;\;0\le t\le 2\pi\implies dz=ie^{it}dt=izdt\;\implies$$
$$1-2a\cos t+a^2=(\cos t-a)^2+\sin^2t=\left|\cos t+i\sin t-a\right|^2=|e^{it}-a|^2=$$
$$=(e^{it}-a)\overline{(e^{it}-a)}=(z-a)(\overline z-a)=(z-a)\left(\frac1z-a\right)=\frac1z(z-a)(1-az)$$
Thus
$$\int\limits_0^{2\pi}\frac{dt}{1+a^2-2a\cos t}=\oint\limits_C\frac{-i\,dz}{z\frac1z(z-a)(1-az)}$$
A: For the first part:
Assume $z=e^{it}$ as a substitution for the integral on the right side. Then
$\int_C \dfrac{i dz}{(z-1)(az-1)} = - \int_0^{2\pi} \dfrac{e^{it}dt}{a(1+e^{2it})-(1+a^2)e^{it}} = - \int_0^{2\pi} \dfrac{e^{it}dt}{a(1+\cos{2t}+i\sin{2t})-(1+a^2)(\cos{t}+i\sin{t})} = - \int_0^{2\pi} \dfrac{e^{it}dt}{(\cos{t}+i\sin{t})(2a\cos{t} -(1+a^2))} = \int_0^{2\pi} \dfrac{dt}{1+a^2 -2a\cos{t}}$.
For the second part,when 0≤a<1, the only singularity lies on the real axis within the unit circle at $a$ and it is a simple pole. So the residue can be computed as $\lim_{z\rightarrow a}(z-a)\dfrac{i}{(z-a)(az-1)}=\dfrac{i}{a^2−1}$. 
Hence the integral is $2πi× Residue= \dfrac{2\pi}{1-a^2}$
