Calculus/Multivariable Calculus/Chain Rule

Rules of taking Jacobians
If f : Rm &rarr; Rn, and h(x) : Rm &rarr; R are differentiable at 'p': Important: make sure the order is right - matrix multiplication is not commutative!
 * $$J_\mathbf{p} (\mathbf{f}+\mathbf{g}) = J_\mathbf{p} \mathbf{f} + J_\mathbf{p} \mathbf{g}$$
 * $$J_\mathbf{p} (h\mathbf{f}) = hJ_\mathbf{p} \mathbf{f} + \mathbf{f}(\mathbf{p}) J_\mathbf{p} h$$
 * $$J_\mathbf{p} (\mathbf{f}\cdot \mathbf{g}) = \mathbf{g}^T J_\mathbf{p} \mathbf{f} + \mathbf{f}^T J_\mathbf{p}\mathbf{g}$$

Chain rule
The chain rule for functions of several variables is as follows. For f : Rm &rarr; Rn and g : Rn &rarr; Rp, and g o f differentiable at p, then the Jacobian is given by
 * $$\left( J_{\mathbf{f}(\mathbf{p})} \mathbf{g}\right) \left( J_\mathbf{p} \mathbf{f}\right)$$

Again, we have matrix multiplication, so one must preserve this exact order. Compositions in one order may be defined, but not necessarily in the other way.