TITLE: Evaluating the integral $\int \frac{x^2+x}{(e^x+x+1)^2}dx$
QUESTION [5 upvotes]: Evaluate $$\int \frac{x^2+x}{(e^x+x+1)^2}dx$$ 

I tried converting in the form of Quotient rule(seeing the square in the denominator), neither am I able to make the denominators' derivative in the numerator. Some hints would be great. Thanks.

REPLY [3 votes]: Let $\displaystyle u=\frac{x^2+x}{xe^x}=(x+1)e^{-x}$ and $\displaystyle dv=\frac{xe^x}{(e^x+x+1)^2}dx,\;$ so $\displaystyle du=-xe^{-x}dx$ and $\displaystyle v=\frac{e^x}{e^x+x+1}$.
Then $\displaystyle\int\frac{x^2+x}{(e^x+x+1)^2}dx=(x+1)e^{-x}\cdot\frac{e^x}{e^x+x+1}-\int-\frac{x}{e^x+x+1}dx=\frac{x+1}{e^x+x+1}+\int\frac{x}{e^x+x+1}dx$
$\displaystyle\hspace{.2 in}=\frac{x+1}{e^x+x+1}+\int\frac{e^x+x+1}{e^x+x+1}dx-\int\frac{e^x+1}{e^x+x+1}dx=\frac{x+1}{e^x+x+1}+x-\ln\big|e^x+x+1\big|+C$