<s>[INST] Indefinite integral with substitution For my engineering math course I got a couple of exercises about indefinite integrals. I ran trought all of them but stumbled upon the following problem. 
$$\int \frac{1-x}{\sqrt{1+x-2x^2}}\,dx $$
We can write $1+x-2x^2$ as $(1-x)(2x+1)$ 
So I got:
$$
\int \frac{1-x}{\sqrt{1+x-2x^2}}\,dx = \int \frac{1-x}{\sqrt{(1-x)(2x+1)}}\,dx 
$$
We can also replace $1-x$ in the denominator with $\sqrt{(1-x)^2}$ 
$$
\int \frac{1-x}{\sqrt{(1-x)(2x+1)}}\,dx = \int \frac{\sqrt{(1-x)^2}}{\sqrt{(1-x)(2x+1)}}\,dx
$$
If we simplify this fraction we get:
$$
\int \frac{\sqrt{1-x}}{\sqrt{2x+1}}\,dx
$$
Next we apply the following substitutions
$$
u = -x
$$
so : $-du = dx$
We can rewrite the integral as following:
$$-\int \frac{\sqrt{1+u}}{\sqrt{1-2u}}\,du$$
Then we apply another substitution: 
$\sqrt{1+u} = t $ so $ \frac{1}{2\sqrt{1+u}} = dt $ 
We rewrite: $ \sqrt{1+u} $ to $\frac{1}{2}t^2 \,dt $ 
We can also replace $\sqrt{1-2u} $ as following: 
$$\sqrt{-2t^2+3}=\sqrt{-2(1+u)+3}=\sqrt{1-2u}$$ 
With al these substitutions the integral has now the following form: 
$$-\frac{1}{2}\int \frac{t^2}{\sqrt{-2t^2+3}}\,dt$$ 
Next we try to ''clean'' up the numerator: 
$$-\frac{1}{2} \int \frac{t^2}{\sqrt{\frac{1}{2}(6-t^2)}} \, dt$$
$$-\frac{\sqrt{2}}{2} \int \frac{t^2}{\sqrt{6-t^2}} \, dt$$
And that's where I got stuck. I can clearly see that an arcsin is showing up in the integral but don't know how to get rid of the $t^2$.
 [/INST] You have:
$$
\int \frac{1-x}{\sqrt{1+x-2x^2}}\,dx
$$
First we'll do a routine substitution:
$$
u = 1+x-2x^2, \qquad du = (1-4x)\,dx, \qquad \frac{-du} 4 = \left( \frac 1 4 - x \right)\, dx
$$
\begin{align}
\int \frac{1-x}{\sqrt{1+x-2x^2}}\,dx & = \int \frac{\frac 1 4-x}{\sqrt{1+x-2x^2}}\,dx + \int \frac{\frac 3 4}{\sqrt{1+x-2x^2}}\,dx \\[15pt]
& = \frac{-1} 4 \int \frac{du}{\sqrt u} + \frac 3 4 \int \frac{dx}{\sqrt{1+x-2x^2}}.
\end{align}
I expect you can handle the first integral above.  The second integral should make you think of completing the square:
\begin{align}
-2x^2 + x+1 = -2\left( x^2 - \frac 1 2 x \right)^2 + 1 & = -2\left( \overbrace{x^2 - \frac 1 2 x +\frac 1 {16}}^\text{a perfect square} \right)^2 + 1 + \frac 1 8 \\[10pt]
& = -2 \left( x - \frac 1 4 \right)^2 + \frac 9 8.
\end{align}
Then
\begin{align}
\frac 9 8 -2\left( x - \frac 1 4 \right)^2 = \frac 9 8 - (2x-1)^2 & = \frac 9 8 \left( 1 - \frac 8 9 (2x-1)^2 \right) \\[10pt]
& = \frac 9 8 \left( 1 - \left( \frac{2\sqrt2} 3 (2x-1) \right)^2 \right) \\[10pt]
& = \frac 9 8 (1 - \sin^2\theta) \\[15pt]
\frac{4\sqrt2} 3 \, dx & = d\theta
\end{align}
et cetera.
</s>