[Faà di Bruno's formula][1] generalizes the [chain rule][2] to higher order derivatives. Most compact form of Faà di Bruno's formula involves [Bell polynomials][3] $B_{n,k}\left(x_1,x_2,\dots,x_{n-k+1}\right)$ and illustrates its combinatorial nature:

$${d^n \over dx^n} f(g(x)) = \sum_{k=1}^n f^{(k)}(g(x))\cdot B_{n,k}\left(g'(x),g''(x),\dots,g^{(n-k+1)}(x)\right).$$


  [1]: https://en.wikipedia.org/wiki/Fa%C3%A0_di_Bruno's_formula
  [2]: https://en.wikipedia.org/wiki/Chain_rule
  [3]: https://en.wikipedia.org/wiki/Bell_polynomials