Here is my attempt:
$$ \frac{2x}{x^2 +2x+1}= \frac{2x}{(x+1)^2 } = \frac{2}{x+1}-\frac{2}{(x+1)^2 }$$
Then I tried to integrate it,I got $2\ln(x+1)+\frac{2}{x+1}+C$ as my answer. Am I right? please correct me if I'm wrong.
Here is my attempt:
$$ \frac{2x}{x^2 +2x+1}= \frac{2x}{(x+1)^2 } = \frac{2}{x+1}-\frac{2}{(x+1)^2 }$$
Then I tried to integrate it,I got $2\ln(x+1)+\frac{2}{x+1}+C$ as my answer. Am I right? please correct me if I'm wrong.
On
Your answer is almost correct, but you should put modulus sign in your log's argument as it must be positive i.e your answer should be; $$2\ln|x+1|+\frac{2}{x+1}+C$$
You can try one more method too.
$$\int \frac{2x}{x^2+2x+1}dx$$ Try to create derivative of denominator in numerator $$\int \frac{2x+2-2}{x^2+2x+1}dx$$ $$\int \frac{2x+2}{x^2+2x+1}dx-2\int \frac{1}{x^2+2x+1}dx$$
$$\int \frac{2x+2}{x^2+2x+1}dx-2\int \frac{1}{(x+1)^2}dx$$ For first integral simply take $x^2+2x+1=t$, then $(2x+2)dx=dt$, hence you will get: $$\ln(x^2+2x+1)+\frac{2}{x+1}+C$$ $$\ln(x+1)^2+\frac{2}{x+1}+C$$ $$2\ln|x+1|+\frac{2}{x+1}+C$$
On
Add and remove $2$ in the numerator, and you will obtain:
$$\frac{2x+2-2}{x^2+2x+1} = \frac{2x+2}{x^2+2x+1} - \frac{2}{x^2+2x+1}$$
Now you see that the numerator in the first fraction is nothing but the derivative of the denominator, id est you have a function of the form $\frac{f'(x)}{f(x)}$. This hen integrated is simply
$$\ln(x^2+2x+1)$$
Now the other term
$$2\int\frac{1}{x^2 + 2x + 1}\ \text{d}x = 2\int\frac{1}{(x+1)^2}\ \text{d}x = -\frac{2}{(x+1)}$$
Obtained by simply using $y = (x+1)$.
Final result:
$$\ln(x^2+2x+1) -\frac{2}{(x+1)}$$
The logarithm can be written also as
$$\ln((x+1)^2) = 2\ln(x+1)$$
On
$$\int\frac{2x}{x^2+2x+1}\text{d}x$$
let $u=x^2+2x+1$ and $\frac{du}{dx}=2x+2$ and now $dx=\frac{du}{2(x+1)}$
$$\int\frac{2x}{u}\cdot \frac{du}{2(x+1)}$$
Now since $x^2+2x+1=(x+1)^2$, therefore $u^\frac{1}{2}=x+1$ then $u^\frac{1}{2}-1=x$
$$\int\frac{u^\frac{1}{2}-1}{u^\frac{3}{2}}du$$
$$\int\frac{u^\frac{1}{2}}{u^\frac{3}{2}}du-\int\frac{1}{u^\frac{3}{2}}du$$
$$\int\frac{1}{u}du--2u^{-\frac{1}{2}}$$
$$2\cdot ln|x+1|+\frac{2}{x+1}+C$$
On
$$=\int\frac{2x+2}{x^2+2x+1}dx-2\int\frac{dx}{x^2+2x+1}$$
set $t=x^2+2x+1$ and $dt=(2x+2)dx$
$$=\int\frac{1}{t}-2\int\frac{dx}{(x+1)^2}dx$$
Set $\nu=x+1$ and $d\nu=dx$
$$=\int\frac{1}{t}-2\int\frac{1}{\nu ^2}d\nu=\ln|t|+\frac{2}{\nu}+\mathcal C=\color{red}{\ln|x^2+2x+1|+\frac{2}{x+1}+\mathcal C}$$
Hint The factorization $(x + 1)^2$ of the denominator of the integrand suggests that we can rewrite the integral using the substitution $u := x + 1$, $du = dx$: $$\int \frac{2 (u - 1)}{u^2} du = 2 \left(\int \frac{du}{u} - \int \frac{du}{u^2} \right) .$$