Integral $\int_0^{\pi/4}\frac{dx}{{\sin 2x}\,(\tan^ax+\cot^ax)}=\frac{\pi}{8a}$ I am trying to prove this interesting integral$$
\mathcal{I}:=\int_0^{\pi/4}\frac{dx}{{\sin 2x}\,(\tan^ax+\cot^ax)}=\frac{\pi}{8a},\qquad \mathcal{Re}(a)\neq 0.
$$
This result is breath taking but I am more stumped than usual.  It truly is magnificent.  I am not sure how to approach this,
note $\sin 2x=2\sin x \cos x$.  I am not sure how to approach this because of the term
$$
(\tan^ax+\cot^ax)
$$
in the denominator.  I was trying to use the identity 
$$
\tan \left(\frac{\pi}{2}-x\right)=\cot x
$$
since this method solves a similar kind of integral but didn't get anywhere.    A bad idea I tried was to try and differentiate with respect to a
$$
\frac{dI(a)}{da}=\int_0^{\pi/4}\partial_a \left(\frac{dx}{{\sin 2x}\,(\tan^ax+\cot^ax)}\right)=\int_0^{\pi/4}  \frac{(\cot^a x \log(\cot x )+\log(\tan x ) \tan^a x)}{\sin 2x \, (\cot^a x+\tan^a x)^2}dx
$$
which seems more complicated when I break it up into two integrals.  How can we solve the integral?  Thanks.
 A: Start with $\tan x=t$ and then $t^a=\tan u$. You could have used them together but this looks better. All terms beautifully(as planned), cancel, giving : 
$$\int_0^{\dfrac {\pi}{4}}\dfrac{1}{2a}du$$
I have no idea how to do this one though.
A: Rewrite:
\begin{align}
\int_0^{\Large\frac\pi4}\frac{dx}{{\sin 2x}\,(\tan^ax+\cot^ax)}&=\int_0^{\Large\frac\pi4}\frac{dx}{{2\sin x\cos x}\,\left(\tan^ax+\dfrac1{\tan^ax}\right)}\\
&=\frac12\int_0^{\Large\frac\pi4}\frac{\tan^ax\ dx}{{\tan x\cos^2x}\,\left(1+\tan^{2a}x\right)}\\
&=\frac12\int_0^{\Large\frac\pi4}\frac{\tan^{a-1}x\ d(\tan x)}{1+\tan^{2a}x}.
\end{align}
Now, let $\tan^a x=\tan\theta\;\Rightarrow\;a\tan^{a-1}x\ d(\tan x)=\sec^2\theta\ d\theta$. Then
\begin{align}
\frac12\int_{x=0}^{\Large\frac\pi4}\frac{\tan^{a-1}x\ d(\tan x)}{1+\tan^{2a}x}&=\frac1{2|a|}\int_{\theta=0}^{\Large\frac\pi4}\frac{\sec^2\theta\ d\theta}{1+\tan^{2}\theta}\\
&=\frac1{2|a|}\int_{\theta=0}^{\Large\frac\pi4}\ d\theta\\
&=\large\color{blue}{\frac{\pi}{8|a|}}.
\end{align}
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{{\cal I}\equiv\int_{0}^{\pi/4}{\dd x \over \sin\pars{2x}\bracks{\tan^{a}\pars{x} + \cot^{a}\pars{x}}}={\pi \over 8\verts{a}},\qquad \Re\pars{a} \neq 0}$.
Note that the integral depends obviously on $\ds{\large\verts{a}}$.

\begin{align}
{\cal I}&=\half\
\overbrace{\int_{0}^{\pi/2}{\dd x \over \sin\pars{x}
\bracks{\tan^{\verts{a}}\pars{x/2} + \cot^{\verts{a}}\pars{x/2}}}}
^{\ds{t \equiv \tan\pars{x \over 2}}}
\\[3mm]&=\half\int_{0}^{1}{2\,\dd t/\pars{1 + t^{2}}
\over \bracks{2t/\pars{1 + t^{2}}}\pars{t^{\verts{a}} + t^{-\verts{a}}}}
=\half\ \overbrace{\int_{0}^{1}
{t^{\verts{a} - 1} \over t^{2\verts{a}} + 1}\,\dd t}
^{\ds{t^{\verts{a}} \equiv x}\ \imp\ t = x^{1/\verts{a}}}
\\[3mm]&=\half\int_{0}^{1}{ \pars{x^{1/\verts{a}}}^{\verts{a} - 1} \over x^{2} + 1}\,{1 \over \verts{a}}\,x^{1/\verts{a} - 1}\dd x
={1 \over 2\verts{a}}\ \overbrace{\int_{0}^{1}{\dd x \over x^{2} + 1}}
^{\ds{=\ {\pi \over 4}}}
\end{align}

$$\color{#00f}{\large%
{\cal I}\equiv\int_{0}^{\pi/4}{\dd x \over \sin\pars{2x}\bracks{\tan^{a}\pars{x} + \cot^{a}\pars{x}}}={\pi \over 8\verts{a}}}\,,\qquad\Re\pars{a} \not= 0
$$
