<s>[INST] Integral with Substituting $u=e^x$ I have to find the indefinite integral: $\int \frac{1}{\sqrt{1+e^x}}\cdot dx$.
I tried substituting $u=e^x$ and then $v=1+u$, and I find that $\int \frac{1}{\sqrt{v}}=2\sqrt{v}+c=2\sqrt{u+1}+c=2\sqrt{1+e^x}+c$.  However, when I take the derivative of this, I get $\frac{e^x}{\sqrt{1+e^x}}$, so I know I must have made a mistake somewhere.  What have I done wrong?
Thanks for your time.
 [/INST] You have to also transform $dx$ when you do a substitution. For example, if you substitute $u = e^{x}$, then you have $x = \log u$ and thus $\frac{dx}{du} = \frac{1}{u}\Rightarrow dx = \frac{du}{u}$.
With this subsitution, we get
$$\int\frac{dx}{\sqrt{1+e^{x}}} = \int\frac{du}{u\sqrt{1+u}}$$
which isn't exactly all that easy to handle either.
Below I present an alternative approach via $u$-substitution.
We multiply through with $e^{-x}$, then we have:
\begin{align}
\int\frac{dx}{\sqrt{1+e^{x}}} &= \int\frac{e^{-x}}{e^{-x}\sqrt{1+e^x}}\,dx\\
&=\int\frac{e^{-x}}{\sqrt{e^{-2x}+e^{-x}}}dx
\end{align}
We can now substitute $u=e^{-x}$, then we have $\frac{du}{dx} = -e^{-x}$ and therefore $e^{-x}\,dx = -du$.
Therefore, we have
\begin{align}
\int\frac{dx}{\sqrt{1+e^{x}}} &= -\int\frac{du}{\sqrt{u^2+u}}\\
&=-\int\frac{du}{\sqrt{\left(u+\frac{1}{2}\right)^2-\frac{1}{4}}}
\end{align}
Substituting $u+\frac{1}{2} = t$, then $\frac{du}{dt} = 1 \Rightarrow du = dt$ and we have
\begin{align}
\int\frac{dx}{\sqrt{1+e^{x}}} &= -\int\frac{dt}{\sqrt{t^2-\left(\frac{1}{2}\right)^2}}\\
&=-\operatorname{arcosh}\left(2t\right)+C\\
\end{align}
Reversing the substitutions, we have the final result

$$\int\frac{dx}{\sqrt{1+e^{x}}} = -\operatorname{arcosh}(2e^{-x}+1) + C$$

</s>