# Faà di Bruno's formula for multiple arguments but still with respect to one variable

Faà di Bruno's formula given (from Wikipedia) by

.

The following are questions about generalizations that are similar, but not the same:

What I would like an expression for is $$\frac{d^n}{dx^n} f(g_1(x), \ldots, g_k(x))$$ which involves taking the $$n$$th order derivative with respect to only $$x$$ but there are multiple arguments of $$f$$.

Consider $$f(a(x),b(x))$$. Then $$f_x=f_aa_x+f_bb_x$$ $$f_{xx}=f_{aa}a_x^2+2f_{ab}a_xb_x+f_{bb}b_x^2+f_aa_{xx}+f_bb_{xx}$$ $$f_{xxx}=\color{blue}{f_{aaa}a_x^3 + 3f_{aab}a_x^2b_x + 3f_{abb}a_xb_x^2 + f_{bbb}b_x^3} +\color{black}{3(f_{aa}a_{xx}a_x + f_{ab}a_{xx}b_x + f_{ab}b_{xx}a_x + f_{bb}b_{xx}b_x)} +\color{blue}{f_aa_{xxx} + f_bb_{xxx}}$$ You can see where this is going: if $$f$$ has $$r$$ arguments, for each $$f_{a^k}a_{x^{n_1}}a_{x^{n_2}}\cdots a_{x^{n_k}}$$ corresponding to a partition in the classic formula ($$n_1+\cdots+n_k$$ is always the derivative order desired) we replace it with a sum of $$r^k$$ terms formed by all possible ways of "colouring" the $$k$$ pairs of $$f$$-differentiating variables and $$a_{x^{n_i}}$$ factors with the $$r$$ available arguments. As a further example, consider the term corresponding to the $$2+1+1$$ partition in $$f^{(4)}(g(x))$$: $$6(f'''(g(x))g''(x)g'(x)^2)$$ Except for the $$6$$, this is replaced by a sum of $$8$$ terms in $$f_{xxxx}(a(x),b(x))$$: \begin{align}&f_{aaa}a_{xx}a_xa_x\\ +&f_{aab}a_{xx}a_xb_x\\ +&f_{aba}a_{xx}b_xa_x\\ +&f_{abb}a_{xx}b_xb_x\\ +&f_{baa}b_{xx}a_xa_x\\ +&f_{bab}b_{xx}a_xb_x\\ +&f_{bba}b_{xx}b_xa_x\\ +&f_{bbb}b_{xx}b_xb_x\end{align}