# Integrating $\frac{x\cos x}{\sin^3x}$.

This has had me going mad for more than an hour now. I'm integrating $\frac{x\cos x}{\sin^3x}~dx$.

First, I change it to $x\cot(x)\csc^2(x)~dx.$

Then, using substitution ($u=-\cot(x), du=\csc^2(x)~dx, x=-\operatorname{arccot}(u)$), I turn it into $\operatorname{arccot}(u)u~du$, which I then solve using integrating by parts. However, my solution is apparently wrong, as wolfram alpha gives an entirely different answer, and I can't for the life of me figure out what I'm doing wrong. I know that the initial part, where I change it to different trigonometric functions, is correct, and that I'm integrating by parts correctly as well. So, the substitution part must be causing the trouble, but I honestly can't figure out what I'm doing wrong. Any hints will be appreciated.

• It is quite possible that both results only differ by a constant, which means that including the constant of integration, you get the same solutions. To check your result, you can differentiate it. – Daniel Fischer Nov 9 '14 at 21:06

Try to integrate by parts right away. The first function you will be differentiating is $x$, the second one to integrate will be $\frac{\cos x}{\sin^3 x}$. For integrating you can use a substitution $u = \sin x$.
$$\int \frac{x\cos x}{\sin^3 x}dx=\int \frac{x}{\sin^3 x}d(\sin x)= \frac{x}{\sin^2 x}-\int \frac{\sin x -3x \cos x}{\sin^3 x}dx=$$ $$=\frac{x}{\sin^2 x}-\int \frac{1}{\sin^2 x} +\int \frac{3x \cos x}{\sin^3 x}dx$$
$$2\int \frac{x \cos x}{\sin^3 x}dx=-\frac{x}{\sin^2 x}+\int \frac{1}{\sin^2 x}$$ So now you just need $\int \csc^2 x dx$ which is standard.