Example. Find the indefinite integral

$$
\int \frac{x d x}{\cos ^{2} x}
$$
Solution.

1. Represent the integrand as a product of two functions $F(x) g(x)$, where $g(x)$ has an obvious antiderivative $G(x)$, and $F(x)$ is a differentiable function, with its derivative $f(x)=F'(x)$ being a simpler function than $F(x)$.

## In this case

$$
F(x)=x, \quad g(x)=\frac{1}{\cos ^{2} x}, \quad G(x)=\tan x, \quad f(x)=F'(x)=1
$$

2. Apply the integration by parts formula

$$
\int \frac{x d x}{\cos ^{2} x}=x \tan x-\int \tan x d x
$$

3. The last integral is not a standard integral, but it can be solved using the method of substitution under the differential sign:

$$
\begin{gathered}
\int \tan x d x=\int \frac{1}{\cos x} \sin x d x=-\int \frac{1}{\cos x} d \cos x= \\
=\left\{\begin{array}{lll}
-\ln \cos x+C_{1} & \text { if } & \cos x>0, \\
-\ln (-\cos x)+C_{2} & \text { if } & \cos x<0
\end{array}\right.
\end{gathered}
$$

Note that if we had chosen $g(x)=x$, then differentiating the function $F(x)=1 / \cos ^{2} x$ and applying the integration by parts formula would have resulted in a more complex integral than the original one.

Conditions of the Problem. Find the indefinite integrals.

1. $\int(x+1) e^{x} d x$.
2. $\int \arcsin x d x$.
3. $\int x^{2} \sin x d x$.
4. $\int\left(x^{2}+2 x+3\right) \cos x d x$.
5. $\int x \ln x d x$.
6. $\int \frac{x}{\sin ^{2} x} d x$.
7. $\int e^{2 x} \cos x d x$.
8. $\int x^{2} \operatorname{arctg} x d x$.
9. $\int \sin \ln x d x$.
10. $\int x^{2} e^{x} d x$.

Answers.

1. $x e^{x}+$ C. 2. $x \arcsin x+\sqrt{1-x^{2}}+C$.
2. $2 x \sin x-x^{2} \cos x+2 \cos x+C$.
3. $(x+1)^{2} \sin x+2(x+1) \cos x+C$.
4. $\frac{x^{2}}{4}(2 \ln x-1)+C$.
5. $-x \operatorname{ctg} x+\ln \sin x+C$.
6. $\frac{e^{2 x}}{5}(\sin x+2 \cos x)+C$.
7. $\frac{x^{2}}{3} \operatorname{arctg} x-\frac{1}{6} x^{2}+\frac{1}{6} \ln \left(x^{2}+1\right)+C$.
8. $\quad \frac{x}{2}(\sin \ln x-\cos \ln x)+C . \quad$ 10. $e^{x}\left(x^{2}-2 x+2\right)+C$.

## 7.3. Integration of Rational Functions with Simple Real Roots in the Denominator

Problem Statement. Find the indefinite integral

$$
\int \frac{a_{n} x^{n}+a_{n-1} x^{n-1}+\ldots+a_{1} x+a_{0}}{b_{m} x^{m}+b_{m-1} x^{m-1}+\ldots+b_{1} x+b_{0}} d x
$$

Plan of Solution.

1. Introduce the notations:

$$
\begin{aligned}
P_{n}(x) & =a_{n} x^{n}+a_{n-1} x^{n-1}+\ldots+a_{1} x+a_{0} \\
Q_{m}(x) & =b_{m} x^{m}+b_{m-1} x^{m-1}+\ldots+b_{1} x+b_{0}
\end{aligned}
$$

Compare the degrees of the numerator $P_{n}(x)$ and the denominator $Q_{m}(x)$.

If the integrand is an improper rational function, i.e., the degree of the numerator $n$ is greater than or equal to the degree of the denominator $m$, then first separate the integer part of the rational function by dividing the numerator by the denominator:

$$
\frac{P_{n}(x)}{Q_{m}(x)}=M_{n-m}(x)+\frac{\widetilde{P}_{k}(x)}{Q_{m}(x)} \quad(k<m)
$$

Here, the polynomial $\widetilde{P}_{k}(x)$ is the remainder of the division of $P_{n}(x)$ by $Q_{m}(x)$, and the degree of $\widetilde{P}_{k}(x)$ is less than the degree of $Q_{m}(x)$.

2. Decompose the proper rational fraction

$$
\frac{\widetilde{P}_{k}(x)}{Q_{m}(x)}
$$

into partial fractions. If its denominator has simple real roots $r_{1}, r_{2}, \ldots, r_{m}$, i.e., $Q_{m}(x)=(x-r_{1})(x-r_{2}) \ldots (x-r_{m})$, then the decomposition into partial fractions has the form

$$
\frac{\widetilde{P}_{k}(x)}{Q_{m}(x)} \equiv \frac{A_{1}}{x-r_{1}}+\frac{A_{2}}{x-r_{2}}+\ldots+\frac{A_{m}}{x-r_{m}}
$$

3. To find the undetermined coefficients $A_{1}, A_{2}, \ldots, A_{m}$, bring the fractions on the right-hand side to a common denominator, and then equate the coefficients of the same powers of $x$ in the numerators on the left and right. This will result in a system of $m$ equations with $m$ unknowns, which has a unique solution.
4. Integrate the integer part (if it exists) and the partial fractions using standard integrals, and write the answer

$$
\begin{aligned}
& \int \frac{P_{n}(x)}{Q_{m}(x)} d x= \\
& \quad=F(x)+A_{1} \ln \left|x-r_{1}\right|+A_{2} \ln \left|x-r_{2}\right|+\ldots+A_{m} \ln \left|x-r_{m}\right|+C
\end{aligned}
$$

where $F(x)=\int M_{n-m}(x) d x$ is a polynomial of degree $n-m+1$.