Evaluate the following integrals:
Question:

Evaluate the following integrals:

$\int \frac{x^{2}}{x^{2}+6 x+12} d x$

Solution:

Given $I=\int \frac{x^{2}}{x^{2}+6 x+12} 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{\mathrm{x}^{2}}{\mathrm{x}^{2}+6 \mathrm{x}+12} \mathrm{dx}=\int\left(\frac{-6 \mathrm{x}-12}{\mathrm{x}^{2}+6 \mathrm{x}+12}+1\right) \mathrm{dx}$

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

Consider $\int \frac{x+2}{x^{2}+6 x+12} d x$

Let $x+2=1 / 2(2 x+6)-1$ and split,

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

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

Consider $\int \frac{x+3}{x^{2}+6 x+12} d x$

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

$\Rightarrow \int \frac{\mathrm{x}+3}{\left(\mathrm{x}^{2}+6 \mathrm{x}+12\right)} \mathrm{dx}=\int \frac{\mathrm{x}+3}{\mathrm{u}} \frac{1}{2 \mathrm{x}+6} \mathrm{du}$

$=\int \frac{1}{2 \mathrm{u}} \mathrm{du}$

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

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

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

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

Let $u=\frac{x+3}{\sqrt{3}} \rightarrow d x=\sqrt{3} d u$

$\Rightarrow \int \frac{1}{(x+3)^{2}+3} d x=\frac{\sqrt{3}}{3 u^{2}+3}$

$=\frac{1}{\sqrt{3}} \int \frac{1}{u^{2}+1} d u$

We know that $\int \frac{1}{x^{2}+1} d x=\tan ^{-1} x+c$

$\Rightarrow \frac{1}{\sqrt{3}} \int \frac{1}{\mathrm{u}^{2}+1} \mathrm{du}=\frac{\tan ^{-1} \mathrm{u}}{\sqrt{3}}=\frac{\tan ^{-1}\left(\frac{\mathrm{x}+3}{\sqrt{3}}\right)}{\sqrt{3}}$

Then,

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

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

Then,

$\Rightarrow \int \frac{\mathrm{x}^{2}}{\mathrm{x}^{2}+6 \mathrm{x}+12} \mathrm{dx}=-6 \int \frac{\mathrm{x}+2}{\mathrm{x}^{2}+6 \mathrm{x}+12} \mathrm{dx}+\int 1 \mathrm{dx}$

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

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

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

$=-3 \log \left|x^{2}+6 x+12\right|+2 \cdot \sqrt{3} \tan ^{-1}\left(\frac{x+3}{\sqrt{3}}\right)+x+c$

$\therefore \mathrm{I}=\int \frac{\mathrm{x}^{2}}{\mathrm{x}^{2}+6 \mathrm{x}+12} \mathrm{dx}=-3 \log \left|\mathrm{x}^{2}+6 \mathrm{x}+12\right|+2 \cdot \sqrt{3} \tan ^{-1}\left(\frac{\mathrm{x}+3}{\sqrt{3}}\right)+\mathrm{x}+\mathrm{c}$