<s>[INST] High school integration: $-\frac{1}{2} \int \sec \theta d\theta$ Original question was: $\int \frac{1}{(x+3)^2 -4}$
Substitution: $x=2\sin \theta -3$
This is a follow up on my last thread because I cannot seem to get the answer.
Anyway, I got to:
$$-\frac{1}{2} \int \sec \theta d\theta$$
And had used the substitution $x=2\sin \theta -3$. But the answer should be $$\frac {1}{4} \ln\left|\frac{x+1}{x+5}\right| +c $$
However I'm getting  $$\frac {1}{4} \ln\left|\frac{-(x+1)}{x+5}\right| +c $$
My steps were:
$=\frac{-1}{2} \ln\left|\sec\theta +\tan\theta\right| +c $
$=\frac{-1}{2} \ln\left|\frac{\sin\theta+1}{\cos\theta}\right| +c $
$\sin\theta +1 = \frac{x+5}{2}$
$ \frac{-1}{4} ln\left|\frac{(x+5)^2}{4\cos^2\theta}\right| +c $
$ \cos^2\theta = 1- \frac{(x+3)^2}{4}$
$ \frac{-1}{4} ln\left|\frac{(x+5)^2}{4 - (x+3)^2}\right| +c $
$ \frac{-1}{4} ln\left|\frac{(x+5)^2}{(2-(x+3)(2+(x+3))}\right| +c $
$ \frac{-1}{4} \ln\left|\frac{(x+5)^2}{(-x-1)(x+5)}\right| +c $
$$\frac {1}{4} \ln\left|\frac{-(x+1)}{x+5}\right| +c $$
However, the -(x+1) should just be (x+1). Does anyone know where I went wrong?
 [/INST] A much easier approach is to start by applying the difference of squares identity to the denominator, factorising and doing partial fractions. You'll get to the "intended" answer much quicker. Avoid trigonometric substitutions where possible.
So the integrand becomes $$\begin{align}\frac 1{(x+3)^2 - 2^2} &= \frac 1{(x+1)(x+5)}\\ &= \frac 14\left(\frac{1}{x+1} - \frac{1} {x+5}\right),\end{align}$$ from which you should be able to finish.
</s>