Integration of $ \int \frac{2\sin x + \cos x}{\sin x + 2\cos x} dx $ How can I integrate this by changing variable?
$$ \int  \frac{2\sin x + \cos x}{\sin x + 2\cos x} dx $$
Thanks.
 A: Notice that in this case by doing some rearrangement
$$\frac{p(x)}{q(x)}=A\frac{q(x)}{q(x)}+B\frac{q'(x)}{q(x)}$$
$$\begin{align}
\int\frac{2\sin x + \cos x}{\sin x + 2\cos x}dx&=-\frac{3}{5}\int\frac{\cos x-2\sin x}{\sin x + 2\cos x}dx+\frac{4}{5}\int\frac{\sin x+2\cos x}{\sin x + 2\cos x}dx\\
\end{align}$$

$$\int\frac{2\sin x + \cos x}{\sin x + 2\cos x}dx=\frac{1}{5}\left(4x-3\log(\sin x+2\cos x)\right)+C$$

A: Let $a$ be such that $(2a)^2+a^2=1$. Let $\theta$ be such that $\cos(\theta)=a$ and $\sin(\theta)=2a$. Then you have
$$
\begin{align}
\int  \frac{2\sin x + \cos x}{\sin x + 2\cos x} dx
&=\int  \frac{2a\sin x + a\cos x}{a\sin x + 2a\cos x} dx\\
&=\int  \frac{\sin(\theta)\sin x + \cos(\theta)\cos x}{\cos(\theta)\sin x + \sin(\theta)\cos x} dx\\
&=\int  \frac{\cos(x-\theta)}{\sin(x+\theta)} dx\\
&=\int  \frac{\cos(u-2\theta)}{\sin(u)} du\\
&=\int  \frac{\cos(u)\cos(2\theta)+\sin(u)\sin(2\theta)}{\sin(u)} du\\
&=\int  \left(\cot(u)\cos(2\theta)+\sin(2\theta)\right) du\\
\end{align}
$$
And it should be easy from here.
A: You should use this one : $t=\tan(\frac{x}{2})$
You'll need to remember that $\sin(x)=\frac{2t}{1+t^2}$ and $\cos(x)=\frac{1-t^2}{1+t^2}$
A: Let $u(x)=\log(\sin x + 2\cos x)$, then $(\sin x + 2\cos x)'=\cos x-2\sin x$ hence $$u'(x)=\frac{\cos x-2\sin x}{\sin x + 2\cos x}.$$ More generally, for every $(a,b)$, $$(au(x)+bx)'=\frac{(a+2b)\cos x+(b-2a)\sin x}{\sin x + 2\cos x}$$ Solving for $(a+2b,b-2a)=(1,2)$ yields $(a,b)=(-\frac35,\frac45)$ hence $$ \int  \frac{2\sin x + \cos x}{\sin x + 2\cos x}\,\mathrm dx=-\frac35u(x)+\frac45x+C=-\frac35\log(\sin x + 2\cos x)+\frac45x+C. $$
A: HINT: Express sin and cos in terms of tan (x/2)
