<s>[INST] 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.
 [/INST] To avoid absolute value
Letting $y=x+2$ yields
$$
\begin{aligned}
\int \frac{1}{(x+2) \sqrt{(x+1)(x+3)}}&=\int \frac{d y}{y \sqrt{y^2-1}}\\&=\int \frac{1}{y^2} d\left(\sqrt{y^2-1}\right) \\
&=\int \frac{\left.d \sqrt{y^2-1}\right)}{\left(\sqrt{y^2-1}\right)^2+1} \\
&=\arctan \left(\sqrt{y^2-1}\right)+C \\
&=\arctan \left(\sqrt{x^2+4 x+3}\right)+C
\end{aligned}
$$
</s>