Residues homework help

Homework Statement

Use residues to evaluate the improper integral:

$$\int^{\infty}_{- \infty}$$ $$\frac{cos(x)dx}{(x^{2} + a^{2})(x^{2} + b^{2})}$$ = $$\frac{\pi}{a^{2} - b^{2}}$$ ( $$\frac{e^{-b}}{b}$$ - $$\frac{e^{-a}}{a}$$ )

a>b>0

The Attempt at a Solution

If someone could just explain the concept of residues and how to apply them, that would be great. They give the answer, but you have to use residues to show how to get there. I've looked over my notes and through the book and I don't understand them at all.

The integrand, $cos(x)/(x^2+ a^2)(x^2+ b^2)$ is analytic everywhere except at $x=\pm ai$ and $x= \pm bi$. If you take a contour integral where the contour is the x-axis from (-R, 0) to (R,0) together with the half circle from (R,0) to (R, 0), you should be able to show that the integral over the half circle is 0 so that the integral over that contour is just the integral from $-\infty$ to $\infty$ as you want. Of course, that is equal to [itex]1/(2\pi i) times the sum of the residues at x= ai and x= bi which you should be able to caculate.