Integrate $\int \frac{x\cos x}{\sin^2x}dx$ 
$$\int \frac{x\cos x}{\sin^2x}dx$$

$$\int \frac{x\cos x}{\sin^2x}dx=\int \frac{x\cos x}{1-\cos^2x}dx=\int \frac{x\cos x}{(1-\cos x)(1+\cos x)}dx$$
How can I find the two fractions? if there are at all? 
 A: Note that $$\frac{\cos x}{\sin^2 x}=\csc x \cot x$$
Applying integration by parts and differentiating 'x' we get,
$$I= \int \frac{x\cos x}{\sin^2x}dx=-x \csc x +\int \csc x\,dx$$
Now can you proceed?
A: For the calculation of $$I=\int \csc(x)\,dx$$ the tangent half angle subsitution is very useful and makes everything simple $$t=\tan(\frac x2)\implies dx=\frac {2dt}{1+t^2}\qquad \csc(x)=\frac{1+t^2}{2t}$$ All of this makes $$I=\int \frac{dt} t$$
A: Notice, using integration by parts $$\int \frac{x\cos x}{\sin^2 x}\ dx$$
$$=x\int \frac{\cos x}{\sin^2 x}\ dx-\int \left(\frac{d}{dx}(x)\cdot \int  \frac{\cos x}{\sin^2 x}\ dx\right)\ dx$$
$$=x\int \frac{d(\sin x)}{\sin^2 x}-\int \left(1\cdot \int  \frac{d(\sin x)}{\sin^2 x}\ dx\right)\ dx$$
$$=x\cdot \frac{-1}{\sin x}-\int \left(\frac{-1}{\sin x}\right)\ dx$$
$$=-x\csc x +\int \csc x\ dx$$
$$=-x\csc x +\ln|\csc x-\cot x|+C$$
A: $$\int \frac{x\cos x}{\sin^2x}dx$$
Let $\sin x=u$. Then, $\cos x dx=du$ and $x=\arcsin u$.
$$\int \frac{x\cos x}{\sin^2x}dx=\int \frac{\arcsin u}{u^2}du$$
This can be integrated by parts taking $\arcsin u$ as the first function and $\frac{1}{u^2}$ as the second function. 
A: $$\int \frac{x\cos x}{(1-\cos x)(1+\cos x)}dx=\int\frac{x \cos x}{1-\cos^2 x}dx=\int x\cot x \csc xdx$$ 
And now by parts: $f=x$ and $df=dx$ and $dg=\cot x \csc x dx$ and $g=-\csc$
$$=-x \csc x+\int\csc x dx$$
Multiply numenator and denominator of $\csc x$ by $\cot x +\csc x$
$$-x\csc x-\int\frac{-\cot x \csc x-\csc^2 x}{\cot x+\csc x}dx$$
And now set $t=\cot x +\csc x$ and $dt=(-\csc^2 x-\cot x \csc x)dx$
$$=-x\csc x-\int \frac 1 t dt$$ Can you finish?
A: Since you wanted to solve using partial fractions,
$$\int\frac{x\cos x}{(1+\cos x)(1-\cos x)}dx=\frac{1}{2}\int\frac{x(1+\cos x)-x(1-\cos x)}{(1+\cos x)(1-\cos x)}dx$$
$$=\frac{1}{2}\int\frac{x}{1-\cos x}dx- \frac{1}{2}\int{\frac{x}{1+\cos x}}dx$$
$$= \frac{1}{2}\int \frac{x}{2\sin^2\frac{x}{2}}dx- \frac{1}{2}\int \frac{x}{2\cos^2\frac{x}{2}}dx$$
$$= \frac{1}{2}\int x\sec^2\frac{x}{2}dx-\frac{1}{2}\int x\csc^2\frac{x}{2}dx$$
Now use integration by parts.
I will solve one term
$$\int x\sec^2\frac{x}{2}dx=2x\tan\frac{x}{2}-2\int\tan\frac{x}{2}dx$$
A: You should recognize the derivative of the cosecant. Then by parts,
$$\int \frac{x\cos x}{\sin^2x}dx=-\frac x{\sin(x)}+\int\frac{dx}{\sin(x)}.$$
The last integral is easily solved with
$$\int\frac{dx}{\sin(x)}=\int\frac{\sin(x)}{\sin^2(x)}dx=\int\frac{\sin(x)}{1-\cos^2(x)}dx=-\text{artanh}(\cos(x)).$$
