<s>[INST] 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.
 [/INST] 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.
</s>