Trigonometric Substiution

I am currently working on a practice problem on trig substitution.

I have no problem solving it my way but I don’t see how i can use the below stated identity and partial integration. (I am sorry i am not using mathjax, im looking into it but it is quite confusing for me)

And here is my solution.

I tried rewriting as 1- sin^2(theta), but when i attempt to use partial integration it just does not solve, and I have no idea how to rewrite it.

X

Integration by parts: $u=cos\theta,\ dv=cos\theta d\theta$, therefore $du=-sin\theta d\theta,\ v=sin\theta$. Result, $\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}cos^2\theta d\theta=\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}sin^2\theta d\theta$, since $cos{-\frac{\pi}{2}}=cos{\frac{\pi}{2}}=0$
$2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}cos^2\theta d\theta=2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}sin^2\theta d\theta$. The two integrals sum to $2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}d\theta=2\pi$.
Therefore the integral in question $=\pi$.