$$\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$$

  • $\begingroup$ Multiply by the denominator each side to solve $A$ and $B$, that is, multiply by $(x+1)^2$ $\endgroup$
    – Masacroso
    Feb 21, 2017 at 9:08
  • 1
    $\begingroup$ What's so difficult about $$\frac{-5x+1}{(x+1)^2}=\frac{-5x-5+4}{(x+1)^2}=-\frac{5}{x+1}+\frac{4}{(x+1)^2}$$ $\endgroup$
    – S.C.B.
    Feb 21, 2017 at 9:10
  • $\begingroup$ at first you must devide the numerator by the denominator $\endgroup$ Feb 21, 2017 at 9:11
  • $\begingroup$ From $-5x + 1 = Ax + A + B$, if you follow my answer, if you make $x=-1$ (the root of $(x+1)^2$) then you get the solution $B=6$, and after you can get the solution for $A=-5$ $\endgroup$
    – Masacroso
    Feb 21, 2017 at 10:43

4 Answers 4


\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*}



For $$\dfrac{x^2-3x+2}{(x+1)^2}$$ set $x+1=y\iff x=y-1$


I add this answer as a kind of reference to handle any kind of partial fraction decomposition when the roots of the polynomial in the denominator are known.

This is the general algebraic solution: suppose that you have two normalized polynomials $p,q\in\Bbb C[X]$ (normalized means that the coefficient of the maximum power of each one is $1$) with $\deg(q)>\deg(p)$, then we can write

$$p=\prod(X-z_k)^{m_k},\quad\sum_k m_k=\deg(p),\quad p(z_k)=0$$

that is, the polynomial is written as the product of it roots, each one with multiplicity $m_k$. Then we want to write

$$\frac{p}{q}=\sum_{j=1}^n\sum_{k=1}^{m_j}\frac{a_{jk}}{(X-z_k)^{m_j}},\quad a_{jk}\in\Bbb C\tag{1}$$

From (1) we make the ansatz


where $a\in\Bbb C$, $p_1\in\Bbb C[X]$ and $q_1:=\frac{q}{X-z_1}$. Multiplying (2) by $q$ we get


from where we get the solution

$$\bbox[2pt, border:2px yellow solid]{a=p(z_1)/\prod_{j=2}^n(z_1-z_j)^{m_j}}\tag{3}$$

Applying (3) recursively through the roots of $q$ you get the desired partial fraction expansion for $p/q$. And you knows that

$$\int\frac{1}{(X-z_j)^{m_j}}=\begin{cases}\ln|x-z_j|+c,& m_j=1\text{ and } z_j\in\Bbb R\\\ln(x-z_j)+c,&m_j=1\text{ and }z_j\in\Bbb C\setminus\Bbb R\\\frac{-1}{(m_j-1)(X-z_j)^{m_j-1}}+c, &m_j>1\end{cases}$$


With $$ \frac{-5x+1}{(x+1)^2} = \frac{A}{(x+1)} + \frac{B}{(x+1)^2},$$

$x=0$ tells you that


and $x=-2$,


Not a big deal to find $-5$ and $6$.

I chose the values of $x$ to get the simplest coefficients in the equations.

With some care, you can even use $x=-1$, giving

$$\frac A0+\frac B{0^2}=\frac6{0^2}$$ which correctly tells you that $B=6$ if you consider that $1/0$ is negligible compared to $1/0^2$.

  • $\begingroup$ Okay, we all know that the true thing is to multiply by $(x+1)^2$, but the shortcut works. $\endgroup$
    – user65203
    Feb 21, 2017 at 10:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .