<s>[INST] Evaluate $\int\frac{\sqrt{x^2+2x-3}}{x+1}d\,x$ by trig substitution I am preparing for an exam and found this integral in a previous test. Did I do it correctly?
My attempt.
$$
\int\frac{\sqrt{x^2+2x-3}}{x+1}\,dx
$$
Complete the square of $x^2+2x-3$; I changed the integral to
$$
\int\frac{\sqrt{(x-1)^2-4}}{x+1}\,dx
$$
then set $u=x+1$ to get
$$
\int\frac{\sqrt{u^2-4}}{u}\,dx
$$
Using the triangle, $2\sec\theta=u$ and $du=2\sec\theta\tan\theta d\theta$
$$
\int\frac{\sqrt{(2\sec\theta)^2-2^2}}{2\sec\theta}2\sec\theta \tan\theta\, d\theta
$$
This I simplified to 
$$
2\int\tan^2\theta\, d\theta = 2\int\sec^2\theta-1\,d\theta
=2[\tan\theta-\theta]+C
$$
Back substitute
$$
\theta=\tan^{-1}\frac{\sqrt{u^2-4}}{2}
$$
and
$$
\tan\theta=\frac{\sqrt{u^2-4}}{2}
$$
Back substitute $u=x+1$
$$
\int\frac{\sqrt{x^2+2x-3}}{x+1}\,dx=
\sqrt{(x-1)^2-4}-\tan^{-1}{\sqrt{(x-1)^2-4}}+C
$$
 [/INST] 
I changed the integral to $\int\frac{\sqrt{(x-1)^2-4}}{x+1}dx$ then $u=x+1$

It should be
$$\int\frac{\sqrt{(x\color{red}{+}1)^2-4}}{x+1}dx$$

I simplified to $2\int tan^2\theta d\theta$ = $2\int\sec^2\theta-1d\theta$
$=2[tan\theta-\theta]+C$
back substitute $\theta=tan^{-1}\frac{\sqrt{u^2-4}}{2}$and $tan\theta=\frac{\sqrt{u^2-4}}{2}$ back substitute $u=x+1$

I think you did nothing wrong here.

$\int\frac{\sqrt{x^2+2x-3}}{x+1}dx={\sqrt{(x-1)^2-4}}-tan^{-1}{\sqrt{(x-1)^2-4}}+C$

This is not correct :
$$\int\frac{\sqrt{x^2+2x-3}}{x+1}dx={\sqrt{(x\color{red}{+}1)^2-4}}-\color{red}{2}\tan^{-1}\frac{\sqrt{(x\color{red}{+}1)^2-4}}{\color{red}{2}}+C$$
</s>