In my text book, say that
Let $g:\mathbb{R}^{m}\to\mathbb{R}^{n}$ and $f:\mathbb{R}^{n}\to\mathbb{R}$, the chain rule implies that $$D_{j}(f\circ g)(a)=\sum_{i=1}^{n}{D_{i}f(g(a))\cdot D_{j}g^{i}(a)}$$
If $a\in\mathbb{R}^{m}$. I know the chain rule in basic case, but I don't see where from the terms $g^i(a)$. Any hint will be appreciated.! Thanks!
According to the chain rule, you have: $$D(f \circ g)(a) = Df(g(a)) . Dg(a).$$
And by definition, $D_j(f \circ g)(a)=D(f \circ g)(a)(e_j)$ where $e_j$ is the $j$-th vector of the canonical basis $(e_1, \dots ,e_n)$ of $\mathbb R^n$.
So $$D_j(f \circ g)(a) = Df(g(a)) . Dg(a)(e_j)$$ while $Dg(a)(e_j)$ is the vector $(D_j g^1(a), \dots, D_j g^n(a))^T$. Multiplying on the left by $Df(g(a))$ according to the chain rule, you’re done.