Evaluating a contour integral (don't understand my error) I'm trying to evaluate the integral 

$$ I = \int_{\gamma} \frac{1}{(z-a)(z-b)} dz$$

over the the circle of radius $r$ at the origin (assume that $|a| &lt; r &lt; |b|)$. Please note I haven't yet reached Cauchy's theorem in my book. 

Then we have 

$$ I = \int_0^{2\pi} \frac{ire^{it}}{(re^{it}-a)(re^{it}-b)} dt$$

And then we note that: 

$$
\frac{1}{(re^{it}-a)(re^{it}-b)} = \frac{a-b}{(a-b)(re^{it}-a)(re^{it}-b)} = \frac{(re^{it}-b)-(re^{it}-a)}{(a-b)(re^{it}-a)(re^{it}-b)} = \\
\frac{1}{(a-b)(re^{it}-a)} + \frac{1}{(b-a)(re^{it}-b)}
$$

So then we have 

$$ I = \int_0^{2\pi} \frac{ire^{it}}{(a-b)(re^{it}-a)} dt + \int_0^{2\pi} \frac{ire^{it}}{(b-a)(re^{it}-b)} dt $$

When I try to make a substitution $u = r e^{it} - a$ in the first integral (and similarly for the second integral) I have an answer like 

$$ I = \frac{ \log(r e^{it} - a) ]_0^{2\pi}}{a-b} + \frac{ \log(r e^{it} - b) ]_0^{2\pi}}{b-a}$$

which is $0$ and I do not think this is the correct answer; however I'm not sure what I did incorrectly along the way.
Added later: I seem to be getting downvoted because I did not answer the specific question asked. So be it. I think the below will be of help to others who have this question.



I would do this using series expansions: Write

$$\frac{1}{(z-a)(z-b)} = \frac{A}{z-a}
+ \frac{B}{z-b},$$

where the constants $A,B$ are easy enough to find. So we're left trying to figure out the integrals $\int_\gamma dz/(z-a),\int_\gamma dz/(z-b).$ The first integral equals

$$\tag 1\int_0^{2\pi}\frac{ire^{it}}{re^{it}-a}\,dt = i\int_0^{2\pi}\frac{1}{1-(a/r)e^{-it}}\,dt$$ $$ = i\int_0^{2\pi}\left (\sum_{n=0}^{\infty}(a/r)^ne^{-int}\right )\,dt = i\sum_{n=0}^{\infty}\int_0^{2\pi}(a/r)^ne^{-int}\,dt.$$

The only summand on the right that is nonzero is the $n=0$ term, so we see $(1)$ equals $2\pi i.$

The second integral can be handled similarly.
Added later: I seem to be getting downvoted because I did not answer the specific question asked. So be it. I think the below will be of help to others who have this question.



I would do this using series expansions: Write

$$\frac{1}{(z-a)(z-b)} = \frac{A}{z-a}
+ \frac{B}{z-b},$$

where the constants $A,B$ are easy enough to find. So we're left trying to figure out the integrals $\int_\gamma dz/(z-a),\int_\gamma dz/(z-b).$ The first integral equals

$$\tag 1\int_0^{2\pi}\frac{ire^{it}}{re^{it}-a}\,dt = i\int_0^{2\pi}\frac{1}{1-(a/r)e^{-it}}\,dt$$ $$ = i\int_0^{2\pi}\left (\sum_{n=0}^{\infty}(a/r)^ne^{-int}\right )\,dt = i\sum_{n=0}^{\infty}\int_0^{2\pi}(a/r)^ne^{-int}\,dt.$$

The only summand on the right that is nonzero is the $n=0$ term, so we see $(1)$ equals $2\pi i.$

The second integral can be handled similarly.