# How do you integrate 1/(x^4+1) using partial fractions?

Nov 26, 2017

$\frac{1}{4 \sqrt{2}} \left(2 {\tan}^{-} 1 \left(\sqrt{2} x - 1\right) - \ln | 2 {x}^{2} - 2 \sqrt{2} x + 2 |\right) + \frac{1}{4 \sqrt{2}} \left(2 {\tan}^{-} 1 \left(\sqrt{2} x + 1\right) + \ln | 2 {x}^{2} + 2 \sqrt{2} x + 2 |\right) + C$

#### Explanation:

This is one hell of a process for a seemingly simple integral..

Anyway, our first step is to use partial fractions to split the integral into two. To do this, we need to factor the denominator:
$\frac{1}{{x}^{4} + 1} = \frac{1}{\left({x}^{2} - \sqrt{2} x + 1\right) \left({x}^{2} + \sqrt{2} x + 1\right)}$

Now we can write this like this:
$= \frac{A x + B}{{x}^{2} - \sqrt{2} x + 1} + \frac{C x + D}{{x}^{2} + \sqrt{2} x + 1}$

Note that we need the numerator to be a binomial since both the denominators are polynomials of degree two.

If we multiply both sides by the left hand side denominator, we get this:
$\frac{1}{\cancel{\left({x}^{2} - \sqrt{2} x + 1\right) \left({x}^{2} + \sqrt{2} x + 1\right)}} \cdot \cancel{\left({x}^{2} - \sqrt{2} x + 1\right) \left({x}^{2} + \sqrt{2} x + 1\right)} = \left({x}^{2} - \sqrt{2} x + 1\right) \left({x}^{2} + \sqrt{2} x + 1\right) \left(\frac{A x + B}{\cancel{{x}^{2} - \sqrt{2} x + 1}} + \frac{C x + D}{\cancel{{x}^{2} + \sqrt{2} x + 1}}\right)$

Cleaning up both sides, we get:
$1 = \left(A x + B\right) \left({x}^{2} + \sqrt{2} x + 1\right) + \left(C x + D\right) \left({x}^{2} - \sqrt{2} x + 1\right)$

If we expand this out, we get:
$1 = A {x}^{3} + \sqrt{2} A {x}^{2} + A x + B {x}^{2} + \sqrt{2} B x + B + C {x}^{3} - \sqrt{2} C {x}^{2} + C x + D {x}^{2} - \sqrt{2} D x + D$

If we group together all terms of the same degree, it looks a little better:
$1 = \left(A + C\right) {x}^{3} + \left(\sqrt{2} A - \sqrt{2} C + B + D\right) {x}^{2} + \left(A + C + \sqrt{2} B + \sqrt{2} D\right) x + \left(B + D\right)$

Since we know that there are no x terms of any degree on the left, we can setup the following system of equations for the coefficients:
$A + C = 0$
$\sqrt{2} A - \sqrt{2} C + B + D = 0$
$A + C + \sqrt{2} B - \sqrt{2} D = 0$
$B + D = 1$

Solving it, we get these results:
$A = - \frac{1}{2 \sqrt{2}} , B = \frac{1}{2} , C = \frac{1}{2 \sqrt{2}} , D = \frac{1}{2}$

Let's plug this back into our fraction:
$\int \setminus \frac{- \frac{1}{2 \sqrt{2}} x + \frac{1}{2}}{{x}^{2} - \sqrt{2} x + 1} + \frac{\frac{1}{2 \sqrt{2}} x + \frac{1}{2}}{{x}^{2} + \sqrt{2} x + 1} \setminus \mathrm{dx}$

We can simplify and split into two integrals:
$\int \setminus \frac{\sqrt{2} - x}{2 \sqrt{2} \left({x}^{2} - \sqrt{2} x + 1\right)} \setminus \mathrm{dx} + \int \setminus \frac{\sqrt{2} + x}{2 \sqrt{2} \left({x}^{2} + \sqrt{2} + 1\right)} \setminus \mathrm{dx}$

The process for evaluating these two integrals is basically the same, so I'm only going to show the left one.

First, we bring out the factor:
$\int \setminus \frac{\sqrt{2} - x}{2 \sqrt{2} \left({x}^{2} - \sqrt{2} x + 1\right)} \setminus \mathrm{dx} = \frac{1}{2 \sqrt{2}} \int \setminus \frac{\sqrt{2} - x}{{x}^{2} - \sqrt{2} x + 1} \setminus \mathrm{dx}$

Next we will complete the square on the bottom, so we can use a u substitution and get into the form of the $\frac{1}{{x}^{2} + 1}$ integral which we can solve. To complete the square, all we do is look at the middle coefficient, halve it and put it in an expression squared. We then look at what constant we need to add or subtract to get back to the original expression we had. Anyway, after completing the square, we get this:
$\frac{1}{2 \sqrt{2}} \int \setminus \frac{\sqrt{2} - x}{{\left(x - \frac{1}{\sqrt{2}}\right)}^{2} + \frac{1}{2}} \setminus \mathrm{dx}$

Now, let's do a u-substitution with $u = x - \frac{1}{\sqrt{2}}$. Because $\frac{\mathrm{du}}{\mathrm{dx}} = 1$, we don't need to anything special to integrate with respect to $u$:
$\frac{1}{2 \sqrt{2}} \int \setminus \frac{\sqrt{2} - x}{{u}^{2} + \frac{1}{2}} \setminus \mathrm{du}$

We do however need to solve for $x$ in terms of $u$. If we do that, we get:
$x = u + \frac{1}{\sqrt{2}}$

And now our integral looks like this:
$\frac{1}{2 \sqrt{2}} \int \setminus \frac{\sqrt{2} - \left(u + \frac{1}{\sqrt{2}}\right)}{{u}^{2} + \frac{1}{2}} \setminus \mathrm{du} = \frac{1}{2 \sqrt{2}} \int \setminus \frac{\frac{2}{\sqrt{2}} - \frac{1}{\sqrt{2}} - u}{{u}^{2} + \frac{1}{2}} \setminus \mathrm{du} =$

$\frac{1}{2 \sqrt{2}} \int \setminus \frac{2 \left(\frac{1}{\sqrt{2}} - u\right)}{2 {u}^{2} + 1} \setminus \mathrm{du} = \frac{1}{2 \cancel{\sqrt{2}}} \cancel{\sqrt{2}} \int \setminus \frac{1 - \sqrt{2} u}{2 {u}^{2} + 1} \setminus \mathrm{du}$

Now we can split up into two integrals once again:
1/2(int\ 1/(2u^2+1))\ du-int\ (sqrt2u)/(2u^2+1)\ du)

Let's first look at this one:
$\int \setminus \frac{1}{2 {u}^{2} + 1} \setminus \mathrm{du}$

We can do a u-substitution so that $2 {u}^{2} = {z}^{2}$. If we solve for $z$, we get:
$z = \sqrt{2} u$, $\frac{\mathrm{dz}}{\mathrm{du}} = \sqrt{2}$

Now we just divide through by $\sqrt{2}$ and integrate with respect to $z$:
$\frac{1}{\sqrt{2}} \int \setminus \frac{1}{{z}^{2} + 1} \setminus \mathrm{dz} = \frac{1}{\sqrt{2}} {\tan}^{-} 1 \left(z\right) = \frac{1}{\sqrt{2}} {\tan}^{-} 1 \left(\sqrt{2} u\right)$

Now for this integral:
$\int \setminus \frac{\sqrt{2} u}{2 {u}^{2} + 1} \setminus \mathrm{du} = \sqrt{2} \int \setminus \frac{u}{2 {u}^{2} + 1} \setminus \mathrm{du}$

We can let $t = 2 {u}^{2} + 1$, $\frac{\mathrm{dt}}{\mathrm{du}} = 4 u$, which gives:
$\frac{\sqrt{2}}{4} \int \setminus \frac{1}{t} \setminus \mathrm{dt} = \sqrt{\frac{2}{16}} \ln | t | = \frac{1}{\sqrt{8}} \ln | 2 {u}^{2} + 1 |$

Combining this with the other integral into the original expression, we get:
$\frac{1}{2} \int \setminus \frac{1 - \sqrt{2} u}{2 {u}^{2} + 1} \setminus \mathrm{du} = \frac{1}{2} \left(\frac{1}{\sqrt{2}} {\tan}^{-} 1 \left(\sqrt{2} u\right) - \frac{1}{2 \sqrt{2}} \ln | 2 {u}^{2} + 1 |\right)$

$= \frac{1}{2 \sqrt{2}} {\tan}^{-} 1 \left(\sqrt{2} u\right) - \frac{1}{4 \sqrt{2}} \ln | 2 {u}^{2} + 1 |$

Now we can resubstitute and get:
$\frac{1}{2 \sqrt{2}} {\tan}^{-} 1 \left(\sqrt{2} \left(x - \frac{1}{\sqrt{2}}\right)\right) - \frac{1}{4 \sqrt{2}} \ln | 2 {\left(x - \frac{1}{\sqrt{2}}\right)}^{2} + 1 |$

That was half the integral. If we combine and simplify with the other half (which remember, is evaluated basically the same), we will get the answer to be:
$\frac{1}{4 \sqrt{2}} \left(2 {\tan}^{-} 1 \left(\sqrt{2} x - 1\right) - \ln | 2 {x}^{2} - 2 \sqrt{2} x + 2 |\right) + \frac{1}{4 \sqrt{2}} \left(2 {\tan}^{-} 1 \left(\sqrt{2} x + 1\right) + \ln | 2 {x}^{2} + 2 \sqrt{2} x + 2 |\right) + C$