TITLE: Integrating a function from negative infinity to infinity
QUESTION [9 upvotes]: i got this weird question about integration from infinity to infinity.
$$\int_{-\infty}^{\infty} \frac{1}{z^2+25}$$
First idea was to take the factor out to get $(z+5)(z-5)$ but that really did not achieve anything.
Then i tried let $x= z^2$  and the $\frac{dx}{dz}= 2z$ then dz = 1/2z but that also went nowhere
Then i tried..... $x=z$, $\frac{dx}{dz}= 1$ hence $dz = dx$ 
$$\int_{-\infty}^{\infty} \frac{dx}{x^2+25}$$ which has not achieved anything. Please help!
Wait i just remember how this applies to partial fractions. But still confused how to grom infinity to infinity.
So start wit
$$\frac{1}{z^2+25}=\frac{1}{(z+5)(z-5)}$$
$$\frac{1}{(z+5)(z-5)}=\frac{A}{x+5}+\frac{B}{x-5}$$
$$1=A(x-5)+B(x+5)$$
At x = 5 $1=10B$ hence $B=0.1 
At x=-5 $A=1/-10$
But i'm not sure where to go from there

REPLY [16 votes]: I'll give an approach different from all of the above using complex analysis, which saves you from a lot of trigonometry and elementary algebraic manipulations. (This might be more likely the preferred approach of the problem, since it uses the variable $z$, which commonly denotes a complex variable.)
Note that the denominator $z^2+25=(z+5i)(z-5i)$ contains complex roots. Hence the integral is susceptible to the technique of integrating over a closed curve on the complex plane and applying the residue theorem.
More specifically, consider the half-circle $\gamma$ on the complex plane with the straight edge sitting on the real interval $[-R,R]$ and with the arc $Re^{i\theta}$ where $\theta\in[0,\pi]$. The function is rational, hence meromorphic, and the root $z=5i$ (with multiplicity $1$) is included inside this half-circle when $R>5$. Hence we compute the residue at $z=5i$:
$$\operatorname{res}_{5i}f=\lim_{z\to5i}\frac{z-5i}{(z+5i)(z-5i)}=\frac{1}{10i}$$
Now apply the residue theorem:
$$\int_\gamma f(z)\,dz=2\pi i\operatorname{res}_{5i}f=\frac{2\pi i}{10i}=\frac{\pi}{5}$$
It remains to prove that the integral around the arc $\gamma_R$ goes to $0$ as $R\to\infty$. The function is bounded on this arc by $1/(R^2+25)$, and the arc has length $\pi R$, so by the estimation lemma:
$$\lim_{R\to\infty}\left|\int_{\gamma_R}f(z)\,dz\right|\le\lim_{R\to\infty}\left|\frac{\pi R}{R^2+25}\right|$$
The right hand side has growth rate $O(R)$ in the numerator and $O(R^2)$ in the denominator, so it's straightforward to show that it goes to $0$ as $R\to\infty$ (by e.g. L'Hôpital's rule). Hence the integral on the real line is equal to the integral around the half-circle, that is
$$\int_{-\infty}^{\infty}\frac{1}{z^2+25}\,dz=\frac{\pi}{5}$$
as was required.