Integral of $\sqrt{1+e^x}$, why does the method not work

integrationtrigonometric-integrals

What is the issue with my method, I make a substitution and get an integral in terms of $\theta$, then solve the integral, all of which is correct but the final answer is wrong, so am I not allowed to use $\tan \theta = e^{\frac{x}{2}}$ ? I only used this method because it works for other integrals similar to this one.

$\displaystyle\operatorname{Let} e^{\frac{x}{2}}=\tan \theta$. By pythagorean identities, $\displaystyle\cos \theta=\dfrac{1}{\sqrt{1+e^x}} \implies \sec \theta=\sqrt{1+e^x}$
$$
\begin{aligned}
\\
& \frac{d}{d \theta}\left(\tan \theta=e^{\frac{x}{2}}\right)= \\
& \sec ^2 \theta=\frac{1}{2} e^{\frac{x}{2}} \frac{d x}{d \theta} \iff \frac{2 \sec^2 \theta}{\tan \theta} d \theta=d x \\
& \text{Then, }I = \int{\sqrt{1+e^x}}dx = 2 \int \sec ^3 \theta \cot \theta d \theta=2 \int \sec ^2 \theta \csc \theta d \theta \\
& =2\sec \theta-2 \ln |\csc \theta+\cot \theta|+C \\
& \quad \\
& \sec \theta=\sqrt{1+e^2} \implies \csc \theta=\frac{\sqrt{1+e^x}}{e^{\frac{x}{2}}}, \, \quad \tan\theta = e^{\frac{x}{2}} \implies \cot \theta=\frac{1}{e^{\frac{x}{2}}} \\
& \therefore I=2 \sqrt{1+e^x}-2 \ln \left(\frac{1+\sqrt{1+e^x}}{e^{\frac{x}{2}}}\right)+C \\
& =2 \sqrt{1+e^x}+x-\ln \left(1+\sqrt{1+e^x}\right)^2+C \\
&
\end{aligned}
$$

Best Answer

Short answer: Your answer is correct.

If you want more details, you need to explain why you think it's incorrect. Those details are currently lacking.