Evaluating an improper integral $\int_{0}^{\infty}\frac{x^2}{(x^4+1)^2}dx$ I tried to solve the integral: $$\int_{0}^{\infty}\frac{x^2}{(x^4+1)^2}dx$$
using $ x = \sqrt{\tan(u)}$ and $dx = \frac{ \sec^2(u)}{2\sqrt{\tan(u)}} du,$
but I ended up with an even worse looking integral $$ \int_{0}^{\frac{\pi}{2}}\frac{\sqrt{\tan(u)}}{\sec^2(u)}du.$$
Wolfram gave an answer of $ \dfrac{\pi}{8\sqrt{2}},$ but how would one get to that answer?
 A: Consider the integral 
$$I(a,b)=\int_0^{\pi/2}\sin(x)^a\cos(x)^b\mathrm{d}x$$
Applying the substitution $t=\sin(x)^2$, we see that 
$$I(a,b)=\frac12\int_0^1t^{\frac{a-1}2}(1-t)^{\frac{b-1}2}\mathrm{d}t$$
$$I(a,b)=\frac12\int_0^1t^{\frac{a+1}2-1}(1-t)^{\frac{b+1}2-1}\mathrm{d}t$$
Recall the definition of the Beta function 
$$\mathrm B(x,y)=\int_0^1t^{x-1}(1-t)^{y-1}\mathrm{d}t=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)}$$
Where $\Gamma(s)$ is the Gamma Function.
Hence we see that 
$$I(a,b)=\frac{\Gamma(\frac{a+1}2)\Gamma(\frac{b+1}2)}{2\Gamma(\frac{a+b}2+1)}$$
From $$\frac{\tan(x)^{1/2}}{\sec(x)^2}=\sin(x)^{1/2}\cos(x)^{3/2}$$
We see that your integral is
$$I(1/2,3/2)=\frac{\Gamma(3/4)\Gamma(5/4)}{2\Gamma(2)}$$
$$I(1/2,3/2)=\frac{\Gamma(1/4)\Gamma(3/4)}{8}$$
And from
$$\Gamma(s)\Gamma(1-s)=\frac\pi{\sin\pi s},\qquad s\not\in\Bbb Z$$
We have 
$$I(1/2,3/2)=\frac{\pi}{8\sqrt2}$$
A: Write $$\frac{x^2}{(1+x^4)^2} = \frac{4x^3}{(1+x^4)^2} \cdot \frac{1}{4x}.$$  Then integration by parts with the choice $$u = \frac{1}{4x}, \quad du = -\frac{1}{4x^2} \, dx, \\ dv = \frac{4x^3}{(1+x^4)^2} \, dx, \quad v = -\frac{1}{1+x^4},$$ yields $$I_1(x) = \int \frac{x^2}{(1+x^4)^2} \, dx = -\frac{1}{4x(1+x^4)} - \int \frac{1}{4x^2(1+x^4)} \, dx.$$  Now write $$\frac{1}{x^2(1+x^4)} = \frac{1}{x^2} - \frac{x^2}{1+x^4},$$ thus $$I_1(x) = -\frac{1}{4x(1+x^4)} + \frac{1}{4x} + \frac{1}{4} \int \frac{x^2}{1+x^4} \, dx = \frac{x^3}{4(1+x^4)} + \frac{1}{4} I_2(x),$$ where we now seek to evaluate $I_2(x)$.  This is accomplished in a number of ways; one is to perform the factorization $$1+x^4 = (1 + \sqrt{2} x + x^2)(1 - \sqrt{2} x + x^2),$$ and compute the partial fraction decomposition $$\frac{x^2}{1+x^4} = \frac{1}{2\sqrt{2}} \left( \frac{x}{1 - \sqrt{2} x + x^2} - \frac{x}{1 + \sqrt{2} x + x^2} \right).$$  Then each term is integrable in closed form.  This is not the easiest or most elegant approach, but it is perhaps the most elementary, requiring no knowledge beyond AP Calculus BC.
A: We could do it with contour integration.
take the contour from 0 to R along the real axis.
$\int_0^R \frac {x^2}{(x^4+1)^2} \ dx$
The quater circle.
$\int_0^{\frac \pi 2} \frac {R^2e^2it}{(R^4e^{4it}+1)^2}(iRe^{it}) \ dt$
$\lim_\limits{R\to \infty} \frac {R^2e^2it}{(R^4e^{4it}+1)^2}(iRe^{it}) = 0$
And down the imaginary axis.
$\int_R^0 \frac {(e^{\frac {\pi}{2} i} x)^2}{((e^{\frac {\pi}{2} i} x)^4+1)^2} (e^{\frac {\pi}{2} i})\ dx\\
\int_R^0 \frac {-x^2}{x^4+1)^2} (i)\ dx\\
$
$(1+i)\int_0^\infty \frac {x^2}{(x^4+1)^2} \ dx = (2\pi i) \text{ Res}_{\left(x=e^{\frac\pi4i}\right)}\frac {x^2}{(x^4+1)^2}$
The pole is of order 2.
$\frac {d}{dx}\frac {x^2}{(x^3 + x^2e^{\frac \pi4 i} + xe^{\frac {2\pi}{4} i}+e^{\frac {3\pi}{4} i})^2} = \frac {2x(x^3 + x^2e^{\frac \pi4 i} + xe^{\frac {2\pi}{4} i}+e^{\frac {3\pi}{4} i}) - 2x^2(3x^2 + 2xe^{\frac \pi4 i} + e^{\frac {2\pi}{4} i})}{(x^3 + x^2e^{\frac \pi4 i} + xe^{\frac {2\pi}{4} i}+e^{\frac {3\pi}{4} i})^3}$
Evaluated at $e^{\frac {\pi}{4} i}$
$\frac {4}{(4e^{\frac {3\pi}4 i})^3} = \frac {1}{16e^{\frac {\pi}4 i}}$
$\int_0^\infty \frac {x^2}{(x^4+1)^2} \ dx = \frac {2\pi i}{16\sqrt 2 i} = \frac {\pi}{8\sqrt 2}$
A: Let us start with a step of integration by parts:
$$ \int_{0}^{+\infty}\frac{1}{4x}\cdot\frac{4x^3}{(x^4+1)^2}\,dx =\int_{0}^{+\infty}\frac{1}{4x^2}\left(1-\frac{1}{1+x^4}\right)\,dx=\frac{1}{4}\int_{0}^{+\infty}\frac{dx}{x^2+\frac{1}{x^2}}$$
and finish with Glasser's master theorem:
$$ \frac{1}{8}\int_{-\infty}^{+\infty}\frac{dx}{\left(x-\frac{1}{x}\right)^2+2}\stackrel{\text{GMT}}{=}\frac{1}{8}\int_{-\infty}^{+\infty}\frac{dx}{x^2+2} = \frac{\pi}{8\sqrt{2}}.$$
A: Using the method I employed here: we observe that
\begin{equation}
\int_{0}^{\infty} \frac{x^2}{\left(x^4 + 1\right)^2}\:dx = \frac{1}{4} \cdot 1^{\frac{2 + 1}{4} - 2} \cdot B\left(2 - \frac{2 + 1}{4}, \frac{2 + 1}{4} \right) = \frac{1}{4}B\left(\frac{5}{4}, \frac{3}{4}\right)
\end{equation}
Using the relationship between the Beta and Gamma function:
\begin{align}
 \int_{0}^{\infty} \frac{x^2}{\left(x^4 + 1\right)^2}\:dx &= \frac{1}{4}B\left(\frac{5}{4}, \frac{3}{4}\right) = \frac{1}{4}\frac{\Gamma\left(\frac{5}{4}\right)\Gamma\left(\frac{3}{4}\right)}{\Gamma\left(\frac{5}{4} + \frac{3}{4}\right)} \\
&= \frac{1}{4}\frac{\Gamma\left(\frac{5}{4}\right)\Gamma\left(\frac{3}{4}\right)}{\Gamma\left(2\right)} =\frac{\Gamma\left(\frac{5}{4}\right)\Gamma\left(\frac{3}{4}\right)}{8}
\end{align}
A: We first reduce the power 2 in the denominator by integration by parts.
$$
\displaystyle \begin{aligned}
 \int \frac{x^{2}}{\left(x^{4}+1\right)^{2}} d x &=-\frac{1}{4} \int \frac{1}{x} d\left(\frac{1}{x^{4}+1}\right) \\
&\stackrel{ IBP }=-\frac{1}{4 x\left(x^{4}+1\right)}-\frac{1}{4} \int \frac{1}{x^{2}\left(x^{4}+1\right)} d x \\
&=-\frac{1}{4 x\left(x^{4}+1\right)}-\frac{1}{4} \int\left(\frac{1}{x^{2}}-\frac{x^{2}}{x^{4}+1}\right) d x \\
&=-\frac{1}{4 x\left(x^{4}+1\right)}+\frac{1}{4 x}+\frac{1}{4} \int \frac{x^{2}}{x^{4}+1} d x \\
&=\frac{x^{3}}{4\left(x^{4}+1\right)}+\frac{1}{4} \int \frac{x^{2}}{x^{4}+1} d x
\end{aligned}
$$
$$
\therefore \int_{0}^{\infty} \frac{x^{2}}{\left(x^{4}+1\right)^{2}} d x =\frac{1}{4}\left[\frac{x^{3}}{x^{4}+1}\right]_{0}^{\infty}+\frac{1}{4} \int_{0}^{\infty} \frac{x^{2}}{x^{4}+1} d x 
= \frac{1}{4} \int_{0}^{\infty} \frac{x^{2}}{x^{4}+1} d x 
$$
Now we are going to play a little trick on the last integral. $$
\begin{aligned}
\int_{0}^{\infty} \frac{x^{2}}{x^{4}+1} d x&=\int_{0}^{\infty} \frac{1}{x^{2}+\frac{1}{x^{2}}} d x \\
&=\frac{1}{2} \int_{0}^{\infty} \frac{\left(1+\frac{1}{x^{2}}\right)+\left(1-\frac{1}{x^{2}}\right)}{x^{2}+\frac{1}{x^{2}}} d x \\
&=\frac{1}{2}\left[\int_{0}^{\infty} \frac{d\left(x-\frac{1}{x}\right)}{\left(x-\frac{1}{x}\right)^{2}+2}+\int_{0}^{\infty} \frac{d\left(x+\frac{1}{x}\right)}{\left(x+\frac{1}{x}\right)^{2}-2}\right] \\
&=\frac{1}{2 \sqrt{2}}\left[\tan ^{-1}\left(\frac{x-\frac{1}{x}}{\sqrt{2}}\right)+\frac{1}{4 \sqrt{2}} \ln \left|\frac{x+\frac{1}{x}-\sqrt{2}}{x+\frac{1}{x}+\sqrt{2}}\right|\right]_{0}^{\infty} \\
&=\frac{\pi}{2 \sqrt{2}}
\end{aligned}
$$
We can now conclude that
$$ \boxed{\int_0^{\infty} \frac{x^{2}}{\left(x^{4}+1\right)^{2}} d x =\frac{\pi}{8 \sqrt{2}}}$$
