# How to Integrate 1/(x^4 + 1) by Hand

Antiderivatives of rational functions become more and more complicated as the degree of the denominator polynomial increases. We have already seen in other tutorials how to find the integrals of 1/(ax^2 + bx + c), 1/(x^3 + 1), and 1/(x^3 - 1). We can extend the methods used in those tutorials to find the antiderivative of 1/(x^4 + 1), a 4th degree rational function. The key is to find some factorization of the denominator that allows us to write the original function as the sum of two simpler functions.

With the integral of 1/(x^4 + 1) you can compute the area under the curve as well as solve some classes of separable differential equations. This tutorial shows the method of integration and some examples of its use in calculus.

## Step 1: Factoring x^4 + 1

At first glance, it may not seem possible to factor x^4 + 1 into the product of lower degree polynomials since the curve y = x^4 + 1 has no real roots. However, it turns out you can factor x^4 + 1 into the produce of two quadratics with non-rational coefficients:

x^4 + 1 = (x^2 + sqrt(2)x + 1) * (x^2 - sqrt(2)x + 1)

You can verify using FOIL that the product of these two 2nd-degree polynomials yields x^4 + 1.

## Step 2: Rewriting 1/(x^4 + 1) as a Sum

Since we know that

1/(x^4 + 1)

= 1/[(x^2 + sqrt(2)x + 1)(x^2 - sqrrt(2)x + 1)]

we can rewrite 1/(x^4 + 1) as

(Ax + B)/(x^2 + sqrt(2)x + 1) + (Cx + D)/(x^2 - sqrt(2) + 1)

where A, B, C, and D are coefficients yet to be determined. Writing the original integrand as the sum of two simpler rational functions makes the integration much easier. Now we have to find out what A, B, C, and D are and then we can start integrating.

## Step 3: Finding the Coefficients

To find the values of the four coefficients, we need to add both fractions together with a common denominator and produce a system of linear equations out of the numerator. If we add

(Ax + B)/(x^2 + sqrt(2)x + 1) + (Cx + D)/(x^2 - sqrt(2)x + 1)

with a common denominator, the denominator will be x^4 + 1, and the numerator will be

(A+C)x^3 + (-A√2 + B + C√2 + D)x^2 + (A - B√2 + C + D√2)x + (B+D)

## More Calculus Tutorials

See also these step-by-step integration tutorials to find the antiderivatives of other tricky functions

The coefficients of the x^3, x^2, and x terms must be 0, and the coefficient of the constant term must be 1. This gives us the linear system

A + C = 0

-A√2 + B + C√2 + D = 0

A - B√2 + C + D√2 = 0

B + D = 1

Using matrices or a 4-variable equation solver, the solution is

A = sqrt(2)/4

B = 1/2

C = -sqrt(2)/4

D = 1/2

## Step 4: Splitting Fractions

So far we have used simple algebra to prove that 1/(x^4 + 1) is equivalent to

[x*sqrt(2)/4 + 1/2]/[x^2 + sqrt(2)x + 1]

+ [-x*sqrt(2)/4 + 1/2]/[x^2 - sqrt(2) + 1]

We now need to further split this sum of two rational functions into the sum of four rational functions and then we can integrate the original problem. The split we will use is

[x*sqrt(2)/4 + 1/4]/[x^2 + sqrt(2)x + 1] + (1/4)/[x^2 + sqrt(2)x + 1]

+ [-x*sqrt(2)/4 + 1/4]/[x^2 - sqrt(2) + 1] + (1/4)/[x^2 - sqrt(2) + 1]

This is useful because x*sqrt(2)/4 + 1/4 is the derivative of x^2 + sqrt(2)x + 1 multiplied by sqrt(2)/8. Likewise, -x*sqrt(2)/4 + 1/4 is the derivative of x^2 - sqrt(2)x + 1 multiplied by -sqrt(2)/8. This means that both of these rational functions can be integrated with simple u-substitution.

And from a previous tutorial on integrating quadratic rational functions, we know how to integrate (1/4)/[x^2 + sqrt(2)x + 1] and (1/4)/[x^2 - sqrt(2)x + 1], since these are of the form 1/(ax^2 + bx + c). Therefore, we are all set to integrate the sum of four rational functions term by term.

## Step 5: Integrating

Using substitution with u = x^2 + sqrt(2)x + 1 and w = x^2 - sqrt(2)x + 1, we have

∫ [x*sqrt(2)/4 + 1/4]/[x^2 + sqrt(2)x + 1] dx

= (sqrt(2)/8)*Ln(x^2 + sqrt(2)x + 1) + C

∫ [-x*sqrt(2)/4 + 1/4]/[x^2 - sqrt(2)x + 1] dx

= (-sqrt(2)/8)*Ln(x^2 - sqrt(2)x + 1) + C

Using the previous tutorial on integrating a quadratic rational function, we also have

∫ (1/4)/[x^2 + sqrt(2)x + 1] dx

= (sqrt(2)/4)*arctan(sqrt(2)x + 1) + C

∫ (1/4)/[x^2 - sqrt(2)x + 1] dx

= (sqrt(2)/4)*arctan(sqrt(2)x - 1) + C

Using properties of logarithms, we can simplify the sum of these four integrals. The final antiderivative expression is

∫ 1/(x^4 + 1) dx

= (sqrt(2)/8)*Ln[(x^2 + sqrt(2)x + 1)/(x^2 - sqrt(2)x + 1)] +

(sqrt(2)/4)*arctan[sqrt(2)x + 1] + (sqrt(2)/4)*arctan[sqrt(2)x - 1]+ C

## Area Under the Curve y = 1/(x^4 + 1)

The total area under the curve y = 1/(x^4 + 1) is the integral of 1/(x^4 + 1) evaluated from x = -infinity to x = infinity. Since we know the antiderivative, we can find ares between finite bounds simply by plugging the bounds into the antiderivative function and subtracting. But when dealing with infinite bounds, we need to be more careful and treat the expressions as limits. The total area under the curve of y = 1/(x^4 + 1) is given by the limit expression

lim(x → ∞) (sqrt(2)/8)*Ln[(x^2 + sqrt(2)x + 1)/(x^2 - sqrt(2)x + 1)]

+ lim(x → ∞) (sqrt(2)/4)*arctan[sqrt(2)x + 1]

+ lim(x → ∞) (sqrt(2)/4)*arctan[sqrt(2)x - 1]

- lim(x → -∞) (sqrt(2)/8)*Ln[(x^2 + sqrt(2)x + 1)/(x^2 - sqrt(2)x + 1)]

- lim(x → -∞) (sqrt(2)/4)*arctan[sqrt(2)x + 1]

- lim(x → -∞) (sqrt(2)/4)*arctan[sqrt(2)x - 1]

Evaluating the limits gives us

(sqrt(2)/8)*Ln(1) + sqrt(2)π/8 + sqrt(2)π/8

- (sqrt(2)/8)*Ln(1) - (-sqrt(2)π/8) - (-sqrt(2)π/8)

= sqrt(2)π/4 - (-sqrt(2)π/4)

= sqrt(2)π/2

= π/sqrt(2)

## Another Example

The function f(x) = [sqrt(2)/pi]/[x^4 + 1] over the domain (-∞, ∞) is a probability density function since the area under the curve is exactly 1. What value of x is the 75th percentile for this probability distribution? In other words, what is the value k such that the function f(x) integrated from -∞ to k equals exactly 3/4?

From the previous example we know that the antiderivative of [sqrt(2)/pi]/[x^4 + 1] evaluated at -∞ equals -1/2. Now we just need solve the equation

[1/(4π)]Ln[(k^2+sqrt(2)k+1)/(k^2-sqrt(2)k+1)] + [1/(2π)]arctan[sqrt(2)k+1] + [1/(2π)]arctan[sqrt(2)k-1] - (-1/2) = 3/4

This cannot be solved algebraically, but with a solver took the value of k is approximately 0.566396. Therefore, the 75th percentile is at x = 0.566396.