# Integration of $\int\frac{1}{x^{4}+1}\mathrm dx$

I don't know how to integrate $$\displaystyle \int\frac{1}{x^{4}+1}\mathrm dx$$. Do I have to use trigonometric substitution?

Many duplicate posts link to this one as the target. (Those posts were merged into this one, which is the source of the many answers.)

• About 9 years ago I prepared a detailed evaluation of this integral, and a .pdf file of my write-up can be found at this 14 Oct. 2009 Math Forum sci.math post. Commented Jun 19, 2012 at 14:51
• Related problem (definite integral): math.stackexchange.com/q/43457/23353 (but not duplicate!) Commented Jan 14, 2015 at 4:32
• Reviewers: note that many duplicate posts link to this one as the target. Commented Aug 29, 2019 at 0:43
• Hypergeometric ... $x\;{}_2F_1(\frac14,1;\frac54;-x^4)$ Commented Jul 21, 2023 at 17:37

I think you can do it this way.

\begin{align*} \int \frac{1}{x^4 +1} \ dx & = \frac{1}{2} \cdot \int\frac{2}{1+x^{4}} \ dx \\\ &= \frac{1}{2} \cdot \int\frac{(1-x^{2}) + (1+x^{2})}{1+x^{4}} \ dx \\\ &=\frac{1}{2} \cdot \int \frac{1-x^2}{1+x^{4}} \ dx + \frac{1}{2} \int \frac{1+x^{2}}{1+x^{4}} \ dx \\\ &= \frac{1}{2} \cdot -\int \frac{1-\frac{1}{x^2}}{\left(x+\frac{1}{x}\right)^{2} - 2} \ dx + \text{same trick} \end{align*}

$$\int\frac 1{1+x^4}dx=\frac12\int\frac{1+x^2+1-x^2}{1+x^4}dx$$

$$\int\frac{1+x^2}{1+x^4}dx=\int\frac{\frac1{x^2}+1}{\left(x-\frac1x\right)^2+2}dx$$

Set $x-\frac1x=\sqrt2\tan\phi$

$$\int\frac{1-x^2}{1+x^4}dx=-\int\frac{1-\frac1{x^2}}{\left(x+\frac1x\right)^2-2}dx$$

Set $x+\frac1x=\sqrt2\sec\psi$

Reference: Trigonometric substitution

HINT : $$x^4+1 =(x^2+1)^2-2x^2 =(x^2+\sqrt 2x+1)(x^2-\sqrt2x+1)$$

You can factor $x^4+1 = (x^2 + \sqrt{2} x + 1) (x^2 -\sqrt{2}x + 1)$. This allows you to write the integrand as $\frac{a_1 x + b_1}{x^2 + \sqrt{2}x + 1} + \frac{a_2 x + b_2}{x^2- \sqrt{2}x + 1}$. You would then rewrite the denominator in the form of $(x-u)^2 + v$ and rewrite the numerator as $a_i (x-u) + w$, from which you can do a change of variable to integrate essentially $x/(x^2+1)$ and $1/(x^2+1)$.

My hint:

\begin{align} \int \frac{1}{1+x^4}dx &=\frac{1}{2} \left[\int \frac{1+x^2}{1+x^4}dx+\int\frac{1-x^2}{1+x^4}dx\right] \\ &= \frac{1}{2}\left[ \int \frac{1}{\left(x-\frac{1}{x}\right)^2+2} d\left(x-\frac{1}{x}\right) +\int\frac{1}{\left(x+\frac{1}{x}\right)^2-2} d\left(x-\frac{1}{x}\right) \right] \\ &= \frac{1}{2}\left[\frac{1}{\sqrt{2}}\arctan\frac{x^2-1}{\sqrt{2}x}+\frac{}{2\sqrt{2}}\ln\frac{x^2-\sqrt{2}x+1}{x^2+\sqrt{2}x+1}\right]+\text{Constant} \end{align}

HINT : Use $$x^4+1=(x^2+1)^2-(\sqrt 2x)^2=(x^2+\sqrt 2x+1)(x^2-\sqrt 2x+1)$$ to get \begin{align}\int\frac{dx}{1+x^4}&=\int\frac{\frac{1}{2\sqrt 2}x+\frac 12}{x^2+\sqrt 2x+1}dx+\int\frac{-\frac{1}{2\sqrt 2}x+\frac 12}{x^2-\sqrt 2x+1}dx\\&=\frac{1}{2\sqrt 2}\int\frac{x+\sqrt 2}{x^2+\sqrt 2x+1}dx-\frac{1}{2\sqrt 2}\int\frac{x-\sqrt 2}{x^2-\sqrt 2x+1}dx\\&=\frac{1}{\sqrt 2}\int\frac{x+\sqrt 2}{(\sqrt 2x+1)^2+1}dx-\frac{1}{\sqrt 2}\int\frac{x-\sqrt 2}{(\sqrt 2x-1)^2+1}dx.\end{align} Here, set $\sqrt 2x+1=\tan\alpha$ for the first and set $\sqrt 2x-1=\tan\beta$ for the second.

• Why don't you delete your other answer that is exactly the same as the first two lines of this answer? Commented Aug 28, 2019 at 19:33

By partial fractions, $$\frac{1}{1+x^4} = \frac{1}{2\sqrt{2}}\left(\frac{x + \sqrt{2}}{x^2 + \sqrt{2}x + 1} - \frac{x - \sqrt{2}}{x^2 - \sqrt{2}x + 1}\right).$$ The rest is standard and not a great deal of fun. Complete the squares at the bottom and make the natural substitutions.

Expand $\frac{1}{1+x^{4}}$ into partial fractions. For this purpose you need to factorize the polynomial in the denominator. You can proceed by writing it as a product of four linear terms \begin{equation*} x^{4}+1=(x-x_{1})(x-x_{2})(x-x_{3})(x-x_{4}) \end{equation*} where $x_{1},x_{2},x_{3},x_{4}$ are its complex roots. Since \begin{equation*} x^{4}+1=0\Leftrightarrow x^{4}=-1=\cos \pi +i\sin \pi \end{equation*} the four roots are

\begin{eqnarray*} x_{1} &=&\cos \left( \frac{\pi }{4}\right) +i\sin \left( \frac{\pi }{4} \right) =\frac{\sqrt{2}}{2}(1+i) \\ x_{2} &=&\cos \left( \frac{3\pi }{4}\right) +i\sin \left( \frac{3\pi }{4} \right) =\frac{\sqrt{2}}{2}(-1+i) \\ x_{3} &=&\overline{x}_{2} \\ x_{4} &=&\overline{x}_{1}. \end{eqnarray*} Rewrite $x^{4}+1$ as a product of quadratic terms, by grouping the factors $(x-x_{1}),(x-x_{4})=(x-\overline{x}_{1})$ and $(x-x_{2}),(x-x_{3})=(x- \overline{x}_{2})$

\begin{eqnarray*} x^{4}+1 &=&\left[ (x-x_{1})(x-\overline{x}_{1})\right] \left[ (x-x_{2})(x- \overline{x}_{2})\right] \\ &=&\left( x^{2}-\sqrt{2}+1\right) \left( x^{2}+\sqrt{2}x+1\right) \end{eqnarray*}

Find the constants $A,B,C,D$ such that \begin{equation*} \frac{1}{\left( x^{2}-x\sqrt{2}+1\right) \left( x^{2}+x\sqrt{2}+1\right) }= \frac{A+Bx}{x^{2}-x\sqrt{2}+1}+\frac{C+Dx}{x^{2}+\sqrt{2}x+1}. \end{equation*}

To evaluate \begin{equation*} \int \frac{1}{x^{2}\mp \sqrt{2}x+1}dx \end{equation*} complete the square in the denominator (see this answer of mine) \begin{equation*} x^{2}\mp \sqrt{2}x+1=\left( x\mp \frac{\sqrt{2}}{2}\right) ^{2}+\left( \frac{\sqrt{ 2}}{2}\right) ^{2} \end{equation*} and make the substitutions \begin{equation*} x\mp \frac{\sqrt{2}}{2}=\frac{\sqrt{2}}{2}t. \end{equation*} To compute the remaining integrals rewrite them as \begin{eqnarray*} \int \frac{x}{x^{2}\mp \sqrt{2}x+1}dx &=&\frac{1}{2}\int \frac{2x\mp \sqrt{2}}{ x^{2}\mp \sqrt{2}x+1}dx\pm\frac{\sqrt{2}}{2}\int \frac{1}{x^{2}\mp \sqrt{2}x+1}dx. \end{eqnarray*}

As in the question linked in Hans Lundmark's comment, you can factorise the denominator as $$x^4+1=(x^2+x\sqrt2+1)(x^2-x\sqrt2+1)\ .$$ However you can make the resulting integral a bit less painful by getting all the surds outside the integral sign: first substitute $$u=x\sqrt2\ .$$ Then we have $$4(x^4+1)=u^4+4=(u^2+2u+2)(u^2-2u+2)$$ and the integral is evaluated by (relatively) simple partial fractions: \eqalign{I &=\int\frac{dx}{x^4+1}\cr &=2\sqrt2\int\frac{du}{(u^2+2u+2)(u^2-2u+2)}\cr &=\frac{1}{4\sqrt2} \int\Bigl(\frac{2u+4}{u^2+2u+2}-\frac{2u-4}{u^2-2u+2}\Bigr)du\cr &=\frac{1}{4\sqrt2} \bigl(\ln(u^2+2u+2)-\ln(u^2-2u+2)\cr &\qquad\qquad\qquad{}+2\tan^{-1}(u+1)+2\tan^{-1}(u-1)\bigr)+C\ .\cr} You can now simplify the log and inverse tan terms (optional) and substitute back for $x$.

the key is to show $(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)=x^4+1$

It is posiible to use faktorization $1+x^4=(1-\sqrt{2}x+x^2)(1+\sqrt{2}x+x^2)$ and partial fractions.

Hint

Use $$1+t^4 = (1 + \sqrt{2} t + t^2 ) \times (1 - \sqrt{2} t + t^2 )$$ and decompose in partial fractions. You will arrive to much simpler antiderivatives.

I am sure that you can take from here.

Directly by Sophie Germain's Identity or:

$$x^4+1=x^4+2x^2+1-2x^2=(x^2+1)^2-(\sqrt2x)^2=(x^2-\sqrt2x+1)(x^2+\sqrt2x+1)$$

After splitting the initial fraction we get:

$$\int \frac{1}{x^4 +1} \ dx = \int \frac{\frac{x}{2\sqrt2}+\frac{1}{2}}{x^2+\sqrt2x+1} \ dx+\int \frac{\frac{-x}{2\sqrt2}+\frac{1}{2}}{x^2-\sqrt2x+1} \ dx=$$

$$\frac{\sqrt2}{8} \int \frac{2x+2\sqrt2}{x^2+\sqrt2x+1} dx-\frac{\sqrt2}{8} \int \frac{2x-2\sqrt2}{x^2-\sqrt2x+1} dx=$$

$$\frac{\sqrt2}{8} \int \frac{2x+\sqrt2}{x^2+\sqrt2x+1} dx +\frac{1}{4} \int \frac{1}{x^2+\sqrt2x+1} dx$$ \qquad-\frac{\sqrt2}{8}\int \frac{2x-\sqrt2}{x^2-\sqrt2x+1} dx +\frac{1}{4} \int\frac{1}{x^2-\sqrt2x+1}dx =$$$$\frac{\sqrt2}{8}\left( \int \frac{2x+\sqrt2}{x^2+\sqrt2x+1} dx -\int \frac{2x-\sqrt2}{x^2-\sqrt2x+1} dx \right)+$$ $$\frac{\sqrt2}{4} \left( \int \frac{\sqrt2}{(\sqrt2x+1)^2+1} dx+\int \frac{\sqrt2}{(\sqrt2x-1)^2+1} dx \right)=$$ $$\frac{\sqrt2}{8} \left(\ln(x^2+\sqrt2x+1)-\ln(x^2-\sqrt2x+1) \right) +\frac{\sqrt2}{4} \left(\arctan(\sqrt2x+1)+ \arctan(\sqrt2x-1)\right)+C$$ $$=\frac{\sqrt2}{8} \ln\frac{(x^2+x\sqrt2+1)}{(x^2-x\sqrt2+1)}+\frac{\sqrt2}{4}\arctan\frac{x\sqrt2}{1-x^2}+C.$$ Q.E.D. There are two (three) ways to go. One, assume$$x^4+1=(x^2+ax+1)(x^2-ax+1)$$You'll get that$${x^4} + 1 = {x^4} + \left( {2 - {a^2}} \right){x^2} + 1$$Then a=\sqrt 2 (or the other, by symmetry)$${x^4} + 1 = {x^4} + 1 = \left( {{x^2} + \sqrt 2 x + 1} \right)\left( {{x^2} - \sqrt 2 x + 1} \right)$$The other {x^2} = \tan \theta , but it might get messy, unless you know how to use the Weierstrass substitution for example.$$\int {\frac{{dx}}{{{x^4} + 1}}} = \int {\frac{{\left( {{{\tan }^2}\theta + 1} \right)d\theta }}{{{{\tan }^2}\theta + 1}}} \frac{1}{{2\sqrt {\tan \theta } }} = \int {\sqrt {\frac{{\cos\theta }}{{\sin\theta }}} \frac{{d\theta }}{2}} \int {\sqrt {\frac{{\frac{{1 - {u^2}}}{{1 + {u^2}}}}}{{\frac{{2u}}{{1 + {u^2}}}}}} \frac{{du}}{{1 + {u^2}}}} = \int {\sqrt {\frac{{1 - {u^2}}}{{2u}}} \frac{{du}}{{1 + {u^2}}}} $$However, Chandrasekar's is the best way to go, if you can figure it out. • Does the last integral succesfully figures itself out or did you just not want to work it out and knew it works? Commented Jun 19, 2012 at 4:00 The steps are as follows: 1) Decompose \frac{1}{1+x^{4}} using partial fractions (it can be factored using an identity of Sophie Germain) 2) You should have a linear function in each numerator and a quadratic in each denominator. Separate into the form \frac{const}{quadratic}+\frac{const\cdot x}{quadratic} 3) Complete the square on this quadratic. 4) To integrate the first form, make a simple substitution to transform the integrand into the form \frac{1}{1+u^{2}}, which is the derivative of \tan^{-1}(x). 5) For the second, make another substitution to transform the integrand into the form \frac{1}{1+v}, which has antiderivative \ln(1+v). Be very careful with tiny algebraic slips, and keep track of your constants. Hints:$$x^4+1=(x^2+\sqrt2\,x+1)(x^2-\sqrt2\,x+1)$$Partial Fractions, and yes: you'll need arctangents. • Or factor over the complex numbers, and your partial fractions will give you (complex) logarithms. Commented Dec 27, 2013 at 21:24 What Chandrasekhar wrote is a very nice trick. I'll offer you here a more "standard" one:$$x^4+1=(x^2+\sqrt{2}x+1)(x^2-\sqrt{2}x-1)\Longrightarrow \frac{1}{x^4+1}=\frac{Ax+B}{x^2+\sqrt{2}x+1}+\frac{Cx+D}{x^2-\sqrt{2}x-1} $$and now do partial fractions and find the coefficients \,A,B,C,D Added...or wait until someone else do it for you, of course. HINT (for partial fractions) :$$ x^4+1=(x^2+\sqrt2x+1)(x^2-\sqrt2x+1). $$• It is interesting that \sqrt{2} appears suddenly. I did not manage to separate it into factors. Commented Dec 19, 2012 at 12:30 • x^4+1 has 4 complex roots (the 4th roots of -1) which come in pairs w,\bar w and z, \bar z. Then one sees that w+\bar w=\pm\sqrt{2} and z+\bar z=\mp\sqrt 2. Commented Dec 19, 2012 at 12:42 • On a more elementary tune, consider the intermediate step x^4+1=(x^2+1)^2-2x^2. Here the appearence of \sqrt2 is immediately evident. Commented Dec 19, 2012 at 12:44 You can use$$x^4+1=(x^2+1)^2-2x^2=(x^2+1+\sqrt 2x)(x^2+1-\sqrt 2x).$$Then, find A,B,C,D such that$$\frac{1}{x^4+1}=\frac{Ax+B}{x^2+1+\sqrt 2x}+\frac{Cx+D}{x^2+1-\sqrt 2x}.$$You'll find$$\frac{1}{x^4+1}=\frac{1}{2\sqrt 2}\left\{ \frac{x+\sqrt 2}{x^2+\sqrt2 x+1}+\frac{-x+\sqrt 2}{x^2-\sqrt 2x+1}\right\}.

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

Enforce the substitution $$x:=\frac{1}{y}\implies dx=-\frac{dy}{y^2}$$ so that $$I=-\int\frac{dy}{y^2\left(\frac{1}{y^4}+1\right)}=-\int\frac{dy}{y^2+\frac{1}{y^2}}=-\frac{1}{2}\int\frac{1-\frac{1}{y^2}+1+\frac{1}{y^2}}{y^2+\frac{1}{y^2}}dy\tag1$$

Then observe that $$y^2+\frac{1}{y^2}=\left(y-\frac{1}{y}\right)^2+2=\left(y+\frac{1}{y}\right)^2-2\tag2$$

Now splitting $$I$$ at the end of $$(1)$$ into two integrals $$I=-\frac{1}{2}\int\frac{1-\frac{1}{y^2}+1+\frac{1}{y^2}}{y^2+\frac{1}{y^2}}dy=-\frac{1}{2}\int\frac{1-\frac{1}{y^2}}{y^2+\frac{1}{y^2}}dy-\frac{1}{2}\int\frac{1+\frac{1}{y^2}}{y^2+\frac{1}{y^2}}dy\tag3$$

Observe $$\frac{d}{dy}\left(y+\frac{1}{y}\right)=1-\frac{1}{y^2}$$ and $$\frac{d}{dy}\left(y-\frac{1}{y}\right)=1+\frac{1}{y^2}$$ The latter integrals in $$(3)$$ now become by combining the last identities & $$(2)$$:$$I=-\frac{1}{2}\int\frac{1-\frac{1}{y^2}}{\left(y+\frac{1}{y}\right)^2-2} dy-\frac{1}{2}\int\frac{1+\frac{1}{y^2}}{\left(y-\frac{1}{y}\right)^2+2} dy=-\frac{1}{2}\left(\int\frac{dt}{t^2-2}+\int\frac{du}{u^2+2}\right)$$

upon the substitutions $$t=y+\frac{1}{y}$$ and $$u=y-\frac{1}{y}$$.

$$I= -\frac{1}{2}\left(\int\frac{dt}{-2\left( 1-\left( \frac{t}{2} %% should be \sqrt 2 denominator \right)^2\right)} +\int\frac{du}{2\left( \left(\frac{u}{\sqrt{2}}\right)^2+1\right)} \right) =-\frac{1}{4}\left(\int\frac{du}{\left(\frac{u}{\sqrt{2}}\right)^2+1} -\int\frac{dt}{1-\left(\frac{t}{\sqrt{2}}\right)^2}\right)$$

$$=-\frac{\sqrt{2}}{4}\left(\int\frac{dw}{w^2+1}-\int\frac{dz}{1-z^2}\right)=-\frac{\sqrt{2}}{\sqrt{2^4}}\left(\arctan(w)-\text{arctanh}\right(z))+C$$

Note that $$w=\frac{u}{\sqrt{2}}=\frac{y-\frac{1}{y}}{\sqrt{2}}=\frac{\frac{1}{x}-x}{\sqrt{2}}$$ and $$z=\frac{t}{\sqrt{2}}=\frac{y+\frac{1}{y}}{\sqrt{2}}=\frac{\frac{1}{x}+x}{\sqrt{2}}$$

Thus $$I=\frac{1}{2\sqrt{2}}\left(\text{arctanh}\left(\frac{\frac{1}{x}+x}{\sqrt{2}}\right)-\text{arctan}\left(\frac{\frac{1}{x}-x}{\sqrt{2}}\right)\right)+C$$