Evaluate $\int \frac{(x^2-1)(x^2+3)}{x^4-2x^3-6x-1}dx$ using elementary methods I found this problem while doing some integration from my problem practice book (unkown name). It said to evaluate it using elementary methods.
Please help me evaluating the following integral using elementary methods
$$\int \frac{(x^2-1)(x^2+3)}{x^4-2x^3-6x-1} \, dx.$$
I tried to factorize the denominator but it failed. I can't think of any substitution too. I tried to input this at wolfram alpha, and it showed the answer as a summation of a complex function formed using complex cube roots of unity.
Substitution of $x=\sec\theta$ also failed.
I am continuously thinking of this but I'm not getting how to start it. If I succeed I will post it. It will be great if someone could give a beautiful solution to this problem preferably using elementary methods.
I am a high school student in India. I know how to evaluate elementary integrals .
 A: Presented below is a full solution via elementary integration.
The polynomial $x^4-2x^3-6x-1$ admits two real roots, $a=$ -0.1650 and $b=$ 2.8068, computed with the standard quartic-root formulae below
$$a,b=\frac12\left(1+\sqrt r \pm \sqrt{3-r+{14}{r^{-\frac12}}}\right)\tag1
$$
with $ r= 1+ \left(\frac43\right)^{\frac23}\left( \sqrt[3]{\sqrt{129}+9} - \sqrt[3]{\sqrt{129}-9} \right) $.
Thus, the denominator of the integrand factorizes as
$$x^4-2x^3-6x-1=(x-a)(x-b)[x^2+(a+b-2)x-(ab)^{-1}]
$$
leading to following partial fractionalization
\begin{align}
\frac{(x^2-1)(x^2+3)}{x^4-2x^3-6x-1}
=1+ \frac {p}{x-a} + \frac {q}{x-b}+ \frac{(2-p-q )x-\frac1{ab}(2+\frac {p}a+ \frac {q}b)}{x^2+(a+b-2)x-\frac1{ab}}
\end{align}
with $p=\frac{a^3+a^2+3a-1}{2a^3-3a^2-3}$ and $q=\frac{b^3+b^2+3b-1}{2b^3-3b^2-3}$.
Then, integrate to obtain
\begin{align}
& \int \frac{(x^2-1)(x^2+3)}{x^4-2x^3-6x-1}dx\\
=& \>x +2p \ln|x-a| +2q \ln|x-b|+(1-p-q)\ln\left(x^2+(a+b-2)x-\frac1{ab}\right)\\
& \>-\frac{(1-p-q)(a+b-2)+\frac2{ab}(1+\frac pa + \frac qb)}{\sqrt{ -\frac{(a+b-2)^2}4-\frac1{ab}}}
\tan^{-1}\frac{x+\frac{a+b-2}2}{\sqrt{ -\frac{(a+b-2)^2}4-\frac1{ab}}}+C
\end{align}
The result, though rather involved in appearance, is expressed in terms of $a$ and $b$, the two real roots given in (1).
A: Introduction
In this answer, I'll cover :

*

*The basic reasoning that goes into partial fraction decomposition in high school, and the main stumbling block in this problem.


*Why the roots of the denominator do matter while integrating a rational function in general.


*The high-level generalized partial fraction decomposition and integral formula that involves complex numbers.


*When can the roots of the denominator be ignored, and when will they inevitably have to be calculated.


*The answer to why this question is NOT elementary (as written), and the explanation of the Wolfram-Alpha based answer that can be found here.

On partial fractions
In this kind of a situation, the kind of anti-derivative that one can expect is extremely regulated.
Indeed, let us remind ourselves how we usually do these kind of questions : we first factorize the denominator, then perform a partial fraction decomposition, and then the factors that we land up with all end up admitting closed anti-derivative formulas (possibly following some trigonometric/algebraic substitution), which we put together to obtain the result.
However, the point is that we are unable to get the roots of the denominator here. Yes, there is an explicit formula for the roots of a quartic, but let's say that it's too complicated to be carried out in the given situation, where the exercise is most likely testing factorization skill (and not via the use of a computer!), partial fraction decomposition and remembering the basic formulas.

Motivation for bringing in the roots of the denominator
Let us ask ourselves this question : when do we not need to get the roots of the denominator? This does occur in a few cases.
For example, if the function is of the form $\frac{p'(x)}{p(x)}$, then we know that we don't need to worry about roots and the answer is $\ln(p(x))$. Similarly, if you have something like $\frac{q(x)}{p(x)}$ where $q$ is in fact a multiple of $p$, then  you know that the roots are not going to get involved.
Even in the first example, however, the fact that $\frac{p'(x)}{p(x)} = \sum_{\omega \text { root of p}}\frac 1{x-\omega}$ has been used, since the antiderivative of the RHS is now $\ln(x-\omega)$ which using the log rules comes back to $\ln p(x)$. In other words, the regularity of the numerators in the partial fraction decomposition led to this particular phenomena occurring. In the second example, the fact that $q$ was a multiple of $p$ came from the fact that every root of $p$ is also a root of $q$. So the point is that even if there was simplification in both cases, there was also an observed pattern in the construction of $q$ vis-a-vis the roots of $p$.
So it seems that the roots of $p$ decide the integral of $\frac{q(x)}{p(x)}$ in a certain way, regardless of what $q$ is. Let me discuss this in more detail below.

Generalized Partial fraction decomposition
It is a nice fact (a result that's proven in a fashion very similar to partial fraction decomposition) that if $p(x) = \prod_{i=1}^n (x-a_i)^{b_i}$ is the complete factorization of $p$ into complex factors, so that the $a_i$ are (exactly) the roots of $p$ (which will all be complex numbers) and $b_i \geq 1$ are positive integers representing their multiplicity, then for any polynomial $q$ (with complex coefficients) with $\deg q < \deg p$, there are complex numbers $C_{i,k}$ that depend upon $p,q$, such that $$
\frac {q(x)}{p(x)} = \sum_{i=1}^{n} \sum_{k=1}^{b_i} \frac{C_{i,k}}{(x-a_i)^k}
$$
Therefore, we can use a summation-type rule for integration (Note : we are integrating terms with complex numbers involved, but I can convince you that these work out rigorously as well, so I'm not doing anything wrong for sure). A term of the form $\frac{C_{i,k}}{(x-a_i)^k}$ has an antiderivative depending on $k$ : we are essentially talking about $C_{i,k}(x-a_i)^{-k}$, so if $k \neq 1$ then the antiderivative is $\frac{C_{i,k}(x-a_i)^{-k+1}}{-k+1}$, and if $k=1$ then the antiderivative is $C_{i,k} \ln|x-{a_i}|$.
Using this rule, we conclude that the anti-derivative of $\frac{q(x)}{p(x)}$ is :
$$
\sum_{i=1}^n \left[C_{i,1}\ln|x-a_i| + \sum_{k=2}^{b_i} \frac{C_{i,k}(x-a_i)^{-k+1}}{-k+1}\right]
$$
which is an expression that involves the roots of $p$.
Also note, that if $\deg q \geq \deg p$, then we can divide $q$ by $p$ to write $q = q'p+r$ where $q'$ is a polynomial, so $\frac{q}{p} = q'+\frac{r}{p}$ and $q'$ can be easily integrated like a usual polynomial. So $q$ can be any polynomial, and we can always reduce to the above case.
Also note that logarithms , limits, derivatives and the like extend pretty much likewise to the complex domain, therefore all the manipulations that I'm doing below with the assumption that they are in the real domain, carry over supremely well to the complex domain as well.

So when do the roots matter?
The point, however, is : when can we reduce this to something "elementary"? The answer is : almost never. The examples in your books that cover partial fractions are extremely special , and usually tailored so that at least one of two things always happens :

*

*The $a_i$ and $b_i$ are easy to find i.e. $p$ is easy to factorize. In this case, we are satisfied that our solution is "explicit" even if it involves some transcendental functions.


*The relation between $q$ and $p$ is such that the $C_{i,k}$ are heavily symmetric in some fashion, allowing us to combine terms that correspond to different $a_i$ and use symmetric function theory to express these functions using coefficients of $p$. For example, if $q = p'$ then you can check that each of the $C_{i,1}$ equal $1$ and the others equal $0$, so the $\ln$s combine to give $\ln p$.
That's exactly why exercises in textbooks are usually solvable using "elementary" methods.
In a situation where neither of the above occurs (and there is no reason why picking some arbitrarily chosen $p$ and $q$ should necessarily imply that any of the above conditions hold), the truth is that you cannot do better than something of the above form. What you can also see in the above form is where the roots come in : the sum from $i=1$ to $n$ is a sum over the roots of the denominator, so the roots are definitely involved!

The Wolfram Answer
Let us calculate, for $q = (x^2-1)(x^2+3)$ and $p = x^4-2x^3-6x-1$, the $C_{i,k}$. The first thing that we do, of course is note that $\deg q = \deg p$ so we can divide $q$ by $p$ to get :
$$
\frac qp = 1 + \frac{2x^3+2x^2+6x-2}{p}
$$
and the $1$ integrates to become $x$. Now, it's about the roots of $p$.
A brief excursion into the theory of quartic equations will tell us that $p$ doesn't fall into any "easily reducible" quartic form, and hence its roots, however explicit will still be terribly difficult to extract. This means, in particular, that you will hope and pray that the $C_i$ have some pattern.
However, it can easily be shown that $p$ has four simple roots, with two real roots and a pair of complex roots. Coprimality with the derivative (the Euclidean algorithm) can be used to show simplicity, and a Sturm sequence can be shown to find the number of real roots, for example.(Note : you can ignore the fact that some roots are complex, I'm just putting it across to highlight that we are in the complex domain as well during this calculation) In other words, there are real numbers $a,b$ and a pair of (distinct) conjugate complex numbers $c,\bar{c}$ such that $p(x) = (x-a)(x-b)(x-c)(x-\bar{c})$.
Now we know that $$
\frac{2x^3+2x^2+6x-2}{p} = \frac{C_{1,a}}{(x-a)}+ \frac {C_{1,b}}{(x-b)} + \frac{C_{1,c}}{(x-c)} + \frac{C_{1,\bar{c}}}{(x-\bar{c})}
$$
and the question is to find these coefficients. For this, just take the $p$ to the other side , and you get :
$$
2x^3+2x^2+6x-2 = \frac{p(x)C_{1,a}}{(x-a)} + + \frac {p(x)C_{1,b}}{(x-b)} + \frac{p(x)C_{1,c}}{(x-c)} + \frac{p(x)C_{1,\bar{c}}}{(x-\bar{c})}
$$
Now, let's take the limit of both sides as $x\to a$, for example. What is the LHS? Well, it's $2a^3+2a^2+6a-2$. The RHS? Note that $p(a) = 0$, so $\frac{p(x)-p(a)}{(x-a)}$ is in fact the differential quotient at $a$, and that particular term will tend to $C_{1,a}p'(a)$. The rest of the terms will go to $0$ by the quotient rule. Finally, we get that $2a^3+2a^2+6a-2=C_{1,a} p'(a)$, and therefore $C_{1,a} = \frac{2a^3+2a^2+6a-2}{p'(a)}$. We know what $p'$ is , it is $4x^3-6x^2-6$, so this gives us an expression for $C_{1,a}$. The same can be done with the other roots, and the end result is that for every root $\omega$ of $p$, we have :
$$
C_{1,\omega} = \frac{2\omega^3+2\omega^2 + 6\omega-2}{4\omega^3 - 6 \omega^2 - 6} = \frac{\omega^3 + \omega^2 + 3 \omega - 1}{2\omega^3 - 3\omega^2-3}
$$
and therefore, according to the general formula, the complete antiderivative is given by
$$
x+\sum_{\omega : \omega \text { is a root of p}} \frac{\omega^3 + \omega^2 + 3 \omega - 1}{2\omega^3 - 3\omega^2-3} \log(x - \omega) +C$$
which explains the Wolfram-Alpha result.
What prevents the above from further simplification? It's quite simple : for the $\omega$ that are the roots of $p$, there is NO apparent connection at all, between the various $C_{1,\omega}$! That's why you can't combine the expressions above in any way (I mean, you can use log-additivity and so on to bring everything inside a single $\ln$, but you are not going to be able to get rid of the root-dependence).
The moral of this entire story is that there is a sure-shot way in which you will be able to get the generalized anti-derivative for your rational function. There are shortcuts to calculate the $C_{i,k}$ in general (using the same idea of limits) which will also give you a great idea as to what kind of relationship $p$ and $q$ must share, IF you are to find the anti-derivative of $\frac {q}{p}$ as written in a textbook. This should hopefully do for now, though!
