Evaluating $\int\frac{dx}{(a\sin x+ b\cos x)^2}$, $a\neq 0.$ Could you just show the hint to solve this integral, please? 
 A: Hint. One may write
$$
\int\frac{dx}{(a\sin x+ b\cos x)^2}=\int\frac{1}{(a\tan x+b)^2}\frac{dx}{(\cos x)^2}=\int\frac{du}{(a\:u+b)^2}
$$ with the change of variable $u=\tan x$.
A: Another way using the tangent half-angle subsitution
$$\int\frac{dx}{(a\sin x+ b\cos x)^2}=2\int\frac{2 \left(t^2+1\right)}{\left(2 a t-b t^2+b\right)^2}\,dt=-\frac{2 t}{b \left(-2 a t+b t^2-b\right)}$$
A: $\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{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\Li}[1]{\,\mathrm{Li}_{#1}}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

With $\ds{\tan\pars{\mu} \equiv {b \over a}}$:

\begin{align}
&\color{#f00}{\int{\dd x \over \bracks{a\sin\pars{x} + b\cos\pars{x}}^{\, 2}}} =
{1 \over a^{2}}\int{\dd x \over \bracks{\sin\pars{x} + \tan\pars{\mu}\cos\pars{x}}^{\, 2}}
\\[4mm] = &\
{1 \over a^{2}\sec^{2}\pars{\mu}}\int{\dd x \over \sin^{2}\pars{x + \mu}} =
{1 \over a^{2} + b^{2}}\int\csc^{2}\pars{x + \mu}\,\dd x =
-\,{1 \over a^{2} + b^{2}}\,{1 \over \tan\pars{x + \mu}}
\\[4mm] = &\
-\,{1 \over a^{2} + b^{2}}\,
{1 - \tan\pars{\mu}\tan\pars{x} \over \tan\pars{x} + \tan\pars{\mu}} =
\color{#f00}{{1 \over a^{2} + b^{2}}\,
{b\tan\pars{x} - a \over a\tan\pars{x} + b}} + \pars{~\mbox{a constant}~}
\end{align}
