Dilemma evaluating integral after sinusoidal substitution To solve the definite integral 
$$ I = \int_{-a}^{a} \frac{dx}{\pi \sqrt{a^2-x^2}}$$ 
I used the substitution $x = a \sin \theta$ and tried to solve the integral without its interval definition, which yields
$$ I = \frac{\theta}{\pi} $$
Now according to what I have been taught, from this point on I can do either of two things:


*

*write the result in terms of $x$ and evaluate with the initial limits; or

*transform $x$'s limits into limits for $\theta$ and evaluate.


Selecting the first option listed, the result of the evaluation is 1, but selecting the second option I get as result
$$ x = a \Rightarrow \theta = \frac{\pi}{2} + 2\pi n$$
$$x=-a\Rightarrow \theta = \frac{3 \pi}{2} + 2 \pi k$$
$$ I = \frac{\theta}{\pi} = \left(\frac{1}{2} + 2n\right) - \left(\frac{3}{2} + 2k \right) = 2(n-k)-1$$
(where $n$ and $k$ are integers.) Why would $n-k=1$ so this result would also be correct?
 A: Assuming $a\gt0$, here is the result of your substitution
$$
\begin{align}
I
&=\int_{-a}^a\frac{\mathrm{d}x}{\pi\sqrt{a^2-x^2}}\\
&=\int_{-\pi/2}^{\pi/2}\frac{a\cos(\theta)\,\mathrm{d}\theta}{\pi a\cos(\theta)}\\
&=\int_{-\pi/2}^{\pi/2}\frac{\mathrm{d}\theta}{\pi}\\
\end{align}
$$
You have to change the limits to match the change of variable. That is, as $x$ varies from $-a$ to $a$, $\theta$ varies from $-\pi/2$ to $\pi/2$. Note that $\cos(\theta)$ is positive over this range, so $\sqrt{a^2-x^2}=a\cos(\theta)$.

Changing direction of the parameterization
It is possible to use the interval $[\pi/2,3\pi/2]$, as long as you match things up. We then use $x=-a\sin(\theta)$ and $\sqrt{a^2-x^2}=-a\cos(\theta)$
$$
\begin{align}
I
&=\int_{-a}^a\frac{\mathrm{d}x}{\pi\sqrt{a^2-x^2}}\\
&=\int_{\pi/2}^{3\pi/2}\frac{-a\cos(\theta)\,\mathrm{d}\theta}{-\pi a\cos(\theta)}\\
&=\int_{\pi/2}^{3\pi/2}\frac{\mathrm{d}\theta}{\pi}\\
\end{align}
$$
A: The Problem is, you have to exactly specify the bijection (one-to-one and onto) used for the substitution.
$$u(\theta) = a \sin(\theta)$$
maps bijective to $[-a,a]$ for several choices of ${\rm Dom}_u$. The most straight-forward of these is
$$u: \left [-\frac{\pi}{2}, \frac{\pi}{2}\right ] \to [-a,a]$$
But the only limitations on the domain are


*

*$\left.\sin\right|_D$ must be a bijection

*If $D = [d_0, d_1]$ then $\sin(d_0) \in \{-1,1\} \ni \sin(d_1) \neq \sin(d_0)$ so that the endpoints $u(d_0), u(d_1) \in \{-a,a\}$ and by intermediate value theorem $u(D) = [-a,a]$ since $\sin(D) = [-1,1]$


So to find the range of theta start with a maximum at $\sin(d_0)$, i.e.
$$\cos(d_0) = 0 \Leftrightarrow d_0 = \frac{\pi}{2} + k\pi, \qquad k\in \mathbb{Z}$$
and take an interval of length $\pi$, so that $\sin(d_1) = \sin(d_0 + \pi) = -\sin(d_0)$. You get
$$D = [\frac{\pi}{2} + k\pi, \frac{\pi}{2} + (k+1) \pi]$$
In your above notation $"n-k" = (k+1)-k = 1$ so your two solutions are the same (correct).
