Example 6. Find the integral $\int \frac{x^{4}+2 x^{2}+4}{\left(1+x^{2}\right)^{3}} d x$.
Solution. The denominator of the fraction $Q(x)=\left(1+x^{2}\right)^{3}$ has two imaginary roots $x= \pm i$ of multiplicity 3. The function is decomposed into the following simple fractions:

$$
\frac{x^{4}+2 x^{2}+4}{\left(1+x^{2}\right)^{3}}=\frac{M_{1} x+N_{1}}{1+x^{2}}+\frac{M_{2} x+N_{2}}{\left(1+x^{2}\right)^{2}}+\frac{M_{3} x+N_{3}}{\left(1+x^{2}\right)^{3}}
$$

Bringing the right-hand side to a common denominator and comparing the numerators, we get

$$
\begin{aligned}
x^{4}+2 x^{2}+4 & =M_{3} x+N_{3}+\left(M_{2} x+N_{2}\right)\left(1+x^{2}\right)+ \\
& +\left(M_{1} x+N_{1}\right)\left(1+x^{2}\right)^{2}
\end{aligned}
$$

To determine the constants $M_{k}, N_{k}(k=1,2,3)$, we apply the mixed method.

Let $x=\sqrt{-1}=i$; therefore, $x^{2}=-1$. Substituting this value into the identity (A), we get

$$
(-1)^{2}+2(-1)+4=M_{3} i+N_{3} \text { or } M_{3} i+N_{3}=3
$$

from which

$$
M_{3}=0, N_{3}=3
$$

Substituting the values of $M_{3}$ and $N_{3}$ into (A):

$$
x^{4}+2 x^{2}+4=3+\left(M_{2} x+N_{2}\right)\left(1+x^{2}\right)+\left(M_{1} x+N_{1}\right)\left(1+x^{2}\right)^{2}
$$

Moving 3 to the left side:

$$
\left(x^{2}+1\right)^{2}=\left(M_{2} x+N_{2}\right)\left(1+x^{2}\right)+\left(M_{1} x+N_{1}\right)\left(1+x^{2}\right)^{2}
$$

and dividing by $1+x^{2}$:

$$
x^{2}+1=M_{2} x+N_{2}+\left(M_{1} x+N_{1}\right)\left(1+x^{2}\right)
$$

Again setting $x=i$, we get $0=M_{2} i+N_{2}$, from which $M_{2}=0, N_{2}=0$.

Substituting these values into the identity (B):

$$
1+x^{2}=\left(M_{1} x+N_{1}\right)\left(1+x^{2}\right)
$$

Therefore,

$$
1=M_{1} x+N_{1}
$$

from which $M_{1}=0, N_{1}=1$.

Thus, the decomposition has the form

$$
\frac{x^{4}+2 x^{2}+4}{\left(1+x^{2}\right)^{3}}=\frac{1}{1+x^{2}}+\frac{3}{\left(1+x^{2}\right)^{3}}
$$

Integrating:

$$
\int \frac{x^{4}+2 x^{2}+4}{\left(1+x^{2}\right)^{3}} d x=\int \frac{1}{1+x^{2}} d x+3 \int \frac{d x}{\left(1+x^{2}\right)^{3}}=\operatorname{arctg} x+3 \int \frac{d x}{\left(1+x^{2}\right)^{3}}
$$

The integral on the right side of the equality (C) is obtained by the formula (K) of example 5 for $a=1$ and $z=x$:

$$
\int \frac{d x}{\left(1+x^{2}\right)^{3}}=\frac{1}{4} \cdot \frac{x}{\left(x^{2}+1\right)^{2}}+\frac{3}{8} \cdot \frac{x}{x^{2}+1}+\frac{3}{8} \operatorname{arctg} x+C
$$

From the equalities (C) and (D) we have

$$
\int \frac{x^{4}+2 x^{2}+4}{\left(1+x^{2}\right)^{3}} d x=\frac{11}{8} \operatorname{arctg} x+\frac{3}{4} \frac{x}{\left(1+x^{2}\right)^{2}}+\frac{9}{8} \frac{x}{1+x^{2}}+C
$$

## Problems

Find the integrals of rational functions:

1. $\int \frac{x^{2}+2}{x^{3}+x^{2}-2 x} d x$.
2. $\int \frac{2 x d x}{x^{2}+3 x-4}$.
3. $\int \frac{d x}{x^{2}\left(1+x^{2}\right)^{2}}$.
4. $\int \frac{x^{2} d x}{(x+2)^{2}(x+1)}$.
5. $\int \frac{x^{2}-x+2}{x^{4}-5 x^{2}+4} d x$.
6. $\int \frac{4 x^{2}+4 x-11}{(2 x-1)(2 x+3)(2 x-5)} d x$.
7. $\int \frac{x^{3}+4 x^{2}+6}{(x+1)^{2}\left(x^{2}+2\right)} d x$.
8. $\int \frac{3 x+1}{x\left(1+x^{2}\right)^{2}} d x$.

Answers

1. $\ln \left|\frac{(x-1)(x+2)}{x}\right|+C$.
2. $\ln \sqrt[5]{(x-1)^{2}(x+4)^{8}}+C$.
3. $-\frac{1}{x}-$

$$
-\frac{1}{2} \cdot \frac{x}{1+x^{2}}-\frac{3}{2} \operatorname{arctg} x+C
$$

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

$$
\begin{aligned}
& \text { 7. } \frac{1}{3} \ln |x+1|-\frac{3}{x+1}+\frac{1}{3} \ln \left(x^{2}+2\right)-\frac{\sqrt{2}}{3} \operatorname{arctg} \frac{x}{\sqrt{2}}+C \\
& -\frac{1}{2} \ln \left(1+x^{2}\right)+\frac{3 x+1}{2\left(1+x^{2}\right)}+\frac{3}{2} \operatorname{arctg} x+C
\end{aligned}
$$

## § 4.7. Integration of Trigonometric Functions

1. Integrals of the form

$$
\int \sin a x \cos b x d x, \int \sin a x \sin b x d x, \int \cos a x \cos b x d x
$$

are found using trigonometric formulas:

$$
\begin{aligned}
& \sin a \sin b=\frac{1}{2}[\cos (a-b)-\cos (a+b)] \\
& \cos a \cos b=\frac{1}{2}[\cos (a-b)+\cos (a+b)] \\
& \sin a \cos b=\frac{1}{2}[\sin (a-b)+\sin (a+b)]
\end{aligned}
$$

2. Integrals of the form

$$
I_{n, m}=\int \sin ^{n} x \cos ^{m} x d x
$$

where $\boldsymbol{n}$ and $m-$ are even numbers, are found using the formulas:

$$
\begin{gathered}
\sin ^{2} x=\frac{1}{2}(1-\cos 2 x) ; \cos ^{2} x=\frac{1}{2}(1+\cos 2 x) \\
\sin x \cos x=\frac{1}{2} \sin 2 x
\end{gathered}
$$

If at least one of the numbers $m$ or $n$ is odd, then the integral is found directly, separating one factor from the odd power and introducing a new variable. In particular, if $m=2 k+1$, then

$$
\begin{gathered}
I_{n, m}=\int \sin ^{n} x \cos ^{2 k+1} x d x=\int \sin ^{n} x \cos ^{2 k} x \cos x d x= \\
=\int \sin ^{n} x\left(1-\sin ^{2} x\right)^{k} d(\sin x)
\end{gathered}
$$

3. Integrals of the form

$$
\int R(\sin x, \cos x) d x
$$

where $R$ is a rational function of $\sin x$ and $\cos x$, are reduced to integrals of rational functions of a new variable using the substitution

$$
\operatorname{tg} \frac{x}{2}=t
$$

in which case

$$
\sin x=\frac{2 t}{1+t^{2}}, \cos x=\frac{1-t^{2}}{1+t^{2}}, d x=\frac{2 d t}{1+t^{2}}
$$

If

$$
R(-\sin x,-\cos x)=R(\sin x, \cos x)
$$

then it is advisable to use the substitution $\operatorname{tg} x=t$, in which case

$$
\sin x=\frac{t}{\sqrt{1+t^{2}}}, \cos x=\frac{1}{\sqrt{1+t^{2}}}, x=\operatorname{arctg} t, d x=\frac{d t}{1+t^{2}}
$$