Compute definite integral Question: Compute 
$$\int_0^1 \frac{\sqrt{x-x^2}}{x+2}dx.$$
Attempt: I've tried various substitutions with no success. Looked for a possible contour integration by converting this into a rational function of $\sin\theta$ and $\cos \theta$.
 A: We certainly can use contour integration here.  First, through a sub of $x \mapsto x^2$ and a little algebra, we can express the integral as
$$2 \int_0^1 dx \, \sqrt{1-x^2} - 4 \int_0^1 dx \frac{\sqrt{1-x^2}}{2+x^2} = \frac{\pi}{2} - 2 \int_{-1}^1 dx \frac{\sqrt{1-x^2}}{2+x^2}$$
Now consider  
$$\oint_C dz \frac{\sqrt{z^2-1}}{z^2+2} $$
where $C$ is (1) the circle $z=R e^{i \theta}$, $\theta \in [-\pi,\pi)$, (2) a line extending from the circle at $\theta=\pi$ to the dogbone contour, (3) the dogbone, and (4) a line back to the circle at $\theta=-\pi$.  Note that the integral vanishes along the lines to the dogbone and along the small circles of the dogbone.  
Thus, the contour integral is equal to
$$i R \int_{-\pi}^{\pi} d\theta \, e^{i \theta} \frac{\sqrt{R^2 e^{i 2 \theta}-1}}{R^2 e^{i 2 \theta}+2} + i 2 \int_{-1}^1 dx \frac{\sqrt{1-x^2}}{2+x^2}$$
Note that I have ignored the small semicircular and circular contours, as the integrals around those vanish as their radii vanish.  Also, I have skipped over the step of assigning a phase to each branch of the square root along $[-1,1]$.  
The contour integral is also equal to $i 2 \pi$ times the residue of the poles inside $C$, which are at $z=\sqrt{2} e^{\pm i \pi/2}$.  Thus, taking the limit as $R \to \infty$, we get
$$i 2 \pi + i 2 \int_{-1}^1 dx \frac{\sqrt{1-x^2}}{2+x^2} = i 2 \pi \left (\frac{i \sqrt{3}}{i \sqrt{2}} +  \frac{-i \sqrt{3}}{-i \sqrt{2}} \right ) = i \sqrt{6} \pi $$
Putting this altogether, we get
$$\int_{-1}^1 dx \frac{\sqrt{1-x^2}}{2+x^2} = \left (\sqrt{6}-2 \right ) \frac{\pi}{2} $$
and therefore, the original integral is equal to

$$\int_0^1 dx \frac{\sqrt{x-x^2}}{x+2} = \left (\frac{5}{2}-\sqrt{6} \right ) \pi $$

A: Letting $x=u^2, dx=2udu$ gives $\displaystyle2\int_0^1\frac{u^2\sqrt{1-u^2}}{u^2+2}du$; then letting $u=\sin\theta, du=\cos\theta d\theta$ gives
$\displaystyle2\int_0^{\pi/2}\frac{\sin^2\theta\cos^2\theta}{\sin^2\theta+2}d\theta=2\int_0^{\pi/2}\frac{\tan^2\theta\sec^2\theta}{(\sec^4\theta)(3\tan^2\theta+2)}d\theta=2\int_0^{\infty}\frac{t^2}{(t^2+1)^2(3t^2+2)}dt$ [$t=\tan\theta$]
$\displaystyle=2\int_0^{\infty}\left(\frac{2}{t^2+1}+\frac{1}{(t^2+1)^2}-\frac{6}{3t^2+2}\right)du=2\left[\frac{5}{2}\tan^{-1}t+\frac{t}{2(t^2+1)}-\sqrt{6}\tan^{-1}\frac{\sqrt{6}t}{2}\right]_0^{\infty}$
$\displaystyle=5\cdot\frac{\pi}{2}-2\sqrt{6}\cdot\frac{\pi}{2}=\big(5-2\sqrt{6}\big)\frac{\pi}{2}$.
A: Substituting $x=\frac{1+\cos(\theta)}2$ and $z=e^{i\theta}$, we can compute this integral as a contour integral around the unit circle:
$$
\begin{align}
\int_0^1\frac{\sqrt{x-x^2}}{x+2}\,\mathrm{d}x
&=\frac12\int_0^\pi\frac{\sin^2(\theta)}{5+\cos(\theta)}\,\mathrm{d}\theta\\
&=\frac14\int_0^{2\pi}\frac{\sin^2(\theta)}{5+\cos(\theta)}\,\mathrm{d}\theta\\
&=-\frac1{8i}\oint\frac{z^2-2+\frac1{z^2}}{z+10+\frac1z}\frac{\mathrm{d}z}z\\
&=-\frac1{8i}\oint\frac{z^4-2z^2+1}{z^2+10z+1}\frac{\mathrm{d}z}{z^2}\\[3pt]
&=-\frac1{8i}\oint\left(\color{#0000F0}{1+\frac1{z^2}}\color{#00A000}{-\frac{10}z+\frac{4\sqrt6}{z+5-\sqrt{24}}}\color{#C00000}{-\frac{4\sqrt6}{z+5+\sqrt{24}}}\right)\,\mathrm{d}z\\[6pt]
&=-\frac\pi4\left(\color{#00A000}{-10+4\sqrt6}\right)\\[6pt]
&=\pi\,\frac{5-2\sqrt6}2
\end{align}
$$
The terms in blue have no residue and the pole of the term in red is outside the unit circle; therefore, we need only consider the terms in green.
A: Let us make the problem a bit more general considering $$I=\int \frac{\sqrt{x-x^2}}{x+a}dx$$ and let us apply the same approach Mario G proposed. We then arrive to $$\begin{align*}
I=\int\frac{\sqrt{x-x^2}}{x+2}dx
&=\frac{1}{2}\int\frac{\cos^2( t)}{\sin t+(2a+1)}\,dt\\
\end{align*}$$ Now, let use the tangent half-angle substitution $y=\tan(\frac t2)$
$$I=\int\frac{ \left(y^2-1\right)^2}{\left(y^2+1\right)^2 \left((2 a+1) y^2+2
   y+(2 a+1)\right)}\,dy$$ Now, partial fraction decomposition which gives for the integrand $$\frac{2 a+1}{y^2+1}-\frac{2
   y}{\left(y^2+1\right)^2}-\frac{4 a\left(a+1\right)}{(2 a+1)y^2+2y+(2 a+1) }$$
Integrating the different species, we then arrive to $$I=(2 a+1) \tan ^{-1}(y)+\frac{1}{y^2+1}-2 \sqrt{a(a+1)} \tan ^{-1}\left(\frac{(2 a+1) y+1}{2 \sqrt{a(a+1)}}\right)$$
A: Let $x=\frac{1}{2}\sin t+\frac{1}{2}$, then we have
\begin{align*}
\int_0^1\frac{\sqrt{x-x^2}}{x+2}dx&=\int_0^1\frac{\sqrt{\left(\frac{1}{2}\right)^2-\left(x-\frac{1}{2}\right)^2}}{x+2}dx\\
&=\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{\sqrt{\left(\frac{1}{2}\right)^2-\left(\frac{1}{2}\sin t\right)^2}}{\frac{1}{2}\sin t+\frac{1}{2}+2}\frac{1}{2}\cos t\,dt\\
&=\frac{1}{2}\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{\cos t}{\sin t+5}\cos t\,dt\\
\end{align*}
A: $\displaystyle\int_0^1\frac{x^{1/2}(1-x)^{1/2}}{x+2}dx=\int_0^1\sum_{n=0}^{\infty}(-1)^n\frac{x^n}{2^{n+1}}x^{1/2}(1-x)^{1/2}dx=\sum_{n=0}^{\infty}\frac{(-1)^n}{2^{n+1}}\int_0^1x^{n+\frac{1}{2}}(1-x)^{\frac{1}{2}}dx$
$\displaystyle=\sum_{n=0}^{\infty}\frac{(-1)^n}{2^{n+1}}\beta(n+\frac{3}{2},\frac{3}{2})=\sum_{n=0}^{\infty}\frac{(-1)^n}{2^{n+1}}\frac{\Gamma(n+\frac{3}{2})\Gamma(\frac{3}{2})}{\Gamma(n+3)}=\sum_{n=0}^{\infty}\frac{(-1)^n}{2^{n+3}(n+2)!}(2n+1)\bigg(\frac{(2n)!}{4^nn!}\sqrt{\pi}\bigg)(\sqrt{\pi})$
$\displaystyle=\frac{\pi}{2}\sum_{n=0}^{\infty}(-1)^n\frac{(2n+1)!}{2^{3n+2}(n+2)!n!}=-\frac{\pi}{2}\sum_{n=0}^{\infty}\left(-\frac{1}{8}\right)^{n+1}\frac{1}{n+2}\binom{2n+2}{n+1}$.
Using the generating function for the Catalan numbers, this equals
$\displaystyle-\frac{\pi}{2}\left[\frac{1-\sqrt{1-4x}}{2x}-1\right]_{x=-\frac{1}{8}}=-\frac{\pi}{2}\left[\frac{1-\sqrt{\frac{3}{2}}}{-\frac{1}{4}}-1\right]=\frac{\pi}{2}\left[5-2\sqrt{6}\right]$
