Partial fraction expansion question I have to integrate following expression (but integration is not the problem):
$$\frac{x^2+3x-2}{(x-1)(x^2+x+1)^2}$$
It is pretty obvious that:
$$\frac{x^2+3x-2}{(x-1)(x^2+x+1)^2}=\frac{A}{x-1} + \frac{Mx+N}{x^2+x+1} + \frac{Px+Q}{(x^2+x+1)^2}$$
The first and the easiest step is to find an $A$:
$$A=\frac{x^2+3x-2}{(x^2+x+1)^2}, x=1$$
$$A=\frac{2}{9}$$
And then there comes a problem - I don't know how to do the rest. I tried to multiply the whole thing by $(x^2+x+1)^2$ and differentiate, but it didn't seem to be useful at all, especially because $(x^2+x+1)^2$ doesn't have real roots.
As popping900 suggested. I can take just four different x values and solve system of for equations, but i would like to see a more elegant or shorter solution, if one exists
 A: Not saying this is the easiest nor the most elegant one, but here's how I usually solve this kind of problem:
$$
\begin{align}
\frac{x^{2}+3x+2}{\left(x-1\right)\left(x^{2}+x+1\right)^{2}}&=\frac{\left(x-1\right)\left(x+4\right)+2}{\left(x-1\right)\left(x^{2}+x+1\right)^{2}}\\
\\
&=\frac{x+4}{\left(x^{2}+x+1\right)^{2}}+\frac{2}{\left(x-1\right)\left(x^{2}+x+1\right)^{2}}\\
\\
&=\frac{x+4}{\left(x^{2}+x+1\right)^{2}}+\frac{\frac{2}{3}\left[\left(x^{2}+x+1\right)-\left(x-1\right)\left(x+2\right)\right]}{\left(x-1\right)\left(x^{2}+x+1\right)^{2}}\\
\\
&=\frac{\frac{1}{3}x+\frac{8}{3}}{\left(x^{2}+x+1\right)^{2}}+\frac{2}{3}\frac{1}{\left(x-1\right)\left(x^{2}+x+1\right)}\\
\\
&=\frac{\frac{1}{3}x+\frac{8}{3}}{\left(x^{2}+x+1\right)^{2}}+\frac{2}{3}\frac{\frac{1}{3}\left[\left(x^{2}+x+1\right)-\left(x-1\right)\left(x+2\right)\right]}{\left(x-1\right)\left(x^{2}+x+1\right)}\\
\\
&=\frac{\frac{1}{3}x+\frac{8}{3}}{\left(x^{2}+x+1\right)^{2}}+\frac{\frac{2}{9}}{x-1}+\frac{-\frac{2}{9}x-\frac{4}{9}}{x^{2}+x+1}
\end{align}
$$
A: Another easy coefficient is $M$. Multiply both sides by $x$ and take the limit as $x\to +\infty$:
$$0=A+M\implies M=-A=-2/9$$
For $x=0$ we find
$$2=-A+N+Q\implies N+Q=A+2=20/9.$$
For $x=i$ we find
$$-3=\frac{A}{i-1} + \frac{Mi+N}{i} + \frac{Pi+Q}{-1}\implies Q=8/3, N+P=-1/9$$
Therefore $N=20/9-Q=-4/9$ and $P=-N-1/9=1/3$.
A: I have been thinking about it for around 15 minutes and couldn't see any elegant or very short solutions. So decided to use pretty common and obvious method, that i already used before. I multiplied both sides of equation by $(x-1)(x^2+x+1)^2$ and here is what i got:
$$x^2+3x-2=\frac{2}{9}(x^2+x+1)^2+(Mx+N)(x-1)(x^2+x+1)+(Px+Q)(x-1)$$
Then i got system of four equations(according to coefficients of the first polynomial) and solved them. Got:
$M=-\frac{2}{9}, N=-\frac{4}{9}, P=\frac{1}{3}, Q=\frac{8}{3}$
But I didn't really wanted to use it, because i was told by multiple people, that it is not elegant and very straightforward
