I'm trying to solve $\int \cot^3 x\,dx$ by substitution but I can't get it right. Here's what I did:
$$\int \cot^3x\,dx = \int(\csc^2x - 1)\cdot\cot x \,dx$$ $$-\int\cot x\,dx + \int \cot x \cdot \csc^2x \, dx$$
Let $u = \csc x\, du = -\csc x \cdot\cot x\,dx$
$$-\csc^2 x - \int u \,du = -\csc^2 x - \frac{u^2}{2} = -\csc^2 x - \frac{\csc^2x}{2}.$$
My problem is that the result in the solution manual is different, namely:
$$-\frac{\cot^2x}{2} - \ln\left|\sin(x)\right| + C$$
What's wrong with my solution?