Prove that $ \int_0^{\pi} \frac{(\cos x)^2}{1 + \cos x \sin x} \,\mathrm{d}x =\int_0^{\pi} \frac{(\sin x)^2}{1 + \cos x \sin x} \,\mathrm{d}x $ In a related question the following integral was evaluated
$$ 
      \int_0^{\pi} \frac{(\cos x)^2}{1 + \cos x \sin x} \,\mathrm{d}x
     =\int_0^{\pi} \frac{\mathrm{d}x/2}{1 + \cos x \sin x} 
     =\int_0^{2\pi}  \frac{\mathrm{d}x/2}{2 + \sin x} \,\mathrm{d}x
     =\int_{-\infty}^\infty \frac{\mathrm{d}x/2}{1+x+x^2}
$$
I noticed something interesting, namely that
$$ 
\begin{align*}
        \int_0^{\pi} \frac{(\cos x)^2}{1 + \cos x \sin x} \,\mathrm{d}x
    & = \int_0^{\pi} \frac{(\sin x)^2}{1 + \cos x \sin x} \,\mathrm{d}x \\
    & = \int_0^{\pi} \frac{(\cos x)^2}{1 - \cos x \sin x} \,\mathrm{d}x
      = \int_0^{\pi} \frac{(\sin x)^2}{1 - \cos x \sin x} \,\mathrm{d}x
\end{align*}
$$
The same trivially holds if the upper limits are changed to $\pi/2$ as well ($x \mapsto \pi/2 -u$).
But I had problems proving the first equality. Does anyone have some quick hints?

Subtract the two integrals in question and get
$$\int_0^{\pi} dx \frac{\cos{2 x}}{1+\frac12 \sin{2 x}} = \frac12 \int_0^{2 \pi} du \frac{\cos{u}}{1+\frac12 \sin{u}}$$
This may be shown to be equal to  the complex integral
$$-\frac{i}{4} \oint_{|z|=1} \frac{dz}{z} \frac{z+z^{-1}}{1+\frac{1}{4 i} (z-z^{-1})}  = \oint_{|z|=1}\frac{dz}{z} \frac{z^2+1}{z^2+i 4 z-1}$$
The poles of the integrand within the unit circle are at $z=0$ and $z=-(2-\sqrt{3}) i$; their respective residues are $-1$ and $1$.  By the residue theorem, therefore, the integral is zero and the two original integrals are equal.
