TITLE: Is there a quicker way to solve this integral: $\int \frac{3-\cos(x)}{(1+2\cos(x))\sin^2(x)}dx$?
QUESTION [9 upvotes]: The integral is:
$$ \int \frac{3-\cos(x)}{(1+2\cos(x))\sin^2(x)}dx$$
This is the way I approached it:
$$ \tan\left(\frac{x}{2}\right)=u\\dx=\frac{2}{\sec^2\left(\frac{x}{2}\right)}du$$
By using trigonometric identities we get:
$$ \sin(x)=\frac{2u}{1+u^2};\ \cos(x)=\frac{1-u^2}{1+u^2};\ \sec^2\left(\frac{x}{2}\right)=1+u^2
$$
Therefore the integral now becomes:
$$ 2\int \frac{3-\frac{1-u^2}{1+u^2}}{\left(1+2\left(\frac{1-u^2}{1+u^2}\right)\right)\left(\frac{2u}{1+u^2}\right)^2(1+u^2)}du=$$ $$\int\frac{(1+2u^2)(1+u^2)}{u^2(3-u^2)}du$$ By dividing the two polynomials we get: $$\int\left(-2-\frac{9u^2+1}{u^2(3-u^2)}\right)du$$ Using partial fractions we get to the simplified form: $$\int\left(-2-\frac{1}{3u^2}+\frac{28}{3(3-u^2)}\right)du$$ $$-2u-\frac{1}{3u}+\frac{28\sqrt3}{9}\int\frac{1}{1-\left(\frac{u}{\sqrt3}\right)^2}du \\ -2u-\frac{1}{3u}+\frac{28\sqrt3\tanh^{-1}{\left(\frac{u}{\sqrt3}\right)}}{9}+C$$
By substituting back in for $u$, we get the solution: $$ \bbox[5px,border:2px solid black]{\frac{28\sqrt3\tanh^{-1}{\left(\frac{\tan\left(\frac{x}{2}\right)}{\sqrt3}\right)}}{9}-2\tan\left(\frac{x}{2}\right)-\frac{1}{3}\cot\left(\frac{x}{2}\right)+C}$$
My question is, as you can understand from the title, is there any easier and faster way to solve this integral? If so, how? Thank you.

REPLY [7 votes]: HINT
One can look for coefficients of identity
$$f(y)=\frac{3-y}{(1+2y)(1-y^2)}=\frac A{1+2y}+\frac B{1-y}+\frac C{1+y}:$$
$$A=\lim_{y\to -\dfrac12}(1+2y)f(y) =\frac{14}3,$$
$$B=\lim_{y\to 1}(1-y)f(y) = \frac13,$$
$$C=\lim_{y\to-1}(1+y)f(y) = -2$$
and then find the integrals through the universal trigonometric substitution and known integrals
$$\int\dfrac{\mathrm dx}{1-\cos(x)}=\dfrac12\int\dfrac{\mathrm dx}{\sin^2\left(\dfrac x2\right)} = -\cot\left(\dfrac x2\right)+constant,$$
$$\int\dfrac{\mathrm dx}{1+\cos(x)}=\dfrac12\int\dfrac{\mathrm dx}{\cos^2\left(\dfrac x2\right)} = \tan\left(\dfrac x2\right)+constant.$$