How do I go about solving this? I have tried substitution, but it is not working for me.
$$
\int_0^\pi \frac{dx}{\sqrt{(n^2+1)}+\sin(x)+n\cos(x)}=\int_0^\pi \frac{n dx}{\sqrt{(n^2+1)}+n\sin(x)+\cos(x)}=2
$$
General form of this integral is
$$
\int_0^\pi \frac{dx}{\sqrt{(n^2+m^2)}+m\sin(x)+n\cos(x)}=\frac{2}{m}
$$
 A: First of all:
$$
(\sqrt{n^2+1}+\sin x+n\cos x)(\sqrt{n^2+1}-\sin x-n\cos x)=$$
$$
=n^2+1-n^2\cos^2x-2n\cos x\sin x-\sin^2 x=
$$
$$
=\cos^2x-2n\cos x\sin x+n^2\sin^2 x=(n\sin x-\cos x)^2
$$
So:
$$
\int\frac{\mathrm{d}x}{\sqrt{n^2+1}+\sin x+n\cos x}=\int\frac{(\sqrt{n^2+1}-\sin x-n\cos x)\mathrm{d}x}{(n\sin x-\cos x)^2}
$$
Now use the formula:
$$
\theta=\arctan\frac{b}{a}\qquad a\cos x+b\sin x=\sqrt{a^2+b^2}{\cos(x+\theta)}
$$
To finish this up.
Result:
$$
\int\frac{\mathrm{d}x}{\sqrt{n^2+1}+\sin x+n\cos x}=\frac{1-\sqrt{n^2+1} \sin (x)}{n \sin (x)-\cos (x)}$$
$$\int\frac{n\mathrm{d}x}{\sqrt{n^2+1}+n\sin x+\cos x}=\frac{\sqrt{n^2+1} \sin (x)-n}{n \cos (x)-\sin (x)}$$
A: This seems so easy in polar form. Let $1=r\cos\phi$, $n=r\sin\phi$, then $r=\sqrt{1+n^2}$, $\phi=\tan^{-1}n$ and then let $x+\phi=y+\frac{\pi}2$
$$\begin{align}\int_0^{\pi}\frac{dx}{\sqrt{1+n^2}+\sin x+n\cos x}&=\int_0^{\pi}\frac{dx}{\sqrt{1+n^2}(1+\sin(x+\phi))}\\
&=\int_{-\frac{\pi}2+\phi}^{\frac{\pi}2+\phi}\frac{dy}{\sqrt{1+n^2}(1+\cos y)}\\
&=\left.\frac{\sin y}{\sqrt{1+n^2}(1+\cos y)}\right|_{-\frac{\pi}2+\phi}^{\frac{\pi}2+\phi}\\
&=\frac1{\sqrt{1+n^2}}\left(\frac{\cos\phi}{1-\sin\phi}+\frac{\cos\phi}{1+\sin\phi}\right)\\
&=\frac1{\sqrt{1+n^2}}\left(\frac1{\sqrt{1+n^2}-n}+\frac1{\sqrt{1+n^2}+n}\right)\\
&=2\end{align}$$
The second integral, after the substitution $y=x-\phi$ becomes
$$\begin{align}\int_0^{\pi}\frac{n\,dx}{\sqrt{1+n^2}+n\sin x+\cos x}&=\int_0^{\pi}\frac{n\,dx}{\sqrt{1+n^2}(1+\cos(x-\phi))}\\
&=\int_{-\phi}^{\pi-\phi}\frac{n\,dy}{\sqrt{1+n^2}(1+\cos y)}\\
&=2\end{align}$$
A: Let
$$
I_1=\int_0^\pi \frac{dx}{\sqrt{n^2+1}+\sin(x)+n\cos(x)}, I_2=\int_0^\pi \frac{n dx}{\sqrt{n^2+1}+n\sin(x)+\cos(x)}.
$$
Let $u=\tan\frac{x}{2}$. Then $x=2\arctan u$, $\sin x=\frac{2u}{1+u^2},\cos x=\frac{1-u^2}{1+u^2}$. Thus
\begin{eqnarray}
I_1&=&\int_0^\infty \frac{1}{\sqrt{n^2+1}+\frac{2u}{1+u^2}+n\frac{1-u^2}{1+u^2}}\frac2{1+u^2}du\\
&=&2\int_0^\infty \frac{1}{\sqrt{n^2+1}(1+u^2)+2u+n(1-u^2)}du\\
&=&2\int_0^\infty \frac{1}{(\sqrt{n^2+1}-n)u^2+2u+(\sqrt{n^2+1}+n)}dx\\
&=&2\int_0^\infty \frac{\sqrt{n^2+1}+n}{u^2+2(\sqrt{n^2+1}+n)u+(\sqrt{n^2+1}+n)^2}du\\
&=&2\int_0^\infty \frac{\sqrt{n^2+1}+n}{(u+\sqrt{n^2+1}+n)^2}du\\
&=&2.
\end{eqnarray}
Similarly
$$ I_2=2. $$
Done.
