# Calculate $\int_{-\infty}^{\infty} \frac{dx}{(x^2 + 1)^2 (x^2 - 2x + 2)}$

Using complex integration, calculate the real integral $$\int_{-\infty}^{\infty} \frac{dx}{(x^2 + 1)^2 (x^2 - 2x + 2)}.$$

Attempt: I consider the complex function $$f(z) = \frac{1}{(z^2 + 1)^2 (z^2 - 2z + 2)}$$ and integrate it over a semicircular contour in the upper half-plane. The function $$f(z)$$ has poles at $$z = \pm i$$ (both of order 2) and $$z = 1 \pm i \sqrt{1}$$ (both simple). We choose a large semicircle $$C_R$$ of radius $$R$$ in the upper half-plane and integrate along the real axis and $$C_R$$. Now I want to use Jordan's lemma, but just don't know how. Is my approach ok?

Consider a contour $$C$$ that consists of a semi-circular arc $$\gamma$$ of radius $$R$$ centred at origin in the upper half plane and the subset of real line $$[-R, R]$$.

$$\oint_C f(z) \mathrm dz = \oint_{\gamma} f(z) \mathrm dz + \int\limits_{-R}^{R} f(x) \mathrm dx$$

By the ML estimation inequality, $$\left|\oint_{\gamma} f(z) \mathrm dz\right| \le \frac{\pi R}{(R^2-1)^2(R^2-2R-2)}$$ Taking $$R\to \infty$$ gives $$\left|\oint_{\gamma} f(z) \mathrm dz\right| \to 0$$. So

$$\oint_C f(z) \mathrm dz = \int\limits_{-\infty}^{\infty} f(x)\mathrm dx$$ Since $$f$$ has the residues $$i$$ of order $$2$$ and $$1+i$$ of order $$1$$ in the upper half plane we get $$\oint_C f(z) \mathrm dz = 2\pi i\sum_k \operatorname{Res}(f, z_k) = 2\pi i \left(\frac2{25} - \frac{19i}{100} - \frac2{25} + \frac{3i}{50}\right) = \frac{13\pi}{50}$$

Thus we conclude $$\boxed{\int\limits_{-\infty}^{\infty} \frac1{(x^2+1)^2(x^2-2x+2)}\mathrm dx = \frac{13\pi}{50}}$$

Your approach is correct. Let $$\gamma_R = C_R \cup [-R,R]$$. Observe that $$\int_{\gamma_R} f(z) dz = \int_{C_R} f(z) dz + \int_{-R}^R f(z) dz$$, so $$\int_{-R}^R f(z) dz = \int_{\gamma_R} f(z) dz - \int_{C_R} f(z) dz$$. The idea is that we can take $$R \rightarrow \infty$$ and and the LHS will equal the integral of interest. For the first term in the summand, you're going to use the poles you found and the Residue Theorem to find something nice.

For the second integral, you don't need Jordan's lemma. You can just use the estimation lemma/ML inequality (which is similar) to get that $$\left| \int_{C_R} f(z) dz \right| \leq \ell(C_r) \cdot \sup_{z \in C_R} |f(z)| \leq \ldots \leq \frac{\pi R}{(R^2-1)^2(R^2-2R-2)}.$$ The right-hand side of the inequality converges to zero as $$R \rightarrow \infty$$, which implies that $$\int_{C_R} f(z) dz \rightarrow 0$$ as well. The steps in-between come from the (reverse) triangle inequality + how $$C_R$$ is defined.

So, all that's left for you to do is to apply the residue theorem!

Use the inequality $$|(z^2+1)^2((z-1)^2+1)| \geq (|z|+1)^2)^2(|z-1|^2+1) \geq (|z|+1)^4(|z|+2)^2$$ and the fact that $$|z| = R$$ on $$C_R$$. Then on $$C_R$$, $$\left|\int_{C_R}f(z)dz\right| \leq \frac{\pi R}{(R+1)^4(R+2)^2}$$ by Jordan's lemma. As $$R\to \infty$$, the last quantity vanishes. So that $$\int_{(-\infty,\infty)}f(x)dx = 2\pi i[\mathrm{Res}(f(z);i)+\mathrm{Res}(f(z);1+i] = 2\pi i [(\frac{2}{25}-\frac{19i}{100})+(-\frac{2}{25}+\frac{6i}{100})] = \frac{13\pi}{50}.$$