<s>[INST] 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
 [/INST] 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
</s>