Given two functions *f* and *g*, the product rule tells you how to take the first derivative of their product, and the chain rule tells you how to take the first derivative of their composition. What if you want to take higher order derivatives? You could repeatedly apply basic calculus rules, but there are formulas for taking the higher order derivatives all at once.

The generalization of the product rule is known as Leibniz rule. It’s fairly simple and looks a lot like the binomial theorem.

The generalization of the chain rule is known as Faà di Bruno’s theorem. It’s more complicated, and it uses exponential Bell polynomials, something I’ve blogged about a few time lately.

More Bell polynomial posts:

I take my hat off to you for explaining something so complex in words that a mere mortal can understand

Why not to have given the explicit form of the Faà di Bruno Formula, without the Bell polynomials, too?

Because I’ve been interested in Bell polynomials lately, more than Faà di Bruno’s theorem per se.

On a related note, do you have any experience with “automated differentiation”? I found this article by chance one day,

https://en.wikipedia.org/wiki/Automatic_differentiation

but I found it rather confusing. It seems something like this might be quite useful though. You could input arrays of relatively simple functions and their derivatives, and specify a complicated composition of those functions using some sort of structure, and have the computer calculate derivatives of the composition at specified points.

Yes, I’m using automated differentiation on a project now. It’s magic. :)

Neat. Is there an Automatic differentiation package you like to use?