#### Provide Solution For R.D.Sharma Maths Class 12 Chapter 18  Indefinite Integrals Exercise 18.20 Question 7 Maths Textbook Solution.

Answer: $x-2 \log \left|x^{2}+x+2\right|+3 \tan ^{-1}(x+1)+c$

Given: $\int \frac{(x-1)^{2}}{x^{2}+2 x+2} d x$

Hint: $\text { Using } \int \frac{1}{x} d x \text { and } \int \frac{1}{1+x^{2}} d x$

Explanation: Let

$I=\int \frac{(x-1)^{2}}{x^{2}+2 x+2} d x=\int \frac{x^{2}-2 x+1}{x^{2}+2 x+2} d x$

$=1-\frac{(4 x+1)}{x^{2}+2 x+2}$

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

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

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

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

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

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

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