$n^{th}$ derivative of $\cot x$

What is the $n^{th}$ derivative of $\cot(x)$?

I tried to differentiate it may times:

• Well, there is certainly a pattern -- you're getting a polynomial in cot(x) which is alternatingly even/odd and whose degree is the order of the differential operator + 1. So, assuming this fact, you can write down explicit recursive formulas for the coefficients. – hunter Mar 17 '16 at 11:04
• What kind of answer are you seeking? Closed form? Recursive? Summation? Other? – Rory Daulton Mar 17 '16 at 12:13

There is a pattern but it is not simple. Apparently the pattern was found only quite recently:

V.S. Adamchik, On the Hurwitz function for rational arguments, Applied Mathematics and Computation, Volume 187, Issue 1, 1 April 2007, Pages 3–12

See Lemma 2.1. The text is available at the author's site: pdf

There is also a recursion formula:

If $\dfrac{d^n}{dx^n} \cot x = (-1)^n P_n(\cot x)$, then $P_0(u)=u$, $P_1(u)=u^2+1$, and $$P_{n+1}(u) = \sum_{j=0}^n \binom{n}{j} P_j(u) P_{n-j}(u)$$ for $n\ge 1$.

This formula appears in

Michael E. Hoffman, Derivative polynomials for tangent and secant, The American Mathematical Monthly, Vol. 102, No. 1 (Jan., 1995), pp. 23-30

I learned of this formula and paper in

Kurt Siegfried Kölbig, The polygamma function and the derivatives of the cotangent function for rational arguments, CERN-CN-96-005, 1996.