# this integral $\int\frac{2-\sin{x}}{\sin^2{x}-\sin{x}+1}dx$

Find integral $$\int\dfrac{2-\sin{x}}{\sin^2{x}-\sin{x}+1}dx$$

As suggested ,we take the Weierstrass Substitution is often useful in integrals such as the original. \begin{align} \sin(x)&=\frac{2z}{1+z^2}\\ \cos(x)&=\frac{1-z^2}{1+z^2}\\ \mathrm{d}x&=\frac{2\,\mathrm{d}z}{1+z^2} \end{align} I known is equal to $$\int\dfrac{4(z^2-z+1)}{z^4-2z^3+6z^2-2z+1}dz$$ but I don't know how I should calculate the last integral.

• Shouldn't the $4z^2$ in the denominator be replaced by $6z^2$? Jun 14, 2015 at 1:50
• Yeah. I seem to be getting a $6z^2$ on bottom instead of a $4z^2$. Jun 14, 2015 at 1:58

Here's my revised solution that is shorter in working (which is still ridiculously long). The only tedious part is the simplifiying of the integrand after the Weierstrass Substitution. Outline:

Let $y = \frac \pi 2 - x$, we get

$\begin{eqnarray} \displaystyle \int \frac{\cos y - 2}{\cos^2 y - \cos y + 1} \, dy & = & \displaystyle \int \frac{(-\sin y) + (\sin y + \cos y - 2)}{\cos^2 y - \cos y + 1} \, dy \\ & = & \int \frac{-\sin y}{\cos^2 y - \cos y + 1} \, dy + \int \frac{\sin y + \cos y - 2} {\cos^2 y - \cos y + 1} \, dy \end{eqnarray}$

The first integral can be solved via substitution of $p = -\cos y$ then convert it in the form of $\large\displaystyle \int \frac{ds}{a^2+s^2} = \frac1a \tan^{-1} \left( \frac sa\right)$

For the second integral, we use the Weierstrass Substitution as suggested. Let $t = \tan\left( \frac y2\right)$ and the integrand simplifies to

$\large \frac{-6t^2+4t-2}{(t^2+1)^2}$

Apply partial fraction

$\large \frac{4t}{(t^2+1)^2} - \frac6{t^2+1} + \frac4{(t^2+1)^2}$

Which can be easily integrated.

If I'm correct, back substituting everything yields

$\large \frac2{\sqrt3} \tan^{-1} \left(\frac2{\sqrt3}\sin x\right) - \frac{2(\sin x + 1)}{\tan \frac x2 + 1} - 4\cot^{-1} x + C$

Hint

Note $$\dfrac{2-\sin{x}}{\sin^2{x}-\sin{x}+1}=\dfrac{1}{w_{1}-w_{2}}\left(\dfrac{2-\sin{x}}{\sin{x}-w_{1}}-\dfrac{2-\sin{x}}{\sin{x}-w_{2}}\right)$$ where $w_{1},w_{2}$ are equation $x^2-x+1=0$complex roots and $$\dfrac{2-\sin{x}}{\sin{x}-w_{1}}=-1+\dfrac{2-w_{1}}{\sin{x}-w_{1}}$$ $$\dfrac{2-\sin{x}}{\sin{x}-w_{2}}=-1+\dfrac{2-w_{2}}{\sin{x}-w_{2}}$$ use this following $$\int\dfrac{1}{\sin{x}-A}dx=\dfrac{2\arctan{\left(\dfrac{1-A\tan{\frac{x}{2}}}{\sqrt{A^2-1}}\right)}}{\sqrt{A^2-1}}$$ then you can solve it