Indefinite integral of $\frac{\sqrt{x}}{\sqrt{x}+1}$ For this I tried using the substitution technique, but it got me nowhere near the right answer.
What my notepad looks like:
$$f(x) = \dfrac{\sqrt{x}}{\sqrt{x}+1}$$
and
$$F(x) = \int f(x) = 
\begin{cases}
\sqrt{x} &= t \\
dx &= 2t\cdot dt
\end{cases}
= \int\frac{t}{t+1}\cdot2t\cdot dt = \boxed{\dfrac{4t(t+1)-2t^2}{(t+1)^2}+c}$$
After swapping $t$ with $x$ again the answer is not even close; where did I go wrong?
Also as a follow up question:


*

*How do I know when the proper situation is to use integration by substitution above integration by parts?

 A: Hint. Try instead substituting $t=\sqrt{x}+1$. Then $x=(t-1)^2$, and $\mathrm{d}x=2(t-1)\,\mathrm{d}t$, and hence:
$$\begin{align}
\int\frac{\sqrt{x}}{\sqrt{x}+1}\,\mathrm{d}x
&=\int\frac{t-1}{t}\cdot2(t-1)\,\mathrm{d}t\\
&=2\int\frac{(t-1)^2}{t}\,\mathrm{d}t\\
\end{align}$$
A: In answer to the first question, the basic expression inside the OP's boxed formula, $4t(t+1)-2t^2\over(t+1)^2$, is the derivative of $2t^2\over t+1$, not its integral.  
As for the second question, there's no hard and fast rule (at least none that I know of), but in this case using a substitution to get rid of the square root signs was a good idea.
A: $$\sqrt x + 1 = t \implies \sqrt x = t-1$$ $$dx =2(t-1)\,dt, \quad \sqrt x = t-1$$
$$\int \frac{2(t-1)^2}t\,dt $$
A: First:
$$\left(\frac{2t^2+4t}{(t+1)^2}\right)'=\frac{4(t+1)^2-4t(t+2)}{(t+1)^3}=\frac4{(t+1)^3}$$
and this doesn't look like the function you were trying to integrate: $\;\frac{2t^2}{t+1}\;$ !
Your function in the integral is :
$$\frac{2t^2}{t+1}=2t-\frac{2t}{t+1}=2t-2+\frac2{t+1}$$
and thus the integral in fact is
$$\int\left(2t-2+\frac2{t+1}\right)dt=t^2-2t+2\log|t+1|+C$$
and taking back the original variable according to your substitution:
$$t=\sqrt x\implies \int\frac{\sqrt x}{1+\sqrt x}dx=x-2\sqrt x+2\log(\sqrt x+1)+C$$
