$$\int \frac{x^2-3x+2}{x^2+2x+1}dx$$
So after all I had
$$ \frac{-5x+1}{(x+1)^2} = \frac{A}{(x+1)} + \frac{B}{(x+1)^2}$$
and of course $$ \int xdx $$
but it is easy to solve, I do not know how to act with devided things, probably solve the system, or is there easier way to find A and B?
After all steps I finally got:
$$-5x + 1 = Ax + A + B$$
\begin{align*} \frac{x^2 - 3x + 2}{x^2 + 2x + 1} &= 1 + \frac{1-5x}{(x+1)^2} \\ &= 1 + \frac{A}{x+1} + \frac{B}{(x+1)^2} \end{align*} Then \begin{align*} \frac{1-5x}{(x+1)^2} &= \frac{A}{x+1} + \frac{B}{(x+1)^2} \\ &= \frac{A(x+1)+B}{(x+1)^2} \\ 1-5x &= Ax+(A+B) \end{align*} So $A = -5$ and $B=6$.
Therefore \begin{align*} \frac{x^2 - 3x + 2}{x^2 + 2x + 1} &= 1 - \frac{5}{x+1} + \frac{6}{(x+1)^2} \\ \int\frac{x^2 - 3x + 2}{x^2 + 2x + 1}\,dx &= \int \left( 1 - \frac{5}{x+1} + \frac{6}{(x+1)^2} \right) dx \\ &= x - 5 \ln \lvert x+1 \rvert - \frac{6}{x+1} + C \end{align*}