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.
 A: 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.
A: We have
$$(\sin x+2\cos x)(2\cos x-\sin x)=4-5\sin^2x=5\cos^2x-1$$
Therefore
$${\sin^2x\over \sin x+2\cos x} ={\sin^2x(2\cos x-\sin x)\over (\sin x+2\cos x)(2\cos x-\sin x)}\\ =
2{\sin^2x\over 4-5\sin^2x}\cos x-{1-\cos^2x\over 5\cos^2x -1}\sin x$$
Hence substituting $s=\sin x$ and $t=\cos x,$  respectively, gives
$$\int {\sin^2x\over \sin x+2\cos x}\,dx=2\int{s^2\over 4-5s^2}\,ds +\int{1-t^2\over 5t^2-1}\,dt \\
=-{2\over 5}s+{8\over 5}\int {1\over 4-5s^2}\,ds-{1\over 5}t+{4\over 5}\int{1\over 5t^2-1}\,dt $$
The remaining integrals can be evaluated by easy partial fraction decompositions. At the end we have to get back to $x=\arcsin s$ and $x=\arccos t,$ respectively.
A: After applying the method with rational fractions i’ve got three fractions in the integral and calculated it separately so that’s the answer i got in the end
-1/5Cos(x)-2/5Sin(x)-4/5^2,5ln(|2/5^0,5tg(x/2)-1/5^0,5-1/(2/5^0,5tg(x/2)-1/5^0,5+1)|+constant
I’m sorry for giving the answer in such an awkward form, but i’ve no idea how to write it correctly here
