Evaluate \[ \int_0^\infty\frac{x^2+1}{x^4+1}\,dx. \]
Solution
1. The integrand decomposes as\[ \frac{x^2+1}{x^4+1} = \frac12 \left( \frac{1}{x^2+\sqrt2x+1} + \frac{1}{x^2-\sqrt2x+1} \right). \]
Factor \[ x^4+1 = (x^2+\sqrt2x+1)(x^2-\sqrt2x+1). \] Adding the two reciprocal quadratic factors gives \[ \frac{1}{x^2+\sqrt2x+1} + \frac{1}{x^2-\sqrt2x+1} = \frac{2(x^2+1)}{x^4+1}, \] which is the claimed identity.
2. An antiderivative of the integrand is\[ F(x) = \frac{1}{\sqrt2} \left( \arctan(\sqrt2x+1) + \arctan(\sqrt2x-1) \right). \]
Completing the square gives \[ x^2\pm\sqrt2x+1 = \left(x\pm\frac1{\sqrt2}\right)^2+\frac12. \] Therefore step 1 yields \[ \begin{aligned} \int\frac{x^2+1}{x^4+1}\,dx &= \frac12\int \frac{dx}{(x+1/\sqrt2)^2+1/2} + \frac12\int \frac{dx}{(x-1/\sqrt2)^2+1/2}\\ &= \frac{1}{\sqrt2} \left( \arctan(\sqrt2x+1) + \arctan(\sqrt2x-1) \right)+C. \end{aligned} \]
3. The value of the improper integral is\[ \boxed{\frac{\pi}{\sqrt2}}. \]
By step 2, \[ \begin{aligned} \int_0^\infty\frac{x^2+1}{x^4+1}\,dx &= \lim_{R\to\infty}\bigl(F(R)-F(0)\bigr)\\ &= \frac1{\sqrt2} \left( \frac\pi2+\frac\pi2 - \arctan(1) - \arctan(-1) \right)\\ &= \frac\pi{\sqrt2}, \end{aligned} \] because \(\arctan(1)=\pi/4\) and \(\arctan(-1)=-\pi/4\).
4. Q.E.D.
Step 3 gives the requested value.