# Is gradient $\nabla x(\vec{z})$ equal to the product of gradient $\nabla x(\vec{y})$ and Jacobian $J_{\vec{y}}(\vec{z})$?

I have two functions $x(\vec{y})$ and $\vec{y}(\vec{z})$, and I need the gradient $\nabla x(\vec{z})$. I also have the gradient $\nabla x(\vec{y})$ and the Jacobian $J_{\vec{y}}(\vec{z})$. Can I simply take the product: $$\nabla x(\vec{z}) = \nabla x(\vec{y})\;J_{\vec{y}}(\vec{z}) ?$$

Background: The first function $x(\vec{y})$ is a scalar-valued multivariate function, the second function $\vec{y}(\vec{z})$ is a vector-valued multivariate function. The gradient is the vector of partial derivatives: $$\nabla x(\vec{y}) = \pmatrix{ \frac{\partial x}{\partial y_1}(\vec{y})\\ \vdots\\ \frac{\partial x}{\partial y_n}(\vec{y})\\ }$$ and $$\nabla x(\vec{z}) = \pmatrix{ \frac{\partial x}{\partial z_1}(\vec{z})\\ \vdots\\ \frac{\partial x}{\partial z_m}(\vec{z})\\ }.$$ The Jacobian is the matrix of partial derivatives: $$J_{\vec{y}}(\vec{z}) = \pmatrix{ \frac{\partial y_1}{\partial z_1}(\vec{z}) & \dots & \frac{\partial y_1}{\partial z_n}(\vec{z}) \\ \vdots & \ddots & \vdots\\ \frac{\partial y_n}{\partial z_1}(\vec{z}) & \dots & \frac{\partial y_n}{\partial z_m}(\vec{z}) }.$$

Of course, I could explicitly form the function $x(\vec{z})$ by replacing each $y_i$ by $y_i(\vec{z})$ and then find the partial derivatives $\partial x/\partial{z_j}$. However, the function $\vec{y}(\vec{z})$ is rather complex (not in the sense of complex numbers, but in the sense that it contains many trigonometric expressions), which would make the process quite cumbersome. On the other hand, the gradient $\nabla x(\vec{y})$ and the Jacobian $J_{\vec{y}}(\vec{z})$ are rather simple.

I have the intuition that the proposed product is allowed, and it worked with simple dummy functions, but I'd be interested in a proof, a source or at least the opinion of a mathematician.

For differentiable functions $f:\mathbb{R}^k\to\mathbb{R}^m ,g:\mathbb{R}^n\to \mathbb{R}^k$, $f\circ g$ is a differentiable function whose derivative is given by $$\mathbf{D}(f\circ g)(x) = \mathbf{D}f(g(x))\,\mathbf{D}g(x)$$
Where $\mathbf{D}f$ is the derivative matrix. In the instance that $f:\mathbb{R}^n\to\mathbb{R} ,g:\mathbb{R}^n\to \mathbb{R}^n$, this means that $$[\nabla (f\circ g)(x)]^T = [\nabla f(g(x))]^T [J_ g(x)]$$ With $T$ here meaning transpose. In the instance that $f:\mathbb{R}^n\to\mathbb{R} ,g:\mathbb{R}\to \mathbb{R}^n$, this gives you $$[\frac{d}{dx} (f\circ g)(x)] = [\nabla f(g(x))]^T [g'(x)]$$ Hope that helps!