integral computation $\int_{-\infty}^{\infty} \frac{1}{(1+x+x^2)^2} dx $ Compute the following integral: 
$\int_{-\infty}^{\infty} \frac{1}{(1+x+x^2)^2} dx$. Can some one give me some hints on how to do this?
I tried writing $(1+x+x^2)=f(x)$ and then multiplying and dividing by $\frac{d f(x)}{dx}=1+2x$ so we get $\int_{-\infty}^{\infty} \frac{1}{1+2x} \frac{1+2x}{(f(x))^2} dx $ = $\int_{-\infty}^{\infty} \frac{1}{1+2x} \frac{df(x)}{(f(x))^2} $. Here I tried to use integration by parts but I can't get anywhere.
 A: Let
$$\mathcal{I}(\lambda) = \int_{-\infty}^{\infty} \frac{1}{x^2+x+\lambda}\;{dx} $$
where
$\lambda > 0$.  We have
$$x^2+x+\lambda = (x+\frac{1}{2})^2+(\lambda-\frac{1}{4})\ ,$$
thus by setting $t = {x+\frac{1}{2}}$ we have
$$\mathcal{I}(\lambda) = \frac{2}{\sqrt{4\lambda-1}}\int_{-\infty}^{\infty}\frac{1}{1+t^2}\;{dt} = \frac{2\pi}{\sqrt{4\lambda-1}}\ .$$
Differentiating we get
$$\mathcal{I}'(\lambda) = -\frac{4\pi}{\sqrt{(4\lambda-1)^3}}$$
and
$$-\mathcal{I}'(1) =  \frac{4\pi}{3\sqrt{3}}\ .$$
See here if you haven't seen this method before. 
A: You could try to complete the square to get $\int_{-\infty}^{\infty} \cfrac{1}{((x+\frac{1}{2})^2+\frac{3}{4})^2} dx$ and then use the substitution $y = x+\frac{1}{2}$. This will give you:
$\int_{-\infty}^{\infty} \cfrac{1}{(y^2+\frac{3}{4})^2} dy$
After this, try the trigonometric substitution $y=\cfrac{\sqrt{3}}{2}\tan{\theta}$.
A: I assume you are not familiar with complex analysis techniques, so I will illustrate a partial fractions decomposition.  The denominator has zeroes when
$$x^2+x+1=0 \implies x=-\frac12 \pm i \frac{\sqrt{3}}{2} = e^{\pm i 2 \pi/3}$$
Thus
$$(x^2+x+1)^2 = (x-e^{i 2 \pi/3})^2 (x-e^{-i 2 \pi/3})^2$$
Let $w=e^{i 2 \pi/3}$.  Then
$$\frac1{(x^2+x+1)^2} = \frac{A}{x-w} + \frac{B}{(x-w)^2} + \frac{C}{x-\bar{w}} + \frac{D}{(x-\bar{w})^2}$$
This means that, when we compare numerators, we get that
$$A(x-w)(x-\bar{w})^2+B (x-\bar{w})^2 + C (x-\bar{w}) (x-w)^2 + D (x-w)^2 = 1$$
Equate coefficients of $x^k$:
$$(A+C) x^3 + [(-w-2 \bar{w}) A + B + (-\bar{w}-2 w) C +D] x^2 \\+ [(2 w \bar{w}+\bar{w}^2) A - 2 \bar{w} B +(2 w \bar{w} + w^2) C - 2 w D] x \\+ [- w \bar{w}^2 A + \bar{w}^2 B - \bar{w} w^2 C + w^2 D] = 1 $$
$$ \implies (A,B,C,D) = \left\{-\frac{2 i}{3 \sqrt{3}},-\frac{1}{3},\frac{2 i}{3
   \sqrt{3}},-\frac{1}{3}\right\}$$
Now, note that we do not even need to worry about the $B$ and $D$ values, because the integrals over the inverse square terms are zero.  Thus we are left with the integrand reducing to
$$-\frac{2 i}{3 \sqrt{3}} \left (\frac1{x-e^{i 2 \pi/3}} - \frac1{x-e^{-i 2 \pi/3}} \right )= \frac{2}{3} \frac1{x^2-x + 1} $$
We integrate this by completing the square in the denominator:
$$\frac{2}{3} \int_{-\infty}^{\infty} \frac{dx}{(x-1/2)^2+3/4} = \frac{2}{3} \int_{-\infty}^{\infty} \frac{dy}{y^2+3/4} = \frac{4 \pi}{3 \sqrt{3}} $$
