Evaluate $I_n=\int_0^{\pi/2} \frac{1}{\left( a\cos^2x+b\sin^2x\right)^n} \, dx$ I would like to evaluate (using elementary methods if possible)   : (for $a>0,\ b>0$)

$$
I_n=\int_0^{\pi/2} \frac{1}{( a\cos^2x+b\sin^2x)^n} \, dx,\quad \ n=1,2,3,\ldots
$$
I thought about using $u=\tan(x)$ or $u=\frac{\pi}{2}-x$ but did not work. wolfram alpha evaluates the indefinite integral  but not definite integral???


This is not an answer but it is too long for a comment.
For the antiderivative, Wolfram Alpha (and other CAS) return, for $$J_n(x)=(n-1)(a-b) I_n(x)$$s the messy expression
$$2^{n-1} \csc (2 x) \sqrt{\frac{(a-b) \sin ^2(x)}{a}} \sqrt{\frac{(b-a) \cos ^2(x)}{b}}$$ $$
   ((a-b) \cos (2 x)+a+b)^{1-n}$$ $$
   F_1\left(1-n;\frac{1}{2},\frac{1}{2};2-n;\frac{a+b+(a-b) \cos (2 x)}{2
   b},\frac{a+b+(a-b) \cos (2 x)}{2 a}\right)$$ where appears
The problem is that both $J_n\left(\frac{\pi }{2}\right)$ and $J_n\left(0\right)$ result in indeterminate forms and that the limits need to be worked.
These would be
$$J_n\left(\frac{\pi }{2}\right)=-\frac{\sqrt{\pi } \sqrt{1-\frac{a}{b}} \sqrt{1-\frac{b}{a}}\, b^{1-n}\, \Gamma (2-n)}{2
  \, \Gamma \left(\frac{3}{2}-n\right)}\, _2F_1\left(\frac{1}{2},1-n;\frac{3}{2}-n;\frac{b}{a}\right)$$
$$J_n\left(0\right)=\frac{\sqrt{\pi } \sqrt{1-\frac{a}{b}} \sqrt{1-\frac{b}{a}} \,a^{1-n}\, \Gamma (2-n)}{2\,
   \Gamma \left(\frac{3}{2}-n\right)}\, \, _2F_1\left(\frac{1}{2},1-n;\frac{3}{2}-n;\frac{a}{b}\right)$$
Have fun !
