When are absolute values needed in the antiderivative? I just tackled a STEP I past paper question (Q4(iii), 2004) which asked me to determine the antiderivative for this integral:
$\int \frac{1}{(x+2)\sqrt{x^2+4x-5}}dx$
which (after substituting $\frac{x+2}{3}= \sec(t)$) gives:
$\frac{1}{3}\sec^{-1}{(\frac{x+2}{3})} + C$
This is also the answer given by Cambridge in the answer booklet. However, I also put this integral into an online integral calculator and one of the possible antiderivatives was
$-\frac{1}{3}\arcsin{(\frac{3}{\mid x+2 \mid})} + C_1$
This is (according to Desmos) is equivalent to: 
$\frac{1}{3} \sec^{-1} {(\frac{\mid x+2 \mid}{3})} + C_2$
which is not at all the same function as the one I got. However, looking at the graphs (of the original functions and the antiderivatives), it would seem that the integral calculator is correct. I am presuming that Cambridge simplified the answer for STEP.
I can see that the quadratic in the radical has a minimum point at $x=-2$, but we haven't really been taught much about absolute values and discontinuities, except for 
$\int\frac{1}{x}dx = \ln{\mid x\mid}+C$, 
which we were told was because $\ln(x)$ can't take negative values. Yet, $\arcsin(x)$ above can, and there's an absolute value there.
Could someone explain to me how all of this works, please?
 A: You can learn a lot by really understanding the single antiderivative
$$\int \frac{1}{t} dt.$$
We are tempted to interpret this as
$$\int_1^x \frac{1}{t} dt = \ln x, \qquad (x > 0) \tag{1}$$
but we know that the choice of the base point $1$ is arbitrary. We could find another antiderivative by looking at
$$\int_4^x \frac{1}{t} dt = \ln x - \ln 4.$$
This ambiguity leads to the "up to an additive constant $C$", as both of these are acceptable antiderivatives when $x > 0$.
But what about when $x < 0$? Then $\int_1^x \frac{1}{t} dt$ doesn't converge --- the domain of integration includes the point $0$, near which $1/t$ shoots off to infinity. On the other hand, if $x < 0$, then
$$ \int_{x}^{-1} \frac{1}{t} dt = \int_{1}^{-x} \frac{1}{t} dt = \ln(-x). \qquad (x < 0)\tag{2}$$
(The equality comes from substituting $t \mapsto -t$ and then writing $\int_a^b = - \int_b^a$.) Of course, we know this is really only true up to a constant $C$.
We know that $(1)$ applies for all $x > 0$ and $(2)$ applies for all $x < 0$. There is no antiderivative corresponding to $x = 0$, since every integral of the form
$$\int_A^0 \frac{1}{t} dt$$
diverges. Thus a complete story would be to say that the antiderivative of $\frac{1}{t}$ is
$$
\int \frac{1}{t} dt =
\begin{cases}
  \ln x + C & \text{if } x > 0, \\
  \ln (-x) + C & \text{if } x < 0.
\end{cases}$$
It just happens to be that this is given by $\ln \lvert x \rvert + C$ -- that's sort of a coincidence.
A: Your antiderivative is wrong when $x < -1$ (its derivative has the wrong sign).
If you use the substitution $(x+2)/3 = \sec(t)$ (I don't think you really used $x = \sec(t)$), your integral becomes
$$\int \frac{\tan(t)}{3 \sqrt{\sec^2(t)-1}}\; dt $$
Now $\sec^2(t)-1 = \tan^2(t)$, so it may be tempting to write
this as $\int dt/3 = t/3 + C$ leading to your answer.  But this
is wrong: if $\tan(t) < 0$ (which corresponds to $x < -5$) we will have $\sqrt{\sec^2(t)-1} = -\tan(t)$.  So a correct answer would be
$$ \cases{ \frac{1}{3} \sec^{-1}\left(\frac{x+2}{3}\right)+C & if $x > 1$\cr 
-\frac{1}{3} \sec^{-1}\left(\frac{x+2}{3}\right)+C & if $x < -5$\cr}$$
which (with different $C$ in the second case, but there's no need for the $C$'s to be the same) could be written as
$$ \frac{1}{3} \sec^{-1} \left ( \frac{|x+2|}{3}\right) + C $$
Of course, if for some reason you're only interested in $x > 5$ 
your answer would be OK.
