I was killing time solving some indefinite integrals, when I found this one: \begin{equation} \int\frac{1}{(x+1)\sqrt{x^2+2x}}\ \mathrm{d}x \tag{1}\label{integral} \end{equation} Not a particularly difficult one, I'll post my solution here: \begin{equation} \begin{split} \int\frac{1}{(x+1)\sqrt{x^2+2x}}\ \mathrm{d}x = \int\frac{1}{(x+1)\sqrt{(x+1)^2-1}}\ \mathrm{d}x \end{split} \tag{2}\label{calculus} \end{equation} by substituting $t = x+1$, d$t = \mathrm{d}x$, and then $s = \sqrt{t^2-1} \rightarrow \mathrm{d}s = \frac{t}{\sqrt{t^2-1}}\mathrm{d}t$
\begin{equation} \begin{split} = \int\frac{1}{t\sqrt{t^2-1}}\ \mathrm{d}t &= \int\frac{1}{(x+1)\sqrt{(x+1)^2-1}}\ \mathrm{d}x =\\ &= \int\frac{\mathrm{d}s}{1+s^2} =\\ &= \arctan{s} + \mathrm{cost}\\ &= \arctan{\sqrt{t^2-1}} + \mathrm{cost}\\ &= \arctan{\sqrt{\left(x+1\right)^2-1}} + \mathrm{cost} \end{split} \tag{3}\label{calculus2} \end{equation}
I then derived (I recommend, if you wanna check my results to use this online derivative calculator which actually shows steps...) my solution finding the starting function: $$\frac{\mathrm{d}}{\mathrm{d}x}(\arctan{\sqrt{(x+1)^2-1}} + \mathrm{cost}) = \frac{1}{(x+1)\sqrt{x^2+2x}}$$
The graph (plotted with Grapher from Mac Os X), with $\color{red}{\text{function}}$ and $\color{blue}{\text{integral}}$ :
Now this integral comes from the exercise book Problems in Mathematical Analysis by Boris Demidovich and it's the number 1271, and even if I'm pretty sure this mine is the correct solution I lost quite time to understand the proposed solution of the book, which, if you don't have it and you can't check for yourself, is
1271. $\qquad-\arcsin(\frac{1}{1+x})$
deriving this function you'll find:
\begin{equation} \begin{split} \frac{\mathrm{d}}{\mathrm{d}x}&\left[-\arcsin(\frac{1}{1+x})\right] =\\ &= \dfrac{1}{\left(x+1\right)^2\sqrt{1-\frac{1}{\left(x+1\right)^2}}}\\ &= \dfrac{1}{\frac{\left(x+1\right)^2}{\sqrt{(x+1)^2}}\sqrt{\left(x+1\right)^2-1}}\\ &= \dfrac{1}{\frac{\left(x+1\right)^2}{|x+1|}\sqrt{\left(x+1\right)^2-1}}\\ &= \dfrac{1}{{\left(x+1\right)}\mathrm{sgn}(x+1)\sqrt{\left(x+1\right)^2-1}}\\ \end{split} \tag{4}\label{calculus3} \end{equation}
Plotting the result will give you an idea about the mistakte he could have done, in cyan the $\color{cyan}{Demidovich's~~primitive}$:
So I was pretty sure I was right and he was not, so I tried integrate the \eqref{integral} with Mathematica, with another unsatisfying outcome:
\begin{equation} \int\frac{1}{(x+1)\sqrt{x^2+2x}}\ \mathrm{d}x = \frac{\sqrt{2}\sqrt{x}\sqrt{x+2}\arctan(\sqrt{\frac{x}{x+2}})}{\sqrt{x(x+2)}} \end{equation}
This solution, in $\color{orange}{orange}$, is almost like mine, even if it does not comprehend the negative values of the function...
Also, if I try to derive (I've done it with calculator, as it's quite long to do for yourself...) you get $$\left(\frac{\sqrt{2}\sqrt{x}\sqrt{x+2}\arctan(\sqrt{\frac{x}{x+2}})}{\sqrt{x(x+2)}}\right)' = $$ $$-\dfrac{\left(\sqrt{x+2}\left(-x^\frac{7}{2}-3x^\frac{5}{2}-2x^\frac{3}{2}\right)+\left(x+2\right)^\frac{3}{2}\left(x^\frac{5}{2}+x^\frac{3}{2}\right)\right)\arctan\left(\frac{\sqrt{x}}{\sqrt{x+2}}\right)-x^3-4x^2-4x}{\left(x\left(x+2\right)\right)^\frac{3}{2}\left(x^2+3x+2\right)}$$
Now, since I've found that in my range of definition $x^2-2x>0$ the primitive function that i found, derived, gives me the starting function, this should tell me that I am right and others (computer, this case) have bugs or they encounter problems deriving such a function. So which of the three solution $\color{blue}{mine}$, $\color{orange}{Mathematica's}$ or $\color{cyan}{Demidovich's}$ is the correct one? Why are them wrong, if they are? Does it depend on calculator's bug or it's my problem?
Thanks for attention.