# Evaluating $\int \frac{1}{{x^4+1}} dx$ [duplicate]

I am trying to evaluate the integral

$$\int \frac{1}{1+x^4} \mathrm dx.$$

The integrand $\frac{1}{1+x^4}$ is a rational function (quotient of two polynomials), so I could solve the integral if I can find the partial fraction of $\frac{1}{1+x^4}$. But I failed to factorize $1+x^4$.

Any other methods are also wellcome.

• I suppose it's been long enough (6 to 7 weeks). At this Math Forum archived post you'll find 3 .pdf files giving extremely detailed evaluations of the antiderivative of $\frac{1}{x^n + 1}$ for $n=4,\;5,$ and $6.$ – Dave L. Renfro May 7 '13 at 19:43

Without using fractional decomposition: \begin{align}\int\dfrac{1}{x^4+1}~dx&=\dfrac{1}{2}\int\dfrac{2}{x^4+1}~dx \\&=\dfrac{1}{2}\int\dfrac{(x^2+1)-(x^2-1)}{x^4+1}~dx \\&=\dfrac{1}{2}\int\dfrac{x^2+1}{x^4+1}~dx-\dfrac{1}{2}\int\dfrac{x^2-1}{x^4+1}~dx \\&=\dfrac{1}{2}\int\dfrac{1+\dfrac{1}{x^2}}{x^2+\dfrac{1}{x^2}}~dx-\dfrac{1}{2}\int\dfrac{1-\dfrac{1}{x^2}}{x^2+\dfrac{1}{x^2}}~dx \\&=\dfrac{1}{2}\left(\int\dfrac{1+\dfrac{1}{x^2}}{\left(x-\dfrac{1}{x}\right)^2+2}~dx-\int\dfrac{1-\dfrac{1}{x^2}}{\left(x+\dfrac{1}{x}\right)^2-2}~dx\right) \\&=\dfrac{1}{2}\left(\int\dfrac{d\left(x-\dfrac{1}{x}\right)}{\left(x-\dfrac{1}{x}\right)^2+2}-\int\dfrac{d\left(x+\dfrac{1}{x}\right)}{\left(x+\dfrac{1}{x}\right)^2-2}\right)\end{align}

So, finally solution is $$\int\dfrac{1}{x^4+1}~dx=\dfrac{1}{4\sqrt2}\left(2\arctan\left(\dfrac{x^2-1}{\sqrt2x}\right)+\log\left(\dfrac{x^2+\sqrt2x+1}{x^2-\sqrt2x+1}\right)\right)+C$$

• This is really difficult . You are genius . – SmartCoder Mar 1 '18 at 13:49

Hint:
$$x^4+1=(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1) \tag{1}$$ You can integrate using partial fraction decomposition. Since $$x^4+1=(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1),$$ then $$\frac{1}{x^4+1}=\frac{Ax+B}{x^2-\sqrt{2}x+1}+\frac{Cx+D}{x^2+\sqrt{2}x+1}=\frac{(Ax+B)(x^2+\sqrt{2}x+1)+(Cx+D)(x^2-\sqrt{2}x+1)}{(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)} = \\ = \frac{x^3(A+C)+x^2(A\sqrt{2}+B+D-C\sqrt{2})+x(B\sqrt{2}-D\sqrt{2})+B+D}{(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)}$$ $$\begin{cases} A+C=0;\\ B+D+\sqrt{2}(A-C)=0; \\ B-D=0; \\ B+D=1. \end{cases}$$

$$A=-C=-\frac{1}{2\sqrt{2}}; \\ B=D=\frac{1}{2}$$

$$\frac{1}{x^4+1}=\frac{1}{2\sqrt{2}}\left(\dfrac{-x+\sqrt{2}}{x^2-\sqrt{2}x+1}+ \dfrac{x+\sqrt{2}}{x^2+\sqrt{2}x+1} \right).$$

Decomposition (1) can be done using one of the following ways:

1. Completion to the full square $$x^4+1=x^4 +2x^2+1 -2x^2=(x^2+1)^2-\left(\sqrt{2}x\right)^2 = \\ =\big(x^2-\sqrt{2}x +1 \big)\big( x^2+\sqrt{2}x +1 \big).$$

2. Let $\omega_i, \ i\in\{1,\, 2,\,3,\,4\}$ are roots of the equation $x^4+1=0$ over $\mathbb{C}:$ $\omega_1=\frac{\sqrt{2}}{2}(1-i), \ \omega_2=\frac{\sqrt{2}}{2}(1+i) \ \omega_3=\frac{\sqrt{2}}{2}(-1+i), \ \omega_4=\frac{\sqrt{2}}{2}(-1-i).$ Then use the decomposition into prime factors and multiply pairwise complex conjugate: $x^4+1= \left( x-\frac{\sqrt{2}}{2}(1-i) \right)\left( x-\frac{\sqrt{2}}{2}(1+i) \right)\left( x-\frac{\sqrt{2}}{2}(-1+i) \right)\left( x-\frac{\sqrt{2}}{2}(-1-i) \right) = \\ =\big(x^2-\sqrt{2}x +1 \big)\big( x^2+\sqrt{2}x +1 \big).$

• Its too difficult to calculate yet – kalpeshmpopat Mar 18 '13 at 8:51
• He said "FULL ANSWER"! – Amihai Zivan Mar 18 '13 at 9:06
• Why is that too difficult? Well, you could do $$\int\frac1{x^4+4}\,dx$$ first using the factorization coming from $$x^4+4=(x^4+4x^2+4)-4x^2=\cdots$$ and then do a linear substitution to get back to your integral. – Jyrki Lahtonen Mar 18 '13 at 9:06
• We won't do your homework - we try to teach you to do it yourself. – Jyrki Lahtonen Mar 18 '13 at 9:07
• @M.Strochyk How did you compute $x^4+1$ to be equal to $(x^2-\sqrt{2}x +1)(x^2+\sqrt{2}x+1)$? Is there a general method for doing that? – HeWhoMustBeNamed Nov 5 '17 at 5:02

$$I =\int \frac{1}{{x^4+1}} dx$$

If we add and subtract $2x^2$ to $x^4 + 1$, we get: $$\int \frac{1}{{x^4 + 2x^2 + 1 - 2x^2}}$$

We know $x^4 + 2x^2 + 1 = (x^2 + 1)^2$

$$\int \frac{1}{{(x^2 + 1)^2 - 2x^2}}$$

We know $a^2 - b^2 = (a - b)(a + b)$

Hence, $(x^2 + 1)^2 - 2x^2 = (x^2 + 1 - \sqrt{2}x)(x^2 + 1 + \sqrt{2}x)$

$$\int \frac{1}{{(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)}}$$

Now using partial fraction decomposition:

$$\frac{1}{(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)} = \frac{Ax + B}{x^2-\sqrt{2}x+1} + \frac{Cx + D}{x^2+\sqrt{2}x+1}$$

After you have found A, B, C and D, its just a basic $\frac{linear}{quadratic}$ type integral.

• Is there a general method for factorizing stuff like $x^4+1$? – HeWhoMustBeNamed Nov 5 '17 at 5:11

The indefinite integral is a rational fraction and is typically solved using partial fractions decomposition.

You first factor the denominator $x^4+1$, which has four complex roots, the fourth roots of minus one, let $\omega_0$, $\omega_1$, $\omega_2$, and $\omega_3$. Then you decompose

$$\frac1{x^4+1}=\frac a{x-\omega_0}+\frac b{x-\omega_1}+\frac c{x-\omega_2}+\frac d{x-\omega_3}$$

The unknown coefficients are found by multiplying by one of the denominators and taking the limit to the root:

$$a=\lim_{x\to\omega_0}\frac{x-\omega_0}{x^4+1}=\frac1{4\omega_0^3},$$ and similarly for the other terms.

Then, a single term is integrated with a complex logarithm $$\int\frac{dx}{x-\omega}=\ln(x-\omega)=\ln|x-\omega|+i\angle(x-\omega).$$

Here we have $\omega_0=\dfrac{1+i}{\sqrt2}$, hence

$$\ln\sqrt{(x-\frac1{\sqrt2})^2+(\frac1{\sqrt2})^2}-i\arctan\frac{\frac1{\sqrt2}}{x-\frac1{\sqrt2}}\\ =\frac12\ln(x^2-\sqrt2x+1)-i\frac\pi2+i\arctan(\sqrt2x-1).$$

Repeat for the four terms (there is a lot of symmetry) and form the linear combination.

• I could not understand the answer after Step 1 . – user589548 Oct 1 '18 at 15:41