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?


$$I=\int_0^{\pi} \frac{(\cos x)^2}{1 + \cos x \sin x} \,\mathrm{d}x$$
  $$J=\int_0^{\pi/2} \frac{(\cos x)^2}{1 + \cos x \sin x} \,\mathrm{d}x$$


Use $\int_a^b f(x)dx=\int_a^nf(a+b-x)dx$ and $\int_0^{2a}f(x)dx=\int_0^a f(x)dx+f(2a-x)dx$

$$I=\int_0^{\pi/2} \frac{(\cos (\pi-x))^2}{1 + \cos (\pi-x) \sin (\pi-x)} \,\mathrm{d}x+\frac{(\cos x)^2}{1 + \cos x \sin x} \,\mathrm{d}x$$
$$I=\int_0^{\pi/2} \frac{(\cos x)^2}{1 - \cos x \sin x} \,\mathrm{d}x+\frac{(\cos x)^2}{1 + \cos x \sin x} \,\mathrm{d}x$$
$$I=\int_0^{\pi/2} \frac{(\cos (\pi/2-x))^2}{1 - \cos (\pi/2-x) \sin (\pi/2-x)} \,\mathrm{d}x+\frac{(\cos (\pi/2-x))^2}{1 + \cos (\pi/2-x) \sin (\pi/2-x)} \,\mathrm{d}x$$
$$I=\int_0^{\pi/2} \frac{(\sin x)^2}{1 - \sin x \cos x} \,\mathrm{d}x+\frac{(\sin x)^2}{1 + \cos x \sin x} \,\mathrm{d}x$$
$$I=\int_0^{\pi/2} \frac{(\sin x)^2}{1 - \sin x \cos x} \,\mathrm{d}x+\frac{(\sin (\pi-x))^2}{1 - \cos (\pi-x) \sin(\pi-x)} \,\mathrm{d}x$$
$$I=\int_0^{\pi} \frac{(\sin x)^2}{1 - \sin x \cos x} \,\mathrm{d}x$$

Hope you can now show that:
$$J=\int_0^{\pi/2} \frac{(\cos x)^2}{1 + \cos x \sin x} \,\mathrm{d}x=\int_0^{\pi/2} \frac{(\cos (\pi/2-x))^2}{1 + \cos (\pi/2-x) \sin (\pi/2-x)} \,\mathrm{d}x=\int_0^{\pi/2} \frac{(\sin x)^2}{1 + \sin x \cos x} \,\mathrm{d}x$$
