<s>[INST] Show that $\int_0^{\pi/2}\frac{|ab|dx}{a^{2}\cos^{2}x + b^{2}\sin^{2}x} = \frac{\pi}{2}$ I have tried out the tangent half angle substitution $\tan\frac{x}{2} = t$, which reduces the integrand to a rational expression. However, it appears to me that a more elegant solution is lurking round the corner. Any hints?
 [/INST] 
NOTE $1$:
  For $a=b$, the result is trivial.  Therefore, we will assume $a\ne b$ herein.



NOTE $2$:
Although this integral can be easily evaluated since the integrand has a closed-form anti-derivative, I thought it would be instructive to apply the method of contour integration to see the application of a powerful analytical tool in action.


First we use (i) $\cos^2x=\frac12(1+\cos 2x)$, (ii) $\sin^2 x=\frac12(1-\cos 2x)$, and (iii) the evenness and $2\pi$-periodicity of the cosine, to write the integral of interest $I(a,b)$ as
$$\begin{align}
I(a,b)&=\int_0^{\pi/2}\frac{|ab|}{a^2\cos^2x+b^2\sin^2x}\,dx\\\\
&=\frac{|ab|}{2}\int_0^{2\pi}\frac{1}{(a^2+b^2)-(b^2-a^2)\cos x}\,dx
\end{align}$$
Moving to the complex plane, we let $z=e^{ix}$ so that $dz=\frac{1}{iz}\,dz$.  Then, we have
$$\begin{align}
I(a,b)&=\frac{|ab|}{2}\oint_{|z|=1}\frac{1}{(a^2+b^2)+(a^2-b^2)\left(\frac{z+z^{-1}}{2}\right)}\,\frac{1}{iz}dz\\\\
&=\frac{|ab|}{i(a^2-b^2)}\oint_{|z|=1}\frac{1}{z^2+2\frac{a^2+b^2}{a^2-b^2}z+1}\,dz\\\\
&=\frac{2\pi |ab|}{(a^2-b^2)}\text{Res}\left(\frac{1}{z^2+2\frac{a^2+b^2}{a^2-b^2}z+1}\right)\\\\
&=
\begin{cases}
\frac{2\pi |ab|}{(a^2-b^2)}\frac{1}{\frac{4|ab|}{|a^2-b^2|}}=\pi/2&,a>b\\\\
\frac{2\pi |ab|}{(a^2-b^2)}\frac{-1}{\frac{4|ab|}{|a^2-b^2|}}=\pi/2&,a<b
\end{cases}
\end{align}$$
Therefore, for all $a$ and $b$, we have
$$\bbox[5px,border:2px solid #C0A000]{\int_0^{\pi/2}\frac{|ab|}{a^2\sin^2 x+b^2 \cos ^2 x}\,dx=\frac{\pi}{2}}$$
as was to be shown!
</s>