In problem 5(iv) of Chapter 19 of Spivak's Calculus, "Integration in Elementary Terms", we are asked to integrate the following integral $$\int\frac{1}{\sqrt{1+e^x}}dx\tag{1}$$
It seems I have made a mistake in my attempt at solving this integral. I can't figure out where it is. I know because it differs from the solution manual, and when I differentiate my result in Maple I don't obtain the expected result.
I use two consecutive substitutions (now, obviously, the solution manual did something simpler, but for didactical purposes I'd really like to figure out what step is wrong below).
First let's use the substitution $$u=\sqrt{1+e^x}$$
$$x=\log{(u^2-1)}$$
$$dx=\frac{2u}{u^2-1}du$$
Thus $(1)$ becomes
$$\int\frac{1}{u}\frac{2u}{u^2-1}du=2\int\frac{1}{u^2-1}du$$
At this point, the solution manual uses partial fractions decomposition. Instead, I use another substitition.
$$u=\sec{\theta}$$
$$du=\tan{\theta}\sec{\theta}d\theta$$
$$\theta=\text{arcsec}{(u)}$$
Subbing in
$$2\int\frac{1}{\tan^2{\theta}}\tan{\theta}\sec{\theta}d\theta$$
$$=2\int\frac{1}{\cos{\theta}}\cdot \frac{\cos{\theta}}{\sin{\theta}}d\theta$$
$$=2\int\csc{\theta}d\theta\tag{2}$$
Now,
$$\int\csc{x}dx=-\log{(\csc{x}+\cot{x})}$$
So, from $(2)$,
$$=-2\log{(\csc{\theta}+\cot{\theta})}\tag{3}$$
$$=-2\log{(\csc{(\text{arcsec}{(u)})}+\cot{(\text{arcsec}{(u)}}))}\tag{4}$$
$$=-2\log{(u+\frac{1}{\sqrt{u^2-1}})}\tag{5}$$
To get from $(4)$ to $(5)$, I used the following
$$\tan^2{(\text{arcsec}{(u)})}=\frac{\cos^2{(\text{arcsec}{(u)})}}{\sin^2{(\text{arcsec}{(u)})}}=\sec^2{(\text{arcsec}{(u)})}-1=u^2-1$$
But
$$\cos^2{(\text{arcsec}{(u)})}=1-\sin^2{(\text{arcsec}{(u)})}$$
so
$$\frac{\cos^2{(\text{arcsec}{(u)})}}{\sin^2{(\text{arcsec}{(u)})}}=\frac{1-\sin^2{(\text{arcsec}{(u)})}}{\sin^2{(\text{arcsec}{(u)})}}=\frac{1}{\sin^2{(\text{arcsec}{(u)})}}-1=u^2-1$$
$$\frac{1}{\sin^2{(\text{arcsec}{(u)})}}=u^2$$
$$\csc{(\text{arcsec}{(u)})}=\frac{1}{\sin{(\text{arcsec}{(u)})}}=u\tag{6}$$
Which is one of the terms we need in $(4)$. The other is $\cot{(\text{arcsec}{(u)}})$, which is
$$\cot{(\text{arcsec}{(u)}})=\frac{1}{\tan{(\text{arcsec}{(u)}})}=\frac{1}{\sqrt{u^2-1}}\tag{7}$$
Thus, from $(4)$, we have
$$\int\frac{1}{\sqrt{1+e^x}}dx\tag{1}$$
$$=-2\log{(\csc{(\text{arcsec}{(u)})}+\cot{(\text{arcsec}{(u)}}))}\tag{4}$$
$$=-2\log{\left (u+\frac{1}{\sqrt{u^2-1}}\right )}$$
$$=-2\log{\left (\sqrt{1+e^x}+\frac{1}{\sqrt{e^x}}\right )}$$