<s>[INST] What's my mistake in this integration??? $\int \sqrt{3-2x-x^2} dx$ This is how I'm trying to integrate this function:
\begin{align*}
\int \sqrt{3-2x-x^2}\, dx &= \int \sqrt{4-(x+1)^2}\, dx \\
&= \int \sqrt{2^2-(x+1)^2}\, dx
\end{align*}
Here I make the substitution:
$$ u=x+1 $$
$$du=dx$$
So the integral is now:
$$ \int \sqrt{2^2-u^2}\, du $$
I make a trigonometric substitution thinking about a right triangle where the hypothenuse is $2$, the adjacent side is $u$, the opposite side is $\sqrt{2^2-u^2}$, and the angle is called $\theta$.
$$ \sin(\theta)= \frac{\sqrt{2^2-u^2}}{ 2}$$
$$\bbox[2px,border:2px solid red]
{ 2\sin(\theta)= \sqrt{2^2-u^2}\qquad  
}$$
$$\frac{u}{2} =\cos(\theta)$$
$$ u=2 \cos(\theta)$$
$$ \bbox[2px,border:2px solid red]
{du=-2 \sin(\theta)\,d\theta\qquad  
}$$
So I write the integral as:
\begin{align*}
 \int 2\sin(\theta)(-2)\sin(\theta)\,d\theta &= \int (-4)\sin(\theta)\sin(\theta)\,d\theta \\
&= \int (-4){\sin}^2(\theta)\,d\theta \\
&= (-4)\int {\sin}^2(\theta)\,d\theta \\
&= (-4)\int \frac{1}{2}(1-\cos(2\theta))\,d\theta \\
&= (-4)\frac{1}{2}\int (1-\cos(2\theta))\,d\theta \\
&= (-2)\int (1-cos(2\theta))\,d\theta \\
&= (-2)\left[\int d\theta-\int \cos(2\theta)\,d\theta \right]\\
&= (-2)\left[\theta-\int \cos(2\theta)\,d\theta \right]\\
&= (-2)\left[\theta-\frac{1}{2} \sin(2\theta) \right]\\
&= \sin(2\theta) -2\theta
\end{align*}
And since $\cos(\theta) = u/2$, I know that $\theta =\arccos(u/2)$.
Therefore I have:
$$ \sin(2\arccos(u/2)) -2\arccos(u/2)$$
According to my first substitution $u=x+1$ so the final result is:
$$\bbox[2px,border:2px solid red] {\sin\left(2\arccos\left(\frac{x+1}{2}\right)\right) -2\arccos\left(\frac{x+1}{2}\right) + constant }\qquad$$
Can anyone help me? I don't understand what I'm doing wrong. Thanks!
 [/INST] Answer is correct, if you want it to match with one that Wolfram produce, there should be done following:
$$
\sin(2\theta)=2\sin(\theta)\cos(\theta)=2\frac{1}{2}\sqrt{2^2-u^2}\frac{u}{2}=\frac{u}{2}\sqrt{4-u^2}\\
u\to x+1\\
\sin(2\theta)=\frac{1}{2}(x+1)\sqrt{3-2x-x^2}
$$
And for second addendum
$$
\arccos(u/2)=\frac{\pi}{2}-\arcsin(u/2)\\
2\arccos(u/2)=\pi-2\arcsin\left(\frac{x+1}{2}\right)
$$
Altogether (hiding $\pi/2$ in constant):
$$
\int \sqrt{3-2x-x^2} dx = \frac{1}{2}(x+1)\sqrt{3-2x-x^2}+2\arcsin\left(\frac{x+1}{2}\right)+const
$$
</s>