A mistake on computing $\int \frac{dx}{\sqrt{x+1}+1}$ I have to find $\int \frac{dx}{\sqrt{x+1}+1}$. This was my attempt, which is wrong and I cannot find where exactly is the mistake.
First I write $\frac{1}{\sqrt{x+1}+1}=\frac{\sqrt{x+1}-1}{x}=\frac{\sqrt{x+1}}{x}-\frac{1}{x}$, therefore $\int \frac{dx}{\sqrt{x+1}+1}=\int \frac{\sqrt{x+1}}{x}dx-\log\left (x\right )$, so I only have to deal with $\int \frac{\sqrt{x+1}}{x}dx$.
Setting $u=\sqrt{x+1}$, we obtain $du=\frac{1}{2\sqrt{x+1}}dx$, therefore $dx=2udu$ and $x=u^2-1$, so
$\int\frac{\sqrt{x+1}}{x}dx=\int\frac{2u^2}{u^2-1}du=\int \left(2+\frac{2}{u^2-1}\right)du=2\sqrt{x+1}+\int \left(\frac{1}{u-1}-\frac{1}{u+1}\right)du=$
$=2\sqrt{x+1}+\log \left (\sqrt{x+1}-1\right )-\log \left (\sqrt{x+1}+1\right )=2\sqrt{x+1}+\log\left ( \frac{\sqrt{x+1}-1}{\sqrt{x+1}+1} \right )$
But then $\int \frac{dx}{\sqrt{x+1}+1}=2\sqrt{x+1}+\log\left ( \frac{\sqrt{x+1}-1}{\sqrt{x+1}+1} \right )-\log\left (x\right )=2\sqrt{x+1}+\log\left ( \frac{x+2-2\sqrt{x+1}}{x^2} \right )$, which is not what I am supposed to obtain. The actual answer is $2\sqrt{x+1}-2\log\left ( 1+\sqrt{x+1} \right )$.
Where is my mistake?
(I already know a correct way to solve it, I just want to know where I am committing a mistake).
 A: But you have been right all along!
Notice that
$$\log\frac{\sqrt{x+1}-1}{\sqrt{x+1}+1} - \log x = \log\frac{\sqrt{x+1}-1}{x(\sqrt{x+1}+1)} = \log \frac{1}{(\sqrt{x+1}+1)^2} = -2\log(\sqrt{x+1}+1)$$
by your very first step.
Also, I would suggest that you use $\int\frac{dx}{x} = \log|x|$ (with the absolute value sign, to extend the domain).
What I would also suggest is to use an online function grapher if you are not sure that your solution is correct. If two functions have identical graphs or if they differ by a constant value, then both are correct solutions of the integral.
A: Note that $$\ln\frac{x+2-2\sqrt{x+1}}{x^2}=\ln\frac{(\sqrt{x+1}-1)^2}{x^2}=2\ln\frac{\sqrt{x+1}-1}{x}$$
if we further simplify,
$$2\ln(\frac{\sqrt{x+1}-1}{x}\cdot\frac{\sqrt{x+1}+1}{\sqrt{x+1}+1})
=2\ln\frac{1}{\sqrt{x+1}+1}=-2\ln(\sqrt{x+1}+1)$$
You did nothing wrong.
A: Note that 
$$
\frac{x+2-2\sqrt{x+1}}{x^2}
=\frac
{(x+2)^2-4(x+1)}
{x+2+2\sqrt{x+1}}
\cdot\frac 1{x^2}\ ,
$$
and this has nothing to do with
$$
\frac{\sqrt{x+1}-1}{\sqrt{x+1}+1} \cdot \frac 1x
=
\frac{(\sqrt{x+1}-1)(\sqrt{x+1}+1)}{(\sqrt{x+1}+1)(\sqrt{x+1}+1)} \cdot \frac 1x
=
\frac 1{(\sqrt{x+1}+1)^2}\ ,
$$
which leads to the solution. So the last step is the bad one.
A: You're fine.  
$$\log\left(\frac{\sqrt{x+1}-1}{\sqrt{x+1}+1}\right) -\log x $$
$$= \log\left(\frac{\sqrt{x+1}-1}{\sqrt{x+1}+1}\frac{\sqrt{x+1}+1}{\sqrt{x+1}+1}\right) -\log x $$
$$=\log\left( \frac{x}{ (\sqrt{x+1}+1)^2}\right) -\log x$$
$$=\log x -2\log(\sqrt{x+1}+1)- \log x$$
$$=-2\log(\sqrt{x+1}+1).$$
A: No mistake! $log((\frac{\sqrt{x+1}-1}{x})^2)=-2log(\frac{x}{\sqrt{x+1}-1})=-2log(\frac{x(\sqrt{x+1}+1)}{(\sqrt{x+1}-1)(\sqrt{x+1}+1)})=-2log\frac{x(\sqrt{x+1}+1)}{x}$
