compute the following integral $\int^{a}_{-a} \sqrt{a^2-x^2}dx$ I have to compute the following integral:
$\int^{a}_{-a} \sqrt{a^2-x^2}dx$
I did the substitution: $x=a\sin\theta$ so $dx=a\cos\theta d\theta$. The boundaries becomes $\pi/2+2k\pi$ and $-\pi/2-2k\pi$. So:
$\int^{\pi/2+2k\pi}_{-\pi/2-2k\pi} a^2\cos^2\theta d\theta$ becomes the integral.
My question is whether I am doing it correct. Thanks.
 A: You can also observe that the integral represents an area you know.
The equation $y=\sqrt{a^2-x^2}$ can be rewritten as
$$x^2+y^2=a^2 \,;\, y \geq 0$$
A: Let $I=\int\sqrt{a^2-x^2}dx=\sqrt{a^2-x^2}\int dx-\int\left(\frac{\sqrt{a^2-x^2}}{dx}\int dx\right)dx$
$=x\sqrt{a^2-x^2}-\int\left(\frac{(-2x)x}{2\sqrt{a^2-x^2}}\right)dx$
$=x\sqrt{a^2-x^2}-\int\left(\frac{(a^2-x^2-a^2)}{\sqrt{a^2-x^2}}\right)dx$
$=x\sqrt{a^2-x^2}-\int \sqrt{a^2-x^2}dx +a^2\int\frac{dx}{\sqrt{a^2-x^2}}$
$=x\sqrt{a^2-x^2}-I +a|a|\arcsin\frac xa+C$ where $C$ is the indefinite constant for indefinite integration.
Or, $I=\frac{x\sqrt{a^2-x^2}}2+\frac{a|a|}2\arcsin\frac xa+\frac C2$
So, $$\int^{a}_{-a} \sqrt{a^2-x^2}dx=(\frac{x\sqrt{a^2-x^2}}2+\frac{a|a|}2\arcsin\frac xa+C)\mid_{-a}^a=\frac{a|a|}2\{ \arcsin1-\arcsin(-1)\}$$
$$=\frac{a|a|}2\{\frac\pi2-(-\frac\pi2)\}=\frac{\pi a|a|}2$$

Alternatively,
taking $a>0,x=a\sin \theta,dx=a\cos \theta d\theta$
and $\sqrt{a^2-x^2}=|a|\cos \theta=a\cos \theta$ as $a>0$
$$\int^{a}_{-a} \sqrt{a^2-x^2}dx=\int^{\pi/2+2k\pi}_{-\pi/2+2k\pi} (a\cos\theta)^2 d\theta=\frac{a^2}2\int^{\pi/2+2k\pi}_{-\pi/2+2k\pi}(1+\cos2\theta)d\theta$$
$$=\frac{a^2}2(\theta+\frac{\sin2\theta}2)\mid_{-\pi/2+2k\pi}^{\pi/2+2k\pi}$$
$$=\frac{a^2}2\{\frac \pi 2+2k\pi-(-\frac \pi2+2k\pi)\}+\frac{a^2}4(\sin(4k+1)\pi-\sin(4k-1)\pi)=\frac{\pi a^2}2$$
A: Not quite, but you're close. Observe that with that substitution, we have $$\sqrt{a^2-x^2}=|a|\sqrt{1-\sin^2\theta}=|a|\sqrt{\cos^2\theta}=|a||\cos\theta|,$$ so we have $$\int_{-a}^a\sqrt{a^2-x^2}\,dx=a|a|\int_{-2\pi k-\pi/2}^{2\pi k+\pi/2}|\cos\theta|\cos\theta\,d\theta.$$ This isn't very nice, though, since we'd need to split this up over the intervals where $\cos\theta$ is positive and where it's negative to get a convenient integrand.
Now, if instead we let $x=a\sin\theta$ where $\theta$ simply varies from $-\pi/2$ to $\pi/2$, then $|\cos\theta|=\cos\theta$, so $|\cos\theta|\cos\theta=\cos^2\theta=\frac12\bigl(1+\cos(2\theta)\bigr)$, so we get $$\int_{-a}^a\sqrt{a^2-x^2}\,dx=\frac{a|a|}2\int_{-\pi/2}^{\pi/2}1+\cos(2\theta)\,d\theta,$$ which is far easier to deal with. (As for the absolute value around the $a$, we'll deal with that according to the sign of $a$.)
