Problem:
Evaluate the integral $$ \int \sqrt{ a^2 - x^2 } dx. $$
Solution:
Let us put $$ x = a \sin \theta . \tag{0} $$ Then we have $$ dx = a \cos \theta d \theta, \tag{1} $$ and $$ a^2 - x^2 = a^2 \left( 1 - \sin^2 \theta \right) = a^2 \cos^2 \theta. \tag{2} $$ So we have $$ \begin{align} & \ \ \ \int \sqrt{ a^2 - x^2 } dx \\ &= \int \sqrt{ a^2 - a^2 \sin^2 \theta } \, a \cos \theta d \theta \\ &= \int \sqrt{ a^2 \left( 1 - \sin^2 \theta \right) } \, a \cos \theta d \theta \\ &= \int \sqrt{ a^2 \cos^2 \theta }\, a \cos \theta d \theta \\ &= \int \big\lvert a \cos \theta \big\rvert \, a \cos \theta d \theta \\ & \mbox{[ note that for any real number $r$, we have $\lvert r \rvert = \sqrt{r^2}$ ]} \\ &= \int (a \cos \theta ) a \cos \theta d \theta \\ & \mbox{[ we assume that $0 < \theta < \frac{\pi}{2}$ so that $\cos \theta > 0$, } \\ & \qquad \mbox{ and we also assume that $a > 0$ ]} \\ &= \int a^2 \cos^2 \theta d \theta \\ &= a^2 \int \cos^2 \theta d \theta \\ &= a^2 \int \frac{2 \cos^2 \theta }{2} d \theta \\ &= a^2 \int \frac{2 \cos^2 \theta -1 + 1 }{2} d \theta \\ &= a^2 \int \frac{ \cos 2 \theta + 1 }{2} d \theta \\ &= \frac{a^2}{2} \int (\cos 2 \theta + 1) d \theta \\ &= \frac{a^2}{2} \big( \int \cos 2 \theta d \theta + \int d \theta \big). \end{align} $$
Thus we have $$ \int \sqrt{ a^2 - x^2 } dx = \frac{a^2}{2} \big( \int \cos 2 \theta d \theta + \int d \theta \big). \tag{3} $$
Now we evaluate $\int \cos 2 \theta d \theta$ as follows:
Let us put $2 \theta = \psi$. Then we have $$ 2 d \theta = d \psi, $$ and hence $$ d \theta = \frac{1}{2} d \psi. $$ Then $$ \begin{align} \int \cos 2 \theta d \theta &= \int \cos \psi \frac{1}{2} d \psi \\ &= \frac12 \int \cos \psi d \psi \\ &= \frac12 \sin \psi \\ &= \frac12 \sin 2 \theta. \tag{4} \end{align} $$
Now putting the value of $\int \cos 2 \theta d \theta$ from (4) into (3) we get $$ \begin{align} & \ \ \ \int \sqrt{ a^2 - x^2 } dx \\ &= \frac{a^2}{2} \big( \int \cos 2 \theta d \theta + \int d \theta \big) \qquad \mbox{[ using (3) above ]} \\ &= \frac{a^2}{2} \left( \frac12 \sin 2 \theta \ + \theta \right) + C \\ & \qquad \mbox{[ using (4) above; } \\ & \qquad \qquad \mbox{ note that $C$ is an arbitrary constant of integration ]}\\ &= \frac{a^2}{2} \left( \frac12 (2 \sin \theta \cos \theta ) + \theta \right) + C \\ &= \frac{a^2}{2} \big( \sin \theta \cos \theta + \theta \big) + C \\ &= \frac{1}{2} \big( (a \sin \theta) (a \cos \theta) + a^2 \theta \big) +C \\ &= \frac12 \left( x \sqrt{a^2 - x^2} + a^2 \sin^{-1} \frac{x}{a} \right) + C \\ & \qquad \mbox{[ refer to (0) and (2) above; } \\ & \qquad \qquad \mbox{ note that since $x = a \sin \theta$, therefore } \\ & \qquad \qquad \mbox{ we have $\sin \theta = \frac{x}{a}$ and so $\theta = \sin^{-1} \frac{x}{a}$. ] } \\ &= \frac{x}{2} \sqrt{ a^2 - x^2} + \frac{a^2}{2} \sin^{-1} \frac{x}{a} + C. \end{align} $$
Is this procedure correct, clear and rigorous enough?
You obtained the correct answer. However, your assumption that $0 < \theta < \pi/2$ is not necessary.
Since you let $x = a\sin\theta$, where $a > 0$, then $$\theta = \arcsin\left(\frac{x}{a}\right)$$ is defined to be the unique angle in the interval $[-\pi/2, \pi/2]$ such that $\sin\theta = x/a$. Since $\theta \in [-\pi/2, \pi/2]$, $\cos\theta \geq 0$. Hence, $|\cos\theta| = \cos\theta$.