Evaluate $$ \int\frac{x^2+2x}{(x+1)^2}dx $$
My solution
Let $u =x+1$, $ du=dx $. Then $ du(x^2+2x)=(x^2+2x)dx $ and $ x=u-1 $. We get $$ \int\frac{(u-1)^2+2(u-1)}{u^2}du = \int\frac{u^2-2u+1+2u-2}{u^2}du = \int\frac{u^2-1}{u^2}du $$ which simplifies to $$ \int(1-u^{-2})du =u-\frac{u^{-1}}{-1} +C =u+\frac{1}{u}+C =x+1+\frac{1}{x+1}+C $$
... But the answer is $$ x+\frac{1}{x+1}+C $$
What is wrong?
That's perfectly fine. We can absorb the $1$ into the constant (for example, define $D=C+1$). Recall that general antiderivatives may differ by any arbitrary constant. To see this, try checking your work by taking the derivative of your answer (as well as the "official" answer). In either case, you'll end up with: $$ \dfrac{x^2+2x}{(x+1)^2} $$