# How can I can solve integrals of rational functions of polynomials in $x$?

I would like to know a way to solve integrals such as this one: $$\int \frac{x}{3x - 4}dx$$

Also, I assume similar integrals where x is squared are solved in a similar manner. (If the answer is yes then don't also show me how to solve this second one, I want to see if I can do it myself. :) ) $$\int \frac{x^2}{x^2 - 1}dx$$

(I haven't included the conditions that x must meet in order for those to be valid expressions.)

-
Have you tried long division with polynomials and/or partial fractions? – Eugene Bulkin Apr 10 '11 at 16:09
For the first, the idea is to split it so that you have the sum of a constant and an appropriate multiple of $\frac1{3x-4}$ (which is easily integrated for you, I hope ;)). – J. M. Apr 10 '11 at 16:11
No, I don't know how, please give me an example. If you want, show me how to solve a similar one and leave this one to me. – Paul Manta Apr 10 '11 at 16:11
@J.M. Yes, thank you. So the second one can be written as $$\int (\frac{1}{x^2 - 1} + 1)dx$$. – Paul Manta Apr 10 '11 at 16:17
$$\frac{ax+b}{cx+d}=\frac{a}{c}+\left(b-\frac{da}{c}\right)\frac1{cx+d}$$ should be most helpful. – J. M. Apr 10 '11 at 16:24

Whenever you are trying to integrate a rational function, the first step is to do the division so that the numerator is of degree strictly smaller than the numerator (this is what Eugene Bulkin and J.M. are saying in the comments). For example, for $$\int \frac{x}{3x-4}\,dx$$ you should do the division of $x$ by $3x-4$ with remainder. This is $$x = \frac{1}{3}(3x-4) + \frac{4}{3}$$ which means that $$\frac{x}{3x-4} = \frac{1}{3} + \frac{4/3}{3x-4}.$$ So the integral can be rewritten as $$\int \frac{x}{3x-4}\,dx = \int\left(\frac{1}{3} + \frac{4/3}{3x-4}\right)\,dx = \int\frac{1}{3}\,dx + \frac{4}{3}\int \frac{1}{3x-4}\,dx.$$

The first integral is immediate. The second integral yields to a change of variable $u=3x-4$. We get \begin{align*} \int\frac{x}{3x-4}\,dx &= \int\frac{1}{3}\,dx + \frac{4}{3}\int\frac{1}{3x-4}\,dx\\ &= \frac{1}{3}x + \frac{4}{9}\int\frac{du}{u}\\ &= \frac{1}{3}x + \frac{4}{9}\ln|u| + C\\ &= \frac{1}{3}x + \frac{4}{9}\ln|3x-4| + C. \end{align*} In general, if you have a denominator of degree $1$, by doing the long division you can always express it as a polynomial plus a rational function of the form $$\frac{k}{ax+b}$$ with $k$, $a$, and $b$ constants. The polynomial is easy to integrate, and the fraction can be integrated with a change of variable.

The same is true for your second integral. Doing the long division gives, as you note, that $$\int \frac{x^2}{x^2-1}\,dx = \int\left(1 + \frac{1}{x^2-1}\right)\,dx = \int\,dx + \int\frac{1}{x^2-1}\,dx.$$ The first integral is easy. The second is as well, using partial fractions: $$\frac{1}{x^2-1} = \frac{1}{(x+1)(x-1)} = \frac{1/2}{x-1} - \frac{1/2}{x+1}$$ so: $$\int\frac{1}{x^2-1}\,dx = \frac{1}{2}\int\frac{dx}{x-1} - \frac{1}{2}\int\frac{dx}{x+1} = \frac{1}{2}\ln|x-1| - \frac{1}{2}\ln|x+1|+C.$$

-
I may be off school, but I'd love to read a textbook written by Arturo... – J. M. Apr 10 '11 at 18:39
+1..Very very good explanation. – night owl Apr 17 '11 at 5:37

For your two examples my first lines would be

$$\int \frac{x}{3x-4} \text{d}x = \int \frac{ \frac{1}{3}(3x-4) +4/3}{3x-4} \text{d}x$$

and

$$\int \frac{x^2}{x^2-1} \text{d}x = \int \frac{ (x^2-1) + 1}{x^2-1} \text{d}x .$$

You can easily extend this technique, for example

$$\int \frac{x^3}{x^2-1} \text{d}x = \int \frac{ x(x^2-1) + x}{x^2-1} \text{d}x .$$

-