Integral Question $$
\int _{\large{ -\frac { \pi  }{ 2 } } }^{\large{ \frac { \pi  }{ 2 } } }{ \frac { \mathrm{d}x }{ \sin x-2\cos x+3 }  } 
$$
Wolframalpha suggests to evaluate indefinite integral by substituting $u = \tan(\frac { x }{ 2 })$. Is there a more basic way to evaluate this definite integral?
 A: There is another way to deal with this, but it's a special-case trick and may never serve you again. But here goes: when you see $$A\sin(x) + B \cos(x),$$ you can rewrite that as 
$$
K \sin(x + c)
$$
for some constants $K$ and $c$. How? Pick
$$
K = \sqrt{A^2 + B^2};
$$
in your case, that gives you $K = \sqrt{5}$. 
Let 
$$
c = \cos^{-1}(A/K).
$$
In your case, you get $c = 1.107...$ radians. 
Now check: if $\sin(c)$ has the same sign as $B$, leave $c$ as is; if not, negate $c$. 
In your case, $\sin(c) = 0.89...$, so the sign's wrong, and we have to make $c = -1.107...$ radians. But I'm just going to leave it as $-\cos^{-1}(1/\sqrt{5})$, and write it as $c$. 
Alternatively, you can let $c  = atan2(A, B)$, assuming you know about the atan2 function. 
So now your integrand becomes
$$
\frac{dx}{K\sin(x + c) + 3} \\
= \frac{dx}{\sqrt{5}\sin(x + c) + 3}
$$
You can let $u = x + c$ and $du = dx$ to get
$$
\frac{du}{\sqrt{5}\sin(u) + 3}.
$$
Multiply top and bottom by the "conjugate" to get
$$
\frac{(\sqrt{5}\sin(u) -  3 ) du}{5\sin^2(u) - 9}.
$$
Now write $5 \sin^2 u  - 9 = 5(\sin^2 u - 1) - 4 = -5 \cos^2(u) - 4$, so the integrand becomes
$$
-\frac{(\sqrt{5}\sin(u) -  3 ) du}{5\cos^2(u) + 4} \\
= -\frac{\sqrt{5}\sin(u)du}{5\cos^2(u) + 4} + \frac{3 du}{5\cos^2(u) + 4} 
$$
The first part can be addressed with a substitution $v = \cos u$, which produces a logarithm term. 
The second part...well, that's difficult in itself, but only solution is to let $u = \tan^{-1}(x)$. Then $\cos(u) = \dfrac{x}{\sqrt{1 + x^2}}$, so $\cos^2(x) = \dfrac{x^2}{1 + x^2}$, while $du = \frac{1}{1 + x^2} dx$. So the second term becomes
$$
 \frac{3 du}{5\cos^2(u) + 4} \\
= \frac{3}{5\dfrac{x^2}{1 + x^2} + 4} \frac{1}{1 + x^2} dx \\
= \frac{3}{5x^2 + 4(1 + x^2)} dx \\
= \frac{3}{9x^2 + 4} dx \\
= \frac{3/4}{\frac{9}{4}x^2 + 1} dx \\
= \frac{3/4}{(\frac{3}{2}x)^2 + 1} dx
$$
Now letting $z = \frac{3}{2} x$, you've got an arctangent integral, and you should be on your way. 
After all that, the $\tan(t/2)$ substitution seems pretty nice, doesn't it?  :)
Key idea: a linear combination of $\sin(ax)$ and $\cos(ax)$ can be rewritten as $K\sin(ax + c)$ for some $K$ and $c$. 
A: @ Hckr, we propose to calculate the full applying WA and then judge you whether to seek another method:
$u=\tan \frac{x}{2}=>\ dx = \frac{2}{u^2+1}\ du$
$$
\int _{\large{ -\frac { \pi  }{ 2 } } }^{\large{ \frac { \pi  }{ 2 } } }{ \frac { \mathrm{d}x }{ \sin x-2\cos x+3 }  }= \int _{-1}^{1}{ \frac {2 \mathrm{d}u }{ 5u^2+2u+1}  }=\frac{2}{5}\int _{-1}^{1}{ \frac { \mathrm{d}u }{ (u+\frac{1}{5})^2+(\frac{2}{5})^2}  }=$$
$$=\frac{2}{5}\cdot(\frac{2}{5})^{-1} \cdot \tan^{-1}\frac{5u+1}{2}|_{-1}^1=\tan^{-1}3-\tan^{-1}(-2)=\tan^{-1}3+\tan^{-1}2= \frac{3}{4}\pi 
$$
