Let $\psi : \mathbb{R}^n \to \mathbb{R}^n$ and $f: \mathbb{R}^n \to \mathbb{R}$ be continuously differentiable functions. Let $X \in \mathbb{R}^n$, $Y=\psi(X)$ and $g=f \circ \psi$. Show that $Z \in \mathbb{R}^n$ is orthogonal to $\nabla g(X)$ if and only if $\psi'(X)(Z)$ is orthogonal to $\nabla f(Y)$.
Well, I've tried many things (like the geometric meaning of the gradient operator and direct manipulation using inner product properties) but nothing worked and I did not see any other valid aproach.
Thank you.
Note that by the chain rule $$ \nabla g(X)=\nabla f(Y)\psi'(X) $$ Where $\psi'(X)$ is the $n\times n$ matrix $\left(\frac{\partial\psi_i}{\partial x_j}(X)\right)$, $\psi=(\psi_1,\ldots,\psi_n)$.
Given $Z\in\mathbb{R}^n$ we can interpret the dot product $\nabla g(X)\cdot Z$ as the product of the $1\times n$ matrix $\nabla g(X)$ and the $n\times 1$ which is the transpose of $Z$ (viewed as a $1\times n$ matrix). So $$ \nabla g(X)Z=(\nabla f(Y)\psi'(X))Z=\nabla f(Y)(\psi'(X)Z) $$ This implies that $\nabla g(X)Z=0$ if and only if $\nabla f(Y)(\psi'(X)Z)=0$ and since $\psi'(X)Z\in \mathbb{R}^n$, tour claim follows.