<s>[INST] How to integrate $f(x) = \frac{1}{a + b \cos x + c \sin x }$ over $x \in (0,\pi/2)$ 
Conjecture 1
    $$ \begin{align*} I_{T}=\int_0^{2\pi} \frac{\mathrm{d}x}{a + b \cos x + c
 \sin x} & = \frac{2\pi}{\rho} \tag{1} \\ I_{T/4} = \int_0^{\pi/2} \frac{\mathrm{d}x}{a +
 b \cos x + c \sin x} & =  \frac{2}{\rho} \arctan \left(\frac{\rho}{a+b+c}\right)\tag{2}
 \end{align*} $$
  Where $\rho^2 = a^2-b^2 -c^2$.



*

*Is this result correct, and does it cover all cases? 

*Does the result above cover all cases - what if the denominator becomes a perfect square? 

*When does the integral converge?



I am mainly posting this so that i can close all the duplicates in
   the future. Integrals related to these seems to pop up regularly. 
 [/INST] Assuming $b^2+c^2<a^2$ and expressing $\sin(x)$ and $\cos(x)$ in terms of $\tan(x/2)$ we have:
$$I_{T/4}=2\int_{0}^{1}\frac{dt}{a(1+t^2)+b(1-t^2)+c(2t)}=2\int_{0}^{1}\frac{dt}{(a-b)t^2+2ct+(a+b)}.$$
Since the discriminant of $p(t)=(a-b)t^2+2ct+(a+b)$ is negative by the initial assumptions, $p(t)$ does not vanish on $[0,1]$. Assuming $a>b$, we have:
$$\begin{eqnarray*}I_{T/4}&=&2(a-b)\int_{0}^{1}\frac{dt}{(a-b)^2 t^2 + 2c(a-b)x + (a^2-b^2)}\\&=&2(a-b)\int_{0}^{1}\frac{dt}{\left((a-b)t+c\right)^2+\rho^2}\\&=&2\int_{0}^{a-b}\frac{dt}{(t+c)^2+\rho^2}=2\int_{c}^{a-b+c}\frac{dt}{t^2+\rho^2}\\&=&\left.\frac{2}{\rho}\arctan\frac{t}{\rho}\right|_c^{a+b-c},\end{eqnarray*}$$
so:
$$ I_{T/4}=\frac{2}{\rho}\left(\arctan\frac{a+b-c}{\rho}-\arctan\frac{c}{\rho}\right)$$
and since $\arctan x-\arctan y=\arctan\frac{x-y}{1+xy}$ the last formula can be put into the form:
$$ I_{T/4}=\frac{2}{\rho}\arctan\frac{\frac{a+b-2c}{\rho}}{1+\frac{c(a+b-c)}{\rho^2}}.$$
</s>