Absolute values in $\int \frac{dx}{(x+2)\sqrt{(x+1)(x+3)}}$ in my math class we were given a list of indefinite integrals, and one of them was:
$$\int \frac{dx}{(x+2)\sqrt{(x+1)(x+3)}}$$
My working:
$$\int \frac{dx}{(x+2)\sqrt{(x+1)(x+3)}}=\int \frac{dx}{(x+2)\sqrt{(x+2)^2-1}}$$
Then I used the substitution $x+2=\sec t$ to get:
$$\int \frac{\tan t}{\sqrt{\sec^2 t-1}}dt=\int \frac{\tan t}{|\tan t|}dt= t\,\text{sgn}\, (\tan t)+C...$$
Then I checked the answer sheet, and this is what they did:
$$\int \frac{\tan t}{\sqrt{\sec^2 t-1}}dt=\int dt=t+C=\text{arcsec}(x+2)+C$$
What I don't understand is, why are they allowed to say $\sqrt{\sec^2 t-1}=\tan t?$ I tried to put some values in and I have found that:
$$\int_{\sec \left(\frac{8}{5}\right)-2}^{\sec \left(\frac{9}{5}\right)-2} \frac{dx}{(x+2)\sqrt{(x+1)(x+3)}}<0$$ but according to the answer sheet I would get $\dfrac{1}{5}$
My answer looks wrong, I would be happy if someone could explain what the problem is, and also why we are allowed to simplify like they did.

The answer of the book looks wrong. Since the principal range of $\sec x$ is:


*

*$\left[ 0; \frac{\pi}{2} \right)$ if $x \ge 1$, and on this domain, $\tan t$ is positive.

*$\left( \frac{\pi}{2} ; \pi \right]$ if $x \le -1$, whereas on this domain, $\tan t$ is negative.


So, in fact, the solution to that integral should be split in to 2 different parts:
$$\int\limits \frac{dx}{(x+2)\sqrt{(x+1)(x+3)}} = \left\{ \begin{array}{ll} -\mbox{arcsec}(x + 2) + C_1 &, \mbox{for }x < -3 \\
\mbox{arcsec}(x + 2) + C_2 &, \mbox{for }x > -1 \end{array} \right.$$
