Suppose $J$ is a function of $\bf{a}$, $\bf{a}$ is a function of $\bf{z}$ and $\bf{z}$ is a function of $\bf{\Theta}$ where $J$ is a scalar, $\bf{a}$ and $\bf{z}$ are vectors and $\bf{\Theta}$ is a matrix. What is the form of the chain rule to evaluate the partial derivative $\dfrac{\partial J}{\partial \bf{\Theta}}$?
I was thinking $$\dfrac{\partial J}{\partial \bf{\Theta}} = \dfrac{\partial J}{\partial \bf{a}}\dfrac{\partial \bf{a}}{\partial \bf{z}}\dfrac{\partial \bf{z}}{\partial \bf{\Theta}}$$ but I'm not sure of the order or any transposes.
The vectors are of dimension $n\times 1$, the matrix is of dimension $n \times m$. (what if the dimension of $\bf{a}$ was $n+1$?)