TITLE: Integral $\int (\cot^{2}x+\cot^{4}x)\mathrm{d}x$
QUESTION [7 upvotes]: I am having difficulties with integrating this function:
$$\int (\cot^{2}x+\cot^{4}x)\mathrm{d}x$$
I separated the function in two and calculated $\int \cot^2x\mathrm{d}x$:
$$\int \cot^2x\mathrm{d}x=\int (-1+1+\cot^2x)\mathrm{d}x=-\int \mathrm{d}x+\int (1+\cot^2x)\mathrm{d}x=-x-\cot x+c$$
But I don't know how to deal with $\int \cot^4x\mathrm{d}x$. I assume that there is a shorter solution somewhere but I'm not sure. In addition, this is a high school level question, I'm only familiar with primitives of simple functions, integration by parts and trigonometric replacement.
Any help would be appreciated, thanks in advance.

Solution
$$\int (\cot^{2}x+\cot^{4}x)\mathrm{d}x=\int \cot^{2}x\cdot(\cot^{2}x+1)\mathrm{d}x=\int (\cot^{2}x\cdot\csc^{2}x)\mathrm{d}x$$
Let's assume $u:=\cot x$
Then $\mathrm{d}u=-\csc^2x\mathrm{d}x$. So we have:
$$\int (\cot^{2}x\cdot\csc^{2}x)\mathrm{d}x=-\int u^2\mathrm{d}u=-\frac{u^3}{3}+c=-\frac{\cot^2x}{3}+c$$
N. S. and MyGlasses, thank you for your help.

REPLY [8 votes]: $$\int (\cot^{2}x+\cot^{4}x)\mathrm{d}x= \int\cot^{2}x\left(1+\cot^{2}x \right)\mathrm{d}x= \int\cot^{2}x\csc^{2}x \mathrm{d}x$$
and use the fact that $(\cot(x))'=-\csc^2(x)$.