Exercise: Evaluate the following integral using the Cauchy Integral Formula (the contour is traversed once anti-clockwise):
$$ \int_{|z| = 2} \frac{(z^2 + 1)}{(z - 3) (z^2 - 1)} dz $$
I found the singularities as being:
$$z=3\; and\; z = \pm 1$$
I then plotted these points and the contour on the argand diagram and then rewrote the integral as:
$$ \int_{|z| = 2} \frac{\frac{(z^2 + 1)}{(z - 3)}}{(z^2 - 1)} dz $$
because the singularity $z = 3$ is outside the contour $|z| = 2$ and to use Cauchy's generalised integral formula $f(z)$ must not have any singularities within the contour on the plane.
At this point I can't just immediately use the formula because of the form of the denominator. Expanding it into $ (z - 1) (z + 1) $ doesn't satisfy the formula either. $(z - 1) (z + 1)$ != $(z - w)^{n-1}$.
How do I evaluate this integral?
Hint: \begin{align} \dfrac{1}{2\pi i} \int_{|z| = 2} \frac{\frac{(z^2 + 1)}{(z - 3)}}{(z^2 - 1)} dz &=\dfrac{1}{2\pi i} \int_{C_1} \frac{\frac{(z^2 + 1)}{(z - 3)(z-1)}}{(z + 1)^1} dz +\dfrac{1}{2\pi i} \int_{C_2} \frac{\frac{(z^2 + 1)}{(z - 3)(z+1)}}{(z - 1)^1} dz \\ &=\dfrac{1}{2\pi i} \int_{C_1} \frac{f_1}{(z + 1)^1} dz +\dfrac{1}{2\pi i} \int_{C_2} \frac{f_2}{(z - 1)^1} dz \end{align} where $f_1$ ad $f_2$ are analytic over $C_1$ and $C_2$ respectively.