Need help with $\int_{-\infty}^\infty \frac{x^2 \, dx}{x^4+2a^2x^2+b^4}$ I'm having trouble trying to evaluate this definite integral. Mathematica didn't help much.
$$\int_{-\infty}^\infty \frac{x^2 \, dx}{x^4+2a^2x^2+b^4}$$
where $a$, $b$ $\in \Bbb R^+$.
Is it possible to solve it analytically? What methods should I try?
 A: Let we set $\lambda=\frac{b}{a}$ . We want:
$$ I(a,b)=\int_{-\infty}^{+\infty}\frac{x^2\,dx}{(x^2+a^2)^2+(b^4-a^4)} = \frac{1}{a}\int_{-\infty}^{+\infty}\frac{x^2\,dx}{(x^2+1)^2+(\lambda^4-1)}$$
and assuming that $\zeta_1(\lambda),\zeta_2(\lambda)$ are the roots of $(x^2+1)^2=1-\lambda^4$ in the upper half-plane, the residue theorem gives:
$$ I(a,b)=\frac{2\pi i}{a}\sum_{j=1}^{2}\text{Res}\left(\frac{x^2}{(x^2+1)^2+(\lambda^4-1)},x=\zeta_j\right)$$
that by De l'Hopital theorem simplifies to:
$$ I(a,b)=\frac{\pi i}{2a}\sum_{j=1}^{2}\frac{\zeta_j}{1+\zeta_j^2}$$
where $1+\zeta_j^2$ is either $\sqrt{\lambda^4-1}$ or $-\sqrt{\lambda^4-1}$, $\zeta_1+\zeta_2+\overline{\zeta}_1+\overline{\zeta}_2=0$ by Viète's theorem and $\zeta_1-\zeta_2$ is deeply related with the discriminant of $(x^2+1)^2+(\lambda^4-1)$. Can you finish from here? I am getting:

$$ I(a,b) = \color{red}{\frac{\pi}{\sqrt{2(a^2+b^2)}}}. $$

A: We can write the integrand as
$$\begin{align}
\frac{x^2}{x^4+2a^2x^2+b^4}&=\frac{x^2}{(x^2+a^2+\sqrt{a^4-b^4})(x^2+a^2-\sqrt{a^4-b^4})}\\\\
&=\frac{A}{x^2+a^2-\sqrt{a^4-b^4}}+\frac{B}{x^2+a^2+\sqrt{a^4-b^4}}
\end{align}$$
where $A$ and $B$ are given respectively by
$$A=\frac{-a^2+\sqrt{a^4-b^4}}{2\sqrt{a^4-b^4}}$$
and
$$B=\frac{a^2+\sqrt{a^4-b^4}}{2\sqrt{a^4-b^4}}$$
Therefore, we find that for $a>b>0$
$$\begin{align}
\int_{-\infty}^\infty \frac{x^2}{x^4+2a^2x^2+b^4}\,dx&=2\int_0^\infty \frac{x^2}{x^4+2a^2x^2+b^4}\,dx\\\\
&=2A\int_0^\infty \frac{1}{x^2+a^2-\sqrt{a^4-b^4}}\,dx+2B\int_0^\infty \frac{1}{x^2+a^2+\sqrt{a^4-b^4}}\,dx\\\\
&=\frac{\pi A}{\sqrt{a^2-\sqrt{a^4-b^4}}}+\frac{\pi B}{\sqrt{a^2+\sqrt{a^4-b^4}}}\\\\
&=\frac{\pi}{2\sqrt{a^4-b^4}}\left(\sqrt{a^2+\sqrt{a^4-b^4}}-\sqrt{a^2-\sqrt{a^4-b^4}}\right)\\\\
&=\frac{\pi}{2\sqrt{a^4-b^4}}\left(\sqrt{2(a^2-b^2)}\right)\\\\
&=\frac{\pi}{\sqrt{2(a^2+b^2)}}
\end{align}$$
as expected!

Note that for $b>a>0$, result of the preceding development is unaltered.  One needs only to proceed with caution when evaluating the integrals, $\int \frac{1}{x^2+a^2\pm \sqrt{a^4-b^4}}\,dx$ due to the complex constants $a^2\pm \sqrt{a^4-b^4}$.
For the case $a=b>0$, the result of the preceding developing is unaltered.  The integral $\int_0^\infty \frac{x^2}{(x^2+a^2)^2}\,dx$ can easily be evaluated enforcing the substitution $x\to a\tan(x)$. 

A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Leftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\, #2 \,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
With $\ds{a, b \in \mathbb{R}^{+}}$ and $\ds{p \equiv \pars{a/b}^{2}}$,
\begin{align}
\color{#f00}{%
\int_{-\infty}^{\infty}{x^{2}\,\dd x \over x^{4} + 2a^{2}x^{2} + b^{4}}}
& =
{1 \over \verts{b}}
\int_{-\infty}^{\infty}{x^{2}\,\dd x \over x^{4} + 2px^{2} + 1} =
{1 \over \verts{b}}
\int_{0}^{\infty}{x^{1/2}\,\dd x \over x^{2} + 2px + 1}
\\[3mm] & =
{1 \over \verts{b}}
\int_{0}^{\infty}{x^{1/2}\,\dd x \over \pars{x - x_{+}}\pars{x - x_{-}}}
\end{align}
where $\braces{x_{\pm}}$ are the roots of $x^{2} + 2px + 1 = 0$ which are given by
$x_{\pm} = -p \pm \root{p^{2} - 1}$. The integration can be performed along a key-hole contour which takes into account the branch-cut of
$z^{1/2} = \verts{z}^{1/2}\exp\pars{\ic\phi/2}\,,\ z \not= 0\,,\
0 < \phi < 2\pi$. Then,


*

*${\large p < 1}$

The roots are given by $x_{\pm} = -p \pm \ic\root{1 - p^{2}}$ with $\verts{x_{\pm}} = 1$.

\begin{align}
2\pi\ic\bracks{%
{\verts{x_{+}}^{1/2}\expo{\ic\phi_{+}/2} \over x_{+} - x_{-}} +
{\verts{x_{-}}^{1/2}\expo{\ic\phi_{-}/2} \over x_{-} - x_{+}}} & =
\int_{0}^{\infty}{x^{1/2}\,\dd x \over x^{2} + 2px + 1} +
\int_{\infty}^{0}{x^{1/2}\expo{\ic\pi}\,\dd x \over x^{2} + 2px + 1}
\\[3mm] 
\int_{0}^{\infty}{x^{1/2}\,\dd x \over x^{2} + 2px + 1} & =
{\pi \over 2\root{1 - p^{2}}}\pars{\expo{\ic\phi_{+}/2} - \expo{\ic\phi_{-}/2}}
\\[3mm]
\phi_{+} = {\pi \over 2} + \delta\phi\,,\quad
\phi_{-} = {3\pi \over 2} - \delta\phi\,,\quad &
\delta\phi \equiv \arctan\pars{{p \over \root{1 - p^{2}}}}
\end{align}

\begin{align}
\int_{0}^{\infty}{x^{1/2}\,\dd x \over x^{2} + 2px + 1} & =
{\pi \over 2\root{1 - p^{2}}}\pars{%
\expo{\ic\pi/4}\expo{\ic\delta\phi/2} -
\expo{3\ic\pi/4}\expo{-\ic\delta\phi/2}}
\\[3mm] & =
{\pi \over 2\root{1 - p^{2}}}\bracks{%
{1 + \ic \over \root{2}}\,\expo{\ic\delta\phi/2} -
{-1 + \ic \over \root{2}}\,\expo{-\ic\delta\phi/2}}
\\[3mm] & =
{\root{2}\pi \over 2\root{1 - p^{2}}}\bracks{%
\cos\pars{\delta\phi \over 2} - \sin\pars{\delta\phi \over 2}}
\\[3mm] & =
{\root{2}\pi \over 2\root{1 - p^{2}}}\bracks{%
\root{{1 + \cos\pars{\delta\phi} \over 2}} -
\root{{1 - \cos\pars{\delta\phi}} \over 2}}
\end{align}

However,
$\ds{\cos\pars{\delta\phi} = {1 \over \root{\tan^{2}\pars{\delta\phi} + 1}}
     = \root{1 - p^{2}} = {\root{b^{2} - a^{2}} \over \verts{b}}}$:
\begin{align}
\int_{0}^{\infty}{x^{1/2}\,\dd x \over x^{2} + 2px + 1} & =
{\pi\verts{b}^{1/2} \over 2\root{b^{2} - a^{2}}}\bracks{%
\root{\verts{b} + \root{b^{2} - a^{2}}} -
\root{\verts{b} - \root{b^{2} - a^{2}}}}
\end{align}


*${\large p > 1}$. Both roots are negative:
$x_{\pm} = -p \pm \root{p^{2} - 1}$. The calculation is similar to the previous one.

