Solve integral $ \int \frac{dx}{( \sin x + 2 \cos x )^3}$ Alright, so this one has been giving me nightmares for a couple of days now... I've tried the substitutes for $u = \tan \frac{x}{2}$ where you can substitute 
sin(x), cos(x) and dx accordingly and pretty much every possibility and combination that came to mind with them and still nothing. I mostly get stuck with a polynomial of the forth or sixth degree and can't really do anything from there. I've also looked up some integral calculator programs which gave me humongous solutions without steps of how to the program got there. Any hint appreciated. 
 A: Hint: You can try writing $\sin(x)+2 \cos(x)=\sqrt{5}(\frac{1}{\sqrt{5}} \sin(x)+\frac{2}{\sqrt{5}} \cos(x))$ And then assigning $\cos(A)$ to either $\frac{1}{\sqrt{5}}$ or $\frac{2}{\sqrt{5}}$ then assigning $\sin(A)$ to the remaining one. Trying to get you to use one of the sum/difference trig identities. Say we let $\cos(A)=\frac{2}{\sqrt{5}}$ and $\sin(A)=\frac{1}{\sqrt{5}}$ Then we can write $\sin(x)+2 \cos(x)$ as $\sqrt{5}\cos(x-A)$ We can come back and solve for the constant $A$ later if we need to; we may not need to depending on our answer. So you should come to the following integral after this $\int \frac{1}{(\sqrt{5})^3} \sec^3(x-A)dx $ Let $u=x-A$ then $\frac{du}{dx}=1$ or $du=dx$ So you have $\frac{1}{5 \sqrt{5}} \int sec^3(u) du$
A: As what randomgirl did by auxiliary angle, I am going to complete the solution for reference.
Letting $\alpha = \arctan (\frac{1}{2})$ changes the denominator into $$
\sin x+2 \cos x=\sqrt{5} \cos (x-\alpha)
$$
which convert the integral into
$$
\begin{aligned}
I &=\int \frac{d x}{(\sin x+2 \cos x)^{3}} \\
&=\int \frac{d x}{\sqrt{5}^{3} \cos ^{3}(x-\alpha)} \\
&=\frac{1}{5 \sqrt{5}} \int \sec ^{3}(x-\alpha) d x
\end{aligned}
$$
Using integration by parts yields
$$
\begin{aligned}
\int \sec ^{3} y d y &=\int \sec y d(\tan y) \\
&=\sec y \tan y-\int \tan ^{2} y \sec y d y \\
&=\sec y \tan y-\int\left(\sec ^{2} y-1\right) \sec y d y \\
\int \sec ^{3} y d y &=\frac{1}{2}(\sec y \tan y+\ln |\sec y+\tan y|)+C
\end{aligned}
$$
Plugging back gives $$
\begin{aligned}
I &=\frac{1}{10 \sqrt{5}}(\sec (x-\alpha) \tan (x-\alpha)+\ln (\sec (x-\alpha)+\tan (x-\alpha))+C\\
&=\frac{1}{10 \sqrt{5}}\left(\frac{\sin (x-\alpha)}{\cos ^{2}(x-\alpha)}-\ln \left|\frac{1+\sin (x-\alpha)}{\cos (x-\alpha)}\right|\right)+C
\end{aligned}
$$
For simplification, using
$$
\sin (x-\alpha) =\sin x \cos \alpha-\sin \alpha \cos x =\frac{1}{\sqrt{5}}(2 \sin x-\cos x)
$$
and $$\sin x+2 \cos x=\sqrt{5} \cos (x-\alpha),$$
we can conclude that
$$
\begin{array}{rl}
I & =\frac{1}{10 \sqrt{5}}\left[\frac{\frac{1}{\sqrt{5}}(2 \sin x-\cos x)}{\frac{1}{5}(\sin x+2 \cos x)^{2}}-\ln \left|\frac{\frac{1}{\sqrt{5}}(2 \sin x-\cos x)}{\left.\frac{1}{\sqrt{5}} \sin x+2 \cos x\right)}\right|\right]+C \\
& =\frac{1}{50}\left[\frac{2 \sin x-\cos x}{(\sin x+2 \cos x)^{2}}-2 \sqrt{5} \ln \left|\frac{2 \sin x-\cos x}{\sin x+2 \cos x}\right|\right]+C
\end{array}
$$
:|D Wish you enjoy the solution!
