How do I solve this, do I have to continue calculating with rational fractions? $$\int \frac{\sin^2(x)dx}{\sin(x)+2\cos(x)}$$
I tried to use different substitutions such as $t=\cos(x)$, $t=\sin(x)$, $t=\tan(x)$, and after expressing $\sin$ and $\cos$ through $\tan(\frac{x}{2})$, I've got $ \int -4 \frac{t^2dt}{(1+t^2)^2(t^2-t-1)}.$
Rational fractions didn’t work.

It is possible to solve it without rational fractions. The denominator can be written as
$$\sin(x)+2\cos(x) = \sqrt 5\left(\frac{1}{\sqrt 5}\sin x + \frac{2}{\sqrt 5}\cos x\right) = \sqrt 5 \sin\left(x+\theta\right)$$
where $\sin\theta = \frac{2}{\sqrt 5}$. Now by the change of variable $x+\theta\rightarrow y$ we get
$$\int \frac{\sin^2(x)dx}{\sin(x)+2\cos(x)} = \frac{1}{\sqrt 5} \int \frac{\sin^2(x)dy}{\sin y} = \frac{1}{2\sqrt 5} \int \frac{1-\cos\left(2x\right) dy}{\sin y} = \\\frac{1}{2\sqrt 5} \int \frac{1-\cos\left(2y-2\theta\right) dy}{\sin y} = \frac{1}{2\sqrt 5} \int \frac{1-\cos\left(2y\right)\cos\left(2\theta\right) - \sin\left(2y\right)\sin\left(2\theta\right) dy}{\sin y} =\\
 \frac{1}{2\sqrt 5} \left(\int \frac{dy}{\sin y} - \cos\left(2\theta\right)\int \frac{dy}{\sin y} + 2\cos\left(2\theta\right)\int \sin y dy - 2\sin\left(2\theta\right) \int \cos ydy \right)$$
and I believe you can do the rest.
