Let $G$ be a function dependent on a variables $p_1,...,p_n$, i.e. $G=G(p)$ and let $F = F(q)$ in terms of variables $q_1,...q_n$ be the Legendre transform of it.
More precisely
$F(q) = \sum_{i=1}^n p_iq_i -G(p)$.
Now given $G(p)$, how do I express $\frac{\partial^n}{\partial q^n}F$ (means any multivariable derivative) in terms of derivatives of $G$ with respect to $p$ in general?
My approach to solution:
I know that $\frac{\partial}{\partial p_i}G(p) = q_i$ and $\frac{\partial F}{\partial q_i}= p_i$. The second derivative of $F$ by $q$ is
$\frac{\partial^2 F}{\partial q_i \partial q_j}=\partial_{q_i}p_j = \frac{\partial p_i}{\partial (\partial_{p_j} G)} = (\partial_{p_i} \partial_{p_j}G)^{-1}$.
Here, the -1 exponent denotes that I have to compute the inverse function derivative matrix. For the third derivative I have
$\frac{\partial^3 F}{\partial q_i \partial q_j \partial q_k} = \partial_{q_k}(\partial_{p_i} \partial_{p_j}G)^{-1} = -(\partial_{p_i} \partial_{p_j}G)^{-1} \partial_{q_k}\partial_{p_i} \partial_{p_j}G(\partial_{p_i} \partial_{p_j}G)^{-1}$
where I have used the general identity $d(MM^{-1}) = 0 = (dM)M^{-1}+MdM^{-1}$.
I can express the derivative by $q_i$ now as follows $\partial_{q_i} = \sum_{k=1}^n (\partial_{q_i}\partial_{q_k}G)^{-1}\partial_{q_k}$ which follows frome chain rule and above considerations. But how I can compute a general n-fold derivative expressed in derivatives of G?