# What is $\frac{\partial}{\partial x_1} [f(g(x_1,x_2))]$ in terms of components of $f$ and $g$?

Question: Let $$f,g:\mathbb{R}^2 \to \mathbb{R}^2$$ be continously differentiable functions where $$f\circ g$$ is defined. Let $$f = (f_1,f_2)\quad\text{and}\quad g=(g_1,g_2)$$ where all $$f_1,f_2,g_1,g_2:\mathbb{R}^2\to\mathbb{R}$$ are functions. What is $$\frac{\partial}{\partial x_1} [f(g(x_1,x_2))]?$$

I think the derivative should be a function from $$\mathbb{R}^2$$ to $$\mathbb{R}^2$$ as well.

Let $$x =(x_1,x_2).$$ By multivariate chain rule, we have $$\frac{\partial}{\partial x_1} [f(g(x_1,x_2))] = \frac{\partial}{\partial x_1} [f(g_1(x),g_2(x))] = \frac{\partial f}{\partial g_1} \cdot \frac{\partial g_1}{\partial x_1} + \frac{\partial f}{\partial g_2} \cdot \frac{\partial g_2}{\partial x_1}.$$ I am not sure whether the equation above is correct.

I notice that the multiplication in the RHS of the equation above is scalar multiplication. This means that both $$\frac{\partial f}{\partial g_1}\quad\text{and}\quad \frac{\partial f}{\partial g_2}$$ is a vector in $$\mathbb{R}^2.$$ But I do not understand its meaning.

Given a point $$p\in{\mathbb R}^2$$ the chain rule says that $$d(f\circ g)(p)=df\bigl(g(p)\bigr)\circ dg(p)\ ,$$ in Jacobian matrix terms: $$J_{f\circ g}(p)=J_f(g(p)\bigr)\cdot J_g(p)\ .$$ This implies $${\partial\over\partial x_1}(f\circ g)(p)=d(f\circ g)(p).e_1=\bigl(df\bigl(g(p)\bigr)\circ dg(p)\bigr).e_1=df\bigl(g(p)\bigr)\bigl(dg(p).e_1\bigr)\ .$$ Now $$dg(p).e_1$$ is the first column of the matrix $$J_g(p)$$; therefore we obtain $${\partial\over\partial x_1}(f\circ g)(p)=\left[\matrix{f_{1.1}&f_{1.2}\cr f_{2.1}&f_{2.2}\cr}\right]_{g(p)}\left[\matrix{g_{1.1}\cr g_{2.1}\cr}\right]_p\ ,$$ where $$f_{i.k}$$ means that that the component $$f_i$$ of $$f$$ is partially differentiated with respect to $$x_k$$.