Evaluate the following integrals:
Question:

$\int \frac{x^{2}+1}{x^{2}-5 x+6} d x$

Solution:

Consider $I=\int \frac{x^{2}+1}{x^{2}-5 x+6} d x$

Expressing the integral $\int \frac{\mathrm{P}(\mathrm{x})}{\mathrm{ax}^{2}+\mathrm{bx}+\mathrm{c}} \mathrm{dx}=\int \mathrm{Q}(\mathrm{x}) \mathrm{dx}+\int \frac{\mathrm{R}(\mathrm{x})}{\mathrm{ax}^{2}+\mathrm{bx}+\mathrm{c}} \mathrm{dx}$

$\Rightarrow \int \frac{x^{2}+1}{x^{2}-5 x+6} d x=\int\left(\frac{5 x-5}{x^{2}-5 x+6}+1\right) d x$

$=5 \int \frac{x-1}{x^{2}-5 x+6} d x+\int 1 d x$

Consider $\int \frac{x-1}{x^{2}-5 x+6} d x$

Let $x-1=\frac{1}{2}(2 x-5)+\frac{3}{2}$ and split,

$\Rightarrow \int\left(\frac{2 x-5}{2\left(x^{2}-5 x+6\right)}+\frac{3}{2\left(x^{2}-5 x+6\right)}\right) d x$

$\Rightarrow \frac{1}{2} \int \frac{2 x-5}{\left(x^{2}-5 x+6\right)} d x+\frac{3}{2} \int \frac{1}{x^{2}-5 x+6} d x$

Consider $\int \frac{2 x-5}{\left(x^{2}-5 x+6\right)} d x$

Let $u=x^{2}-5 x+6 \rightarrow d x=\frac{1}{2 x-5} d u$

$\Rightarrow \int \frac{2 x-5}{\left(x^{2}-5 x+6\right)} d x=\int \frac{2 x-5}{u} \frac{1}{2 x-5} d u$

$=\int \frac{1}{u} d u$

We know that $\int \frac{1}{x} d x=\log |x|+c$

$\Rightarrow \int \frac{1}{\mathrm{u}} \mathrm{du}=\log |\mathrm{u}|=\log \left|\mathrm{x}^{2}-5 \mathrm{x}+6\right|$

Now consider $\int \frac{1}{x^{2}-5 x+6} d x$

$\Rightarrow \int \frac{1}{x^{2}-5 x+6} d x=\int \frac{1}{(x-3)(x-2)} d x$

By partial fraction decomposition,

$\Rightarrow \frac{1}{(x-3)(x-2)}=\frac{A}{x-3}+\frac{B}{x-2}$

$\Rightarrow 1=A(x-2)+B(x-3)$

$\Rightarrow 1=A x-2 A+B x-3 B$

$\Rightarrow 1=(A+B) x-(2 A+3 B)$

$\Rightarrow A+B=0$ and $2 A+3 B=-1$

Solving the two equations,

$\Rightarrow 2 A+2 B=0$

$2 A+3 B=-1$

$-B=1$

$\therefore B=-1$ and $A=1$

$\Rightarrow \int \frac{1}{(x-3)(x-2)} d x=\int\left(\frac{1}{x-3}-\frac{1}{x-2}\right) d x$

$=\int \frac{1}{x-3} d x-\int \frac{1}{x-2} d x$

Consider $\int \frac{1}{x-3} d x$

Let $u=x-3 \rightarrow d x=d u$

$\Rightarrow \int \frac{1}{\mathrm{x}-3} \mathrm{dx}=\int \frac{1}{\mathrm{u}} \mathrm{du}$

We know that $\int \frac{1}{x} d x=\log |x|+c$

$\Rightarrow \int \frac{1}{u} d u=\log |u|=\log |x-3|$

Similarly $\int \frac{1}{x-2} d x$

Let $u=x-2 \rightarrow d x=d u$

$\Rightarrow \int \frac{1}{x-2} d x=\int \frac{1}{u} d u$

We know that $\int \frac{1}{x} d x=\log |x|+c$

$\Rightarrow \int \frac{1}{\mathrm{u}} \mathrm{du}=\log |\mathrm{u}|=\log |\mathrm{x}-2|$

Then,

$\Rightarrow \int \frac{1}{x^{2}-5 x+6} d x=\int \frac{1}{(x-3)(x-2)} d x=\int \frac{1}{x-3} d x-\int \frac{1}{x-2} d x$

$=\frac{1}{2}\left(\log \left|x^{2}-5 x+6\right|\right)+\frac{3}{2}(\log |x-3|-\log |x-2|)$

$=\frac{\log \left|x^{2}-5 x+6\right|}{2}+\frac{3 \log |x-3|}{2}-\frac{3 \log |x-2|}{2}$

Then,

$\Rightarrow \int \frac{x^{2}+1}{x^{2}-5 x+6} d x=5 \int \frac{x-1}{x^{2}-5 x+6} d x+\int 1 d x$

We know that $\int 1 \mathrm{dx}=\mathrm{x}+\mathrm{c}$

\begin{aligned} \Rightarrow 5 \int \frac{x-1}{x^{2}-5 x+6} d x+\int 1 d x & \\=& \frac{5 \log \left|x^{2}-5 x+6\right|}{2}+\frac{15 \log |x-3|}{2}-\frac{15 \log |x-2|}{2}+x+c \end{aligned}

$=\frac{5 \log |x-2| \log |x-3|}{2}+\frac{15 \log |x-3|}{2}-\frac{15 \log |x-2|}{2}+x+c$

$=x-5 \log |x-2|+10 \log |x-3|+c$

$\therefore \mathrm{I}=\int \frac{\mathrm{x}^{2}+1}{\mathrm{x}^{2}-5 \mathrm{x}+6} \mathrm{dx}=\mathrm{x}-5 \log |\mathrm{x}-2|+10 \log |\mathrm{x}-3|+\mathrm{c}$