Spivak, Ch. 19, Problem 5(iv): Where step is incorrect in this attempt to solve the integral $\int\frac{1}{\sqrt{1+e^x}}dx$? 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 )}$$
 A: Here are the mistakes I found, and I'm going to disregard domain restrictions for now. First,
$$\tan^{2}\left(\operatorname{arcsec}\left(u\right)\right) \neq \frac{\cos^{2}\left(\operatorname{arcsec}\left(u\right)\right)}{\sin^{2}\left(\operatorname{arcsec}\left(u\right)\right)},$$
it is
$$
\eqalign{
\tan^{2}\left(\operatorname{arcsec}\left(u\right)\right) &= \frac{\sin^{2}\left(\operatorname{arcsec}\left(u\right)\right)}{\cos^{2}\left(\operatorname{arcsec}\left(u\right)\right)} \cr
&= \frac{1-\cos^{2}\left(\operatorname{arcsec}\left(u\right)\right)}{\cos^{2}\left(\operatorname{arcsec}\left(u\right)\right)} \cr
&= \frac{1}{\cos^{2}\left(\operatorname{arcsec}\left(u\right)\right)}-1 \cr
&= u^2-1.
}
$$
Also, I'm not sure how you got $\csc\left(\operatorname{arcsec}\left(u\right)\right) = u$ since $\operatorname{csc}$ and $\operatorname{arcsec}$ aren't inverses of each other. In fact, I'm not even sure how these equations help you. I agree that $\cot\left(\operatorname{arcsec}\left(u\right)\right) = \frac{1}{\sqrt{u^{2}-1}}$, but that's solved by doing that right triangle method. And also by using the right triangle method, $\csc\left(\operatorname{arcsec}\left(u\right)\right) = \frac{u}{\sqrt{u^{2}-1}}$.
A: The issue with your attempt is from step (4) to step (5).
$-2\log{(\csc{(\text{arcsec}{(u)})}+\cot{(\text{arcsec}{(u)}}))}\tag{4} $
$= -2 \log(\frac{1}{(u \sqrt{(1 - 1/u^2))}} + \frac{1}{\sqrt{(1 - 1/u^2))}}$
instead of $$-2\log{(u+\frac{1}{\sqrt{u^2-1}})}\tag{5}$$
