I have the following that i need to integrate: $$ \int \ln(1 + \sqrt{x}) \, \mathrm{d}x $$
I use substitution first: $u = 1 + \sqrt{x}$, which gives: $2\sqrt{x}\,\mathrm{d}u = \mathrm{d}x$
Thereafter, I do integration by parts on $\ln x$, which gives: $x\cdot\ln x - x$
Then I go back to substitution again, and insert the answer from 1: $2\sqrt{x}\,\mathrm{d}u = \mathrm{d}x$: $$ \int \ln(1 + \sqrt{x})\,\mathrm{d}x = \ln(u) \cdot 2\sqrt{x}\,\mathrm{d}u = x\cdot\ln u - x\cdot 2\sqrt{x} $$
I insert back $u$ into the result in 3: $u = 1 + \sqrt{x}$
Result: $x\cdot\ln(1 + \sqrt{x}) - x\cdot2\sqrt{x}$
But this is wrong, why?
$u$ and $x$ are not independent variables, so this step is wrong:
$$\int \ln(u) \cdot 2\sqrt{x} \mathrm{d}u = x\cdot\ln u - x\cdot 2\sqrt{x}$$
It is in general advisable to replace every occurrence of $x$ with the new variable (in this case $u$) when integration by substitution is used.