Integration of rational functions.

Literature: Collection of problems in mathematics. Part 1. Edited by A. V. Efimov, B. P. Demidovich.

Integration of an arbitrary rational function $\frac{P_m(x)}{Q_n(x)}=\frac{b_mx^m+...+b_1x+b_0}{a_nx^n+...+a_1x+a_0}$ with real coefficients is performed as follows in the general case.

If $m\geq n$, then it is necessary to preliminarily extract the integer part from this fraction, that is, represent it in the form $$\frac{P_m(x)}{Q_n(x)}=M_{m-n}+\frac{R_r(x)}{Q_n(x)},$$ where $M_{m-n}(x)$ and $R_r(x)$ are polynomials of degrees $m-n\geq 0$ and $r$ respectively, and $r

The extraction of the integer part in the fraction $\frac{P_m(x)}{Q_n(x)}$ is performed by dividing the numerator by the denominator using long division.

To integrate a proper rational function $\frac{P_m(x)}{Q_n(x)},$ $m

Let the denominator $Q_n(x)=a_nx^n+...+a_1x_1+a_0$ have the decomposition $$Q_n(x)=a_n(x-\alpha_1)^{s_1}...(x-\alpha_l)^{s_l}(x^2+p_1x+q_1)^{t_1}(x^2+p_kx+q_k)^{t_k}.$$ Then the decomposition of the fraction $\frac{P_m(x)}{Q_n(x)}$ into a sum of simple fractions is as follows:

$$\frac{P_m(x)}{Q_n(x)}=\frac{A_{11}}{x-\alpha_1}+...+\frac{A_{s_11}}{(x-\alpha_1)^{s1}}+...+\frac{A_{1l}}{x-\alpha_l}+...+\frac{A_{s_ll}}{(x-\alpha_l)^{s_l}}+$$ $$+\frac{B_{11}x+C_{11}}{x^2+p_1x+q_1}+...+\frac{B_{t_11}+C_{t_11}}{(x^2+p_1x+q_1)^{t_1}}+...$$ $$+\frac{B_{1k}x+C_{1k}}{x^2+p_kx+q_k}+...+\frac{B_{t_kk}+C_{t_kk}}{(x^2+p_kx+q_k)^{t_k}}.\qquad (1)$$

The coefficients $A_{ij}, , B_{ij},$ and $C_{ij}$ in this decomposition are determined by equating the coefficients of the same powers of $x$ in the polynomial $P_m(x)$ and the polynomial obtained in the numerator of the right-hand side of equation (1) after bringing it to a common denominator (the method of undetermined coefficients).

Formula (1) shows that integrating an arbitrary rational function reduces to integrating simple fractions of the following four types:

1) $\frac{A}{x-\alpha}.$ $$\int\frac{A}{x-\alpha}\,dx=A\ln|x-\alpha|+C.$$

2) $\frac{A}{(x-\alpha)^k},\,\, (k=2, 3, ...).$

$$\int\frac{A}{(x-\alpha)^k}=-\frac{A}{k-1}\frac{1}{(x-\alpha)^{k-1}}+C.$$

3) $\frac{Ax+B}{x^2+px+q},\,\,p^2-4q<0$

4) $\frac{Ax+B}{(x^2+px+q)^k},\,\,p^2-4q<0,\,\, k=2, 3, ...$

$\int\frac{2x-1}{x^2+4x+8},dx.$

Solution:

In this example, the discriminant of the quadratic trinomial in the denominator is negative: $p^2-4q=16-32=-16<0,$ which means we have a fraction of the third type. Since $(x^2+4x+8)'=2x+4,$ we can rewrite the numerator of the fraction as follows: $$2x-1=2x+4-5=(x^2+4x+8)'-5$$ (this transformation is called extracting the derivative of the quadratic trinomial in the denominator in the numerator). Therefore, $$\int\frac{2x-1}{x^2+4x+8}\,dx=\int\frac{(x^2+4x+8)'}{x^2+4x+8}\,dx-5\int\frac{dx}{x^2+4x+8}.$$

$$\int\frac{(x^2+4x+8)'}{x^2+4x+8}\,dx=\left[\begin{array}{lcl}x^2+4x+8=t\\dt=(x^2+4x+8)'dx\end{array}\right]=\int\frac{dt}{t}=\ln|t|+C=$$ $$=\ln(x^2+4x+8)+C.$$

We find the integral $\int\frac{dx}{x^2+4x+8}$ by completing the square in the denominator:

$$\int\frac{dx}{x^2+4x+8}=\int\frac{dx}{x^2+4x+4+4}=\int\frac{dx}{(x+2)^2+4}=$$ $$=\left[\begin{array}{lcl}x+2=t\\dx=dt\end{array}\right]=\int\frac{dt}{t^2+2^2}=\frac{1}{2}arctg\frac{t}{2}+C=\frac{1}{2}arctg\frac{x+2}{2}+C.$$

Thus,

$$\int\frac{2x-1}{x^2+4x+8}\,dx=\ln(x^2+4x+8)-\frac{5}{2}arctg\frac{x+2}{2}+C.$$

Answer: $\ln(x^2+4x+8)-\frac{5}{2}arctg\frac{x+2}{2}+C.$

2. $\int\frac{3x-1}{(x^2+4x+5)^2}.$

Solution.

Here, $p^2-4q=16-20=-4<0,$ which means we have a simple fraction of the fourth type. First, we extract the derivative of the quadratic trinomial in the numerator:

$$(x^2+4x+5)'=2x+4\Rightarrow 3x-1=\frac{3}{2}(2x+4)-7=$$ $$=1,5(x^2+4x+5)'-7.$$

$$\int\frac{3x-1}{(x^2+4x+5)^2}\,dx=\int\frac{1,5(x^2+4x+5)'-7}{(x^2+4x+5)^2}\,dx=$$ $$=\frac{3}{2(x^2+4x+5)}-7\int\frac{dx}{(x^2+4x+5)^2}.$$

To compute the remaining integral, we complete the square in the quadratic trinomial: $$\int\frac{dx}{(x^2+4x+5)^2}=\int\frac{dx}{((x+2)^2+1)^2}=\left[\begin{array}{lcl}x+2=t\\dx=dt\end{array}\right]=$$ $$=\int\frac{dt}{(t^2+1)^2}=\int\frac{1+t^2-t^2}{(1+t^2)^2}dt=\int\frac{dt}{1+t^2}-\int\frac{t^2dt}{(1+t^2)^2}=$$ $$=arctg t-\int\frac{t^2\,dt}{(1+t^2)^2}.$$ Then we use integration by parts: $$\int\frac{t^2dt}{(t^2+1)^2}=\left[\begin{array}{lcl}u=t\\dv=\frac{tdt}{(t^2+1)^2}\Rightarrow v=-\frac{1}{2}\int\,d\frac{1}{t^2+1}=-\frac{1}{2(t^2+1)}\end{array}\right]=$$ $$=-\frac{t}{2(1+t^2)}+\frac{1}{2}\int\frac{1}{t^2+1}dt=-\frac{1}{2}\left(\frac{t}{1+t^2}-arctg t\right).$$

Thus, $$\int\frac{dx}{(x^2+4x+5)^2}=arctg (x+2)+\frac{1}{2}\left(\frac{x+2}{1+(x+2)^2}-arctg(x+2)\right).$$

And finally, we obtain

$$\int\frac{3x-1}{(x^2+4x+5)^2}\,dx=$$ $$=\frac{3}{2(x^2+4x+5)}+\frac{7}{2}\left(\frac{x+2}{x^2+4x+5}-3arctg(x+2)\right).$$

Answer: $\frac{3}{2(x^2+4x+5)}+\frac{7}{2}\left(\frac{x+2}{x^2+4x+5}-3arctg(x+2)\right).$

Examples.

Find the integrals:

6.158. $\int\frac{dx}{x^2+4x-5}.$

Solution.

In this example, $p^2-4q=16+20=36>0,$ which means we will decompose the rational function into simple fractions.

$D=36;$

$$x_1=\frac{-4+6}{2}=1,\qquad x_2=\frac{-4-6}{2}=-5.$$

Thus, $$x^2+4x-5=(x-1)(x+5).$$ From this, we have, $$\frac{1}{x^2+4x-5}=\frac{A}{x-1}+\frac{B}{x+5}=\frac{A(x+5)+B(x-1)}{(x-1)(x+5)}=$$ $$=\frac{x(A+B)+(5A-B)}{x^2+4x-5}.$$

By equating the coefficients of the same powers of $x$ in the numerators of the left and right sides of the equation, we write the system:

$$\left\{\begin{array}{lcl}A+B=0\\5A-B=1\end{array}\right.\Rightarrow\left\{\begin{array}{lcl}A=-B\\-5B-B=1\end{array}\right.\Rightarrow\left\{\begin{array}{lcl}A=\frac{1}{6}\\B=-\frac{1}{6}\end{array}\right.$$

Then the decomposition of the fraction $\frac{1}{x^2+4x-5}$ into a sum of simple fractions is as follows: $$\frac{1}{x^2+4x-5}=\frac{1}{6}\frac{1}{x-1}-\frac{1}{6}\frac{1}{x+5}.$$

Now, let's compute the given integral as the integral of the sum of simple fractions:

$$\int\frac{dx}{x^2+4x-5}=\int\left(\frac{1}{6}\frac{1}{x-1}-\frac{1}{6}\frac{1}{x+5}\right)dx=$$ $$=\frac{1}{6}\ln|x-1|-\frac{1}{6}\ln|x+5|+C=\frac{1}{6}\ln\left|\frac{x-1}{x+5}\right|+C.$$

Answer: $\frac{1}{6}\ln\left|\frac{x-1}{x+5}\right|+C.$

6.162.$\int\frac{dx}{x^2-6x}.$

Solution.

$p^2-4q=36>0,$ so we will decompose the rational function into simple fractions.

$$x^2-6x=x(x-6).$$ From this, we have, $$\frac{1}{x^2-6x}=\frac{A}{x}+\frac{B}{x-6}=\frac{A(x-6)+Bx}{x(x-6)}=$$ $$=\frac{x(A+B)-6A}{x^2-6x}.$$

By equating the coefficients of the same powers of $x$ in the numerators of the left and right sides of the equation, we write the system:

$$\left\{\begin{array}{lcl}A+B=0\\-6A=1\end{array}\right.\Rightarrow\left\{\begin{array}{lcl}A=-\frac{1}{6}\\B=\frac{1}{6}\end{array}\right.$$

Thus, the decomposition of the fraction $\frac{1}{x^2-6}$ into a sum of simple fractions is as follows: $$\frac{1}{x^2-6x}=-\frac{1}{6}\frac{1}{x}+\frac{1}{6}\frac{1}{x-6}.$$

Now, let's compute the given integral as the integral of the sum of simple fractions:

$$\int\frac{dx}{x^2-6x}=\int\left(-\frac{1}{6}\frac{1}{x}+\frac{1}{6}\frac{1}{x-6}\right)dx=$$ $$=-\frac{1}{6}\ln|x|+\frac{1}{6}\ln|x-6|+C=\frac{1}{6}\ln\left|\frac{x-6}{x}\right|+C.$$

Answer: $\frac{1}{6}\ln\left|\frac{x-6}{x}\right|+C.$

6.164.$\int\frac{xdx}{x^4+6x^2+13}.$

Solution.

Let's make the variable substitution:

$$\int\frac{xdx}{x^4+6x^2+13}=\left[\begin{array}{lcl}x^2=t\\dt=2xdx\end{array}\right]=\frac{1}{2}\int\frac{dt}{t^2+6t+13}.$$ Here, $p^2-4q=36-52=16<0,$ which means we have a fraction of the third type.

Let's complete the square in the denominator:

$$t^2+6t+13=t^2+6t+9+4=(t+3)^2+4.$$

$$\int\frac{dt}{t^2+6t+13}=\int\frac{dt}{(t+3)^2+4}=\left[\begin{array}{lcl}t+3=z\\dt=dz\end{array}\right]=\int\frac{dz}{z^2+2^2}=$$ $$=\frac{1}{2}arctg\frac{z}{2}+C=\frac{1}{2}arctg\frac{t+3}{2}+C.$$

Thus,

$$\int\frac{xdx}{x^4+6x^2+13}\,dx=\frac{1}{4}arctg\frac{x^2+3}{2}+C.$$

Answer: $\frac{1}{4}arctg\frac{x^2+3}{2}+C.$

6.168. $\int\frac{x^3+2}{x^3-4x}dx.$

Solution.

The integrand has the form $\frac{P_n(x)}{Q_n(x)},$ where $P_n(x)$ and $Q_n(x)$ are polynomials of degree $n=3,$ which means the given fraction is improper. Let's extract the integer part from this fraction. After division in a column of $x^3+2$ by $x^3-4,$ we obtain $$\frac{x^3+2}{x^3-4x}=1+\frac{4x+2}{x^3-4x}.$$ Next, we decompose the obtained fraction into a sum of simple fractions:

$$\frac{4x+2}{x^3-4x}=\frac{4x+2}{x(x^2-4)}=\frac{4x+2}{x(x-2)(x+2)}=\frac{A}{x}+\frac{B}{x-2}+\frac{C}{x+2}=$$ $$=\frac{A(x^2-4)+B(x^2+2x)+C(x^2-2x)}{x^3-4x}=$$ $$=\frac{x^2(A+B+C)+x(2B-2C)-4A}{x^3-4x}.$$

By equating coefficients of the same degrees of $x$ in the numerators of the left and right sides of the equation, we write the system:

$$\left\{\begin{array}{lcl}A+B+C=0\\2B-2C=4\\-4A=2\end{array}\right.\Rightarrow\left\{\begin{array}{lcl}B+C=\frac{1}{2}\\B-C=2\\A=-\frac{1}{2}\end{array}\right.\Rightarrow\left\{\begin{array}{lcl}B=\frac{1}{2}-C\\\frac{1}{2}-C-C=2\\A=-\frac{1}{2}\end{array}\right.\Rightarrow$$ $$\Rightarrow\left\{\begin{array}{lcl}B=\frac{5}{4}\\C=-\frac{3}{4}\\A=-\frac{1}{2}\end{array}\right.$$

Thus, the decomposition of the fraction $\frac{4x+2}{x^3-4x}$ into a sum of simple fractions is given by $$\frac{4x+2}{x^3-4x}=-\frac{1}{2}\frac{1}{x}+\frac{5}{4}\frac{1}{x-2}-\frac{3}{4}\frac{1}{x+2}.$$

Next, let's compute the given integral as the integral of the sum of simple fractions:

$$\int\frac{x^3+2}{x^3-4x}dx=\int\left(1+\frac{4x+2}{x^3-4x}\right)dx=$$ $$=\int\left(-\frac{1}{2}\frac{1}{x}+\frac{5}{4}\frac{1}{x-2}-\frac{3}{4}\frac{1}{x+2}\right)dx=$$ $$=x-\frac{1}{2}\ln|x|+\frac{5}{4}\ln|x-2|-\frac{3}{4}\ln|x+2|+C.$$

Answer: $x-\frac{1}{2}\ln|x|+\frac{5}{4}\ln|x-2|-\frac{3}{4}\ln|x+2|+C.$

6.174. $\int\frac{(x-1)dx}{(x^2+1)^3}.$

Solution.

Here, $p^2-4q=-4<0$, which means we have a simple fraction of the fourth type. First, we extract the derivative of the quadratic trinomial from the numerator:

$$(x^2+1)'=2x\Rightarrow x-1=\frac{1}{2}(2x)-1=\frac{1}{2}(x^2+1)'-1.$$

$$\int\frac{x-1}{(x^2+1)^3}\,dx=\int\frac{0,5(x^2+1)'-1}{(x^2+1)^3}\,dx=$$ $$=0,5\int (x^2+1)^{-3}d(x^2+1)-\int\frac{dx}{(x^2+1)^3}=$$ $$=-\frac{1}{4(x^2+1)^2}-\int\frac{dx}{(x^2+1)^3}.$$

Let's compute the remaining integral:

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

Next, we will use the method of integration by parts:

$$\int\frac{x^2dx}{(x^2+1)^2}=\left[\begin{array}{lcl}u=x\\dv=\frac{xdx}{(x^2+1)^2}\Rightarrow v=-\frac{1}{2}\int\,d\frac{1}{x^2+1}=\frac{-1}{2(x^2+1)}\end{array}\right]=$$ $$=-\frac{x}{2(1+x^2)}+\frac{1}{2}\int\frac{1}{x^2+1}dt=\frac{1}{2}\left(arctg x-\frac{x}{1+x^2}\right).$$

$$\int\frac{x^2dx}{(x^2+1)^3}=$$ $$\left[\begin{array}{lcl}u=x\\dv=\frac{xdx}{(x^2+1)^3}\Rightarrow v=-\frac{1}{4}\int\,d\frac{1}{(x^2+1)^2}=-\frac{1}{4(x^2+1)^2}\end{array}\right]=$$ $$-\frac{x}{4(1+x^2)^2}+\frac{1}{4}\int\frac{1}{(x^2+1)^2}dx.$$

$$\int\frac{1}{(x^2+1)^2}dx=arctg x-\int\frac{x^2}{(1+x^2)^2}dx=$$ $$=arctg x-\frac{1}{2}\left(arctg x-\frac{x}{1+x^2}\right)=\frac{1}{2}\left(\frac{x}{1+x^2}+arctg x\right).$$

Thus, $$\int\frac{x^2dx}{(x^2+1)^3}=-\frac{x}{4(1+x^2)^2}+\frac{1}{8}\left(\frac{x}{1+x^2}+arctg x\right).$$

And finally, we get

$$\int\frac{x-1}{(x^2+1)^3}\,dx=$$ $$-\frac{1}{4(x^2+1)^2}-\left(arctgx -\frac{1}{2}\left(arctg x-\frac{x}{1+x^2}\right)-\right.$$ $$-\left.\left(-\frac{x}{4(x^2+1)^2}+\frac{1}{8}\left(\frac{x}{1+x^2}+arctg x\right)\right)\right)=+C$$ $$=-\frac{x+1}{4(x^2+1)^2}-\frac{3}{8}arctg x-\frac{3}{8}\frac{x}{1+x^2}+C.$$

Answer: $-\frac{x+1}{4(x^2+1)^2}-\frac{3}{8}arctg x-\frac{3}{8}\frac{x}{1+x^2}+C.$

Homework.

Ffind the integrals.

6.159. $\int\frac{dx}{2x^2-4x+5}.$

6.160. $\int\frac{xdx}{x^2-5x+4}.$

6.163. $\int\frac{4x-3}{x^2-2x+5}dx.$

6.167. $\int\frac{2x^2-1}{x^3-5x^2+6x}dx.$

6.169. $\int\frac{x^4+3x^3+3x^2-5}{x^3+3x^2+3x+1}dx.$

6.170. $\int\frac{3x^2+2x-1}{(x-1)^2(x+2)}dx.$

6.179. $\int\frac{5x-13}{(x^2-5x+6)^2}dx.$