There is an exercise on indefinite integral in some infinitesimal calculus book:
$$ \int \sqrt{x^{2} +1} \cdot dx $$
The solution uses the first substitution x = sinh u and after some transformations the book gets the result:
$$ \frac{1}{2} \cdot \left( x\sqrt{x^{2} +1} +\ln\left( x+\sqrt{x^{2} +1}\right)\right) +C $$
MAXIMA shows me a result:
$$ \[\frac{\operatorname{asinh}(x)}{2}+\frac{x\ \sqrt{{{x}^{2}}+1}}{2}\] $$
It seems to be same, but the question is: the book says that there is an another solution via substitution with tan. I tried to solve it with the tan-substitution and got very different result. Please, show me where is my error:
$$ \int \sqrt{x^{2} +1} \cdot dx=\int \sqrt{\tan^{2} a +1} \cdot \frac{da}{\cos^{2} a} =\int \sqrt{\frac{1}{\cos^{2} a}} \cdot \frac{da}{\cos^{2} a} =\int \frac{da\cdot \cos a}{\cos^{4} a} =\int \frac{d(\sin a)}{\left(\cos^{2} a\right)^{2}} = $$
$$ = \int \frac{d(\sin a)}{\left( 1\ -\ \sin^{2} a\right)^{2}} =\int \frac{dt}{\left( 1-t^{2}\right)^{2}} =\int \frac{e^{u} \cdot du}{\left( 1-e^{2\cdot u}\right)^{2}} =\frac{1}{2} \cdot \int \frac{2\cdot e^{u} \cdot du}{\left( 1-e^{2\cdot u}\right)^{2}} =\frac{1}{2} \cdot \int \frac{d\left( e^{2\cdot u}\right)}{\left( 1-e^{2\cdot u}\right)^{2}} = $$
$$ = \frac{1}{2} \cdot \int \frac{dz}{( 1-z)^{2}} =\frac{1}{2} \cdot \int \frac{d( z-1)}{( z-1)^{2}} =\frac{1}{2} \cdot \int \frac{dv}{v^{2}} =-\frac{1}{2\cdot v} +C $$
And then I'm trying to return back to the x through v -> z -> u -> t -> a -> x variables "back"-substitutions:
$$ = -\frac{1}{2\cdot ( z-1)} +C=-\frac{1}{2\cdot \left( e^{2\cdot u} -1\right)} +C=\frac{1}{2\cdot \left( 1-e^{2\cdot \ln t}\right)} +C=\frac{1}{2\cdot \left( 1-t^{2}\right)} +C=\frac{1}{2\cdot \left( 1-\sin^{2} a\right)} = $$
$$ = \frac{1}{2\cdot \cos^{2} a} +C=\frac{1}{2\cdot \cos(\arctan x) \cdot \cos(\arctan x)} +C=\frac{1}{2\cdot \frac{1}{\sqrt{1+x^{2}}} \cdot \frac{1}{\sqrt{1+x^{2}}}} +C=\frac{1+x^{2}}{2} +C $$
You made a mistake going from $u$ to $z$: if $z = e^{2u}$, then $dz = 2e^{2u}\,du$, where you take it to be $2e^u\,du$. In fact, if you look at just what happens when you go from $t$ to $z$, you have replaced $t^2$ by $z$, but also replaced $dt$ by $dz$, where it should be $2\sqrt z\,dz$.
You could have stopped at $t$: once you have $\int \frac{dt}{(1-t^2)^2}$, you can take the partial fraction decomposition, and finish with no more substitutions.