Here is my attempt. The result is not right. Please help identify the issue(s).

$\displaystyle f(x)=\int\cfrac{1}{x^4+1}\>\mathrm{d}x$, let $x=\tan t$, we have $ \mathrm{d}x = \sec^2 t\>\mathrm{d}t,\> t=\tan^{-1} x\in\left(-\cfrac{\pi}{2},\cfrac{\pi}{2}\right)$ \begin{align} \displaystyle f(\tan t)&= \int\cfrac{\sec^2 t\> \mathrm{d}t}{1+\tan^4 t}=\int\cfrac{\cos^2 t\> \mathrm{d}t}{\cos^4 t+\sin^4 t}=\int\cfrac{\cfrac{1+\cos 2t}{2}\> \mathrm{d}t}{(\cos^2 t+\sin^2 t)^2-2\sin^2 t\cos^2 t} \notag\\ &=\int\cfrac{1+\cos 2t}{2-\sin^2 2t} \>\mathrm{d}t =\int\cfrac{\mathrm{d}t}{2-\sin^2 2t} + \cfrac 12\int\cfrac{\mathrm{d}\sin 2t}{2-\sin^2 2t} \notag\\ &=\int\cfrac{\sec^2 2t \>\mathrm{d}t}{2\sec^2 2t-\tan^2 2t} + \cfrac {\sqrt{2}}8\int\cfrac{1}{\sqrt{2}-\sin 2t} + \cfrac{1}{\sqrt{2}+\sin 2t}\>\mathrm{d}\sin 2t \notag\\ &=\cfrac 12\int\cfrac{\mathrm{d}\tan 2t}{2+\tan^2 2t} +\cfrac{\sqrt{2}}{8}\ln \cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t} \notag\\ &=\cfrac {\sqrt{2}}4 \tan^{-1} \cfrac{\tan 2t}{\sqrt{2}} +\cfrac{\sqrt{2}}{8}\ln \cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t} \notag \end{align}

As $\tan 2t=\cfrac{2\tan t}{1-\tan^2 t}=\cfrac{2x}{1-x^2}, \cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t}=\cfrac{\sqrt{2}\sec^2 t+\tan t}{\sqrt{2}\sec^2 t-\tan t}=\cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x},$

$f(x)=\cfrac {\sqrt{2}}4 \tan^{-1} \cfrac{\sqrt{2}x}{1+x^2} +\cfrac{\sqrt{2}}{8}\ln \cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+c$

If the above holds, $\displaystyle \int_0^{\infty} \cfrac{\mathrm{d} x}{1+x^4}$ would be $0$, which is impossible(Should be $\cfrac {\sqrt{2}\pi}{4}$).

  • $\begingroup$ If I recall correctly, this is one of those integrals best approaches with an integration by parts (with $dv=1$). From there a change of variables should be straightforward. $\endgroup$
    – user123641
    Aug 6 '18 at 2:51
  • 4
    $\begingroup$ $x^4+1=x^4+2x^2+1-2x^2=(x^2+\sqrt{2}x+1)(x^2-\sqrt{2}+1)$ and you can use partial fractions $\endgroup$
    – saulspatz
    Aug 6 '18 at 2:55
  • 2
    $\begingroup$ Another approach is to use the fact that $$1/(x⁴+1)=\frac{1}{(x²+i)(x²-i)}=\frac{1}{(x+\sqrt{-i})(x-\sqrt{-i})(x+\sqrt{i})(x-\sqrt{i})}$$ and use partial fractions if you have the energy to work with ugly numbers $\endgroup$
    – ℋolo
    Aug 6 '18 at 2:58
  • $\begingroup$ @Holo but we should try to avoid complex no.s, right ?? I think it doesn't help in any way. $\endgroup$ Aug 6 '18 at 3:27

Comparing to the method I used in the following, maybe the issue occurs when computing $$ \int \frac {\mathrm dt} {2-\sin^2(2t)}. $$ Then from now on $t$ cannot take the value $\pm \pi /4$ if we want to devide the numerator and the denominator by $\cos^2(2t)$. Now to compute the improper integral, we should take the limit $x \to 1^-$ and $x\to 1^+$ separately, since the result is discontinuous at $1$. Fundamental Theorem of Calculus may deduce the wrong result if we apply it to a discontinued antiderivative. So if we use the OP as the antiderivative, we should compute $$ f(+\infty) - f(1^+) + f(1^-) - f(0), $$ which would give the right result $\sqrt 2 \pi/4$.

Conclusion: the computation in the OP is right, but when apply it to compute definite integral, we should split the interval at the point $1$.


I'm here to give another approach. We would introduce a conjugate pair. Assume $x \neq 0$. \begin{align*} \int \frac {\mathrm d x} {1+x^4} &= \frac 12 \int \frac {1-x^2}{1+x^4} \mathrm dx + \int \frac {1+x^2}{1+x^4}\mathrm dx \\ &= \frac 12 \int \frac {x^{-2} - 1}{x^2+x^{-2 }} \mathrm dx + \frac 12 \int \frac {x^{-2} + 1}{x^2+x^{-2 }} \mathrm dx\\ &= -\frac 12 \int \frac {\mathrm d (x + x^{-1})} {(x+x^{-1} )^2 -2} \mathrm dx+\frac 12 \int \frac {\mathrm d(x-x^{-1})} {(x - x^{-1})^2 +2}\\ &= -\frac {\sqrt 2}8 \int \left( \frac 1 {x +x^{-1}-\sqrt 2} - \frac 1{x+x^{-1}+ \sqrt 2}\right)\mathrm d(x+x^{-1}) \\ &\phantom{==}+\frac {\sqrt2}4 \int \frac {\mathrm d(x - x^{-1})/\sqrt 2} {((x-x^{-1})/\sqrt 2)^2 +1} \\ &= \frac {\sqrt 2}8 \log \left( \frac {x + x^{-1}+\sqrt 2} {x +x^{-1}-\sqrt 2}\right) + \frac {\sqrt 2}4 \mathrm {arctan}\left( \frac {x-x^{-1}} {\sqrt 2}\right) + C \\ &= \frac {\sqrt 2}8 \log \left(\frac {x^2 +\sqrt 2 x + 1} {x^2 - \sqrt2 x +1}\right) +\frac {\sqrt 2}4 \mathrm{arctan} \left(\frac {x^2 -1}{\sqrt 2 x}\right) + C. \end{align*}

If we use this as the result, then $$ f(+\infty) - f(0) = \frac {\sqrt 2} 4 \left( \frac \pi 2 + \frac \pi 2\right) = \frac {\sqrt 2}4 \pi. $$

Also note that when $x \neq 0$, $$ \arctan(x) + \mathrm{arccot} (x) = \mathrm {sgn} (x)\frac \pi 2 \implies \arctan (x) = \mathrm {sgn} (x)\frac \pi 2 + \arctan \left(-\frac 1x\right), $$ so the OP is correct.


First of all, you made a typo in the final answer — the correct answer must be $$f(x)=\frac{\sqrt{2}}{4}\tan^{-1}\frac{\sqrt{2}x}{1\color{red}{-}x^2}+\frac{\sqrt{2}}{8}\ln\frac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+C.$$

The next issue is the introduction of $\sec(2t)$ and $\tan(2t)$ when you switched to $$\int\frac{\sec^2 2t\,\mathrm{d}t}{2\sec^2 2t-\tan^2 2t}$$ (as part of an expression). Both $\sec(2t)$ and $\tan(2t)$ are undefined at some points within the domain $\displaystyle t\in\left(-\frac{\pi}{2},\frac{\pi}{2}\right)$, viz. at $\displaystyle t=\pm\frac{\pi}{4}$. Therefore, the antiderivative you find in terms of $t$ is in fact a piecewise-defined function: $$f(x(t))=\begin{cases} \cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\tan2t}{\sqrt{2}}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t}+C_1, \text{ if } t\in\left(-\cfrac{\pi}{2},-\cfrac{\pi}{4}\right); \\ \cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\tan2t}{\sqrt{2}}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t}+C_2, \text{ if } t\in\left(-\cfrac{\pi}{4},\cfrac{\pi}{4}\right); \\ \cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\tan2t}{\sqrt{2}}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}+\sin 2t}{\sqrt{2}-\sin 2t}+C_3, \text{ if } t\in\left(\cfrac{\pi}{4},\cfrac{\pi}{2}\right). \end{cases}$$

Switching back to $x$ still creates a piecewise-defined function: $$f(x)=\begin{cases} \cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\sqrt{2}x}{1\color{red}{-}x^2}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+C_1, \text{ if } x\in(-\infty,-1); \\ \cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\sqrt{2}x}{1\color{red}{-}x^2}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+C_2, \text{ if } x\in(-1,1); \\ \cfrac{\sqrt{2}}{4}\tan^{-1}\cfrac{\sqrt{2}x}{1\color{red}{-}x^2}+\cfrac{\sqrt{2}}{8}\ln\cfrac{\sqrt{2}(x^2+1)+x}{\sqrt{2}(x^2+1)-x}+C_3, \text{ if } x\in(1,+\infty). \end{cases}$$

At the points $x=\pm1$, these expressions are undefined, and so the corresponding integrals have to be treated as improper. In your case, the integral $\displaystyle \int_0^{+\infty}$ has to be split at the discontinuity at $x=1$: $$\int_0^{+\infty}\cdots\,\mathrm{d}x=\int_0^1\cdots\,\mathrm{d}x+\int_1^{+\infty}\cdots\,\mathrm{d}x,$$ and then, when evaluating the antiderivative that you found, you'll have to take the one-sided limits from the left and from the right at $x=1$, which are NOT equal to each other! And that's probably the source of your wrong answer.

More specifically: $$\lim_{x\to1^{-}}\frac{\sqrt{2}x}{1-x^2}=+\infty \implies \lim_{x\to1^{-}}\arctan\frac{\sqrt{2}x}{1-x^2}=\frac{\pi}{2},$$ while $$\lim_{x\to1^{+}}\frac{\sqrt{2}x}{1-x^2}=-\infty \implies \lim_{x\to1^{-}}\arctan\frac{\sqrt{2}x}{1-x^2}=-\frac{\pi}{2}.$$

  • 2
    $\begingroup$ This problem of branch cuts can be fixed by writing $\arctan(\sqrt{2}x +1) + \arctan(\sqrt{2}x - 1)$ instead of $\arctan[\sqrt{2}x/(1-x^2)]$, which gives the correct function. $\endgroup$ Aug 6 '18 at 4:32
  • $\begingroup$ @eyeballfrog: I agree. However, the OP's question wasn't asking for a different solution, but to help find out where the proposed solution went wrong. So I specifically limited my answer to an analysis of the proposed solution only. $\endgroup$
    – zipirovich
    Aug 6 '18 at 4:43
  • $\begingroup$ @zipirovich That's very considerate. I was having hard time to pick the "correct answer". Both of you pointed out my error. I chose yours over xbh's because you pointed out how the error is introduced. Thank you! $\endgroup$
    – Lance
    Aug 6 '18 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.