Solution (source code)

= Solution

The repeated factor requires both a simple-pole and a double-pole term in the <partial fraction decomposition>. Write
$$
\frac1{(x-1)^2(x+1)}=\frac A{x+1}+\frac B{x-1}+\frac C{(x-1)^2}.
$$
Multiplying through gives $1=A(x-1)^2+B(x^2-1)+C(x+1)$. Substituting $x=-1$ and $x=1$ gives $A=1/4$ and $C=1/2$; the quadratic coefficient then gives $B=-1/4$. Therefore
$$
\boxed{\frac1{x^3-x^2-x+1}
=\frac1{4(x+1)}-\frac1{4(x-1)}+\frac1{2(x-1)^2},\qquad x\ne\pm1.}
$$