<s>[INST] Evaluate the indefinite integral $\int \frac{\cos \theta}{ \sqrt{2 - 9 \sin^2 \!\theta}} \mathrm{d}\theta$ I want to evaluate $$\int \dfrac{\cos \theta \, \mathrm{d}\theta}{ \sqrt{2 - 9 \sin^2 \theta}}$$
but I can't seem to get the answer, my working is as below:

 [/INST] Using the substitution $u = \dfrac{\sqrt{2}}{3} \sin \theta \implies \dfrac{\mathrm{d}u}{\mathrm{d}\theta} = \dfrac{\sqrt{2}}{3} \, \cos \theta$. Our integral can be written as $$\int \dfrac{\cos \theta}{ \sqrt{2 - 9 \sin^2 \theta}} \, \frac{\mathrm{d}\theta}{\mathrm{d}u} \mathrm{d}u = \int \dfrac{\cos \theta}{ \sqrt{2 - 9 \sin^2 \theta}} \, \cdot \frac{3 \sec \theta}{\sqrt{2}} \mathrm{d}u$$ 
So $$\dfrac{3}{\sqrt{2}} \int \dfrac{1}{\sqrt{2 - 9 \sin^2 \theta}} \, \mathrm{d}u = \dfrac{3}{\sqrt{2}} \int \dfrac{1}{\sqrt{2 - (81u^2/2)}} \, \mathrm{d}u$$
And hence we get
$$\int \dfrac{3}{\sqrt{2 - (81u^2/2)}} \, \mathrm{d}u = \frac{1}{3} \arcsin \left(\frac{9u}{2}\right) + \mathrm{C}$$.
Back substituting yields
$$\frac{1}{3} \arcsin \left(\frac{3 \sin \theta}{\sqrt{2}}\right) + \mathrm{C}$$
</s>