<s>[INST] How to integrate $\int \frac{2x^2+x}{(x+1)(x^2+1)}dx$? How to integrate $\displaystyle \int \frac{2x^2+x}{(x+1)(x^2+1)}dx$? I Tried using partial fractions but i got lost, thanks.
 [/INST] From $\frac{2x^2+ x}{(x+ 1)(x^2+ 1)}= \frac{A}{x+ 1}+ \frac{Bx+ C}{x^2+ 1}$ you can add the fractions on the right, then compare coefficients of "like terms".  But we can also use the fact that this is to be true for all x.  Setting x to any three values gives three equations to solve for A, B, and C.
First multiplying both sides by $x+1$ and $x^2+ 1$ simplifies to $2x^2+ x= A(x^2+ 1)+ (Bx+ C)(x+ 1).
Setting x= -1 immediately gives $2(1)+ (-1)= 1= A(2)$ so $A= \frac{1}{2}$.
Setting x= 0 gives $0= A+ C= \frac{1}{2}+ C$ so $C= -\frac{1}{2}$.
Setting x= 1 gives $2+ 1= 3= 2A+ 2(B+ C)= 1+ 2B- 1$ so $B= \frac{3}{2}$.
</s>