A question from Munkres' Analysis on Manifolds (P. 63, E. 3) 
*

*Let $f: \mathbf{R}^{3} \rightarrow \mathbf{R}$ and $g: \mathbf{R}^{2} \rightarrow \mathbf{R}$ be differentiable. Let $F: \mathbf{R}^{2} \rightarrow \mathbf{R}$ be
defined by the equation
$$
F(x, y)=f(x, y, g(x, y))
$$
Find $D F$ in terms of the partials of $f$ and $g .$
My Attempt. Consider $x=p$, $y=k$ and $r=g(x,y)$. So
$D F=\left[\begin{array}{lll}{\dfrac{\partial p} {\partial x}} \\ {\dfrac{\partial k} {\partial y}} \\ {\dfrac {\partial r}{\partial g}}\end{array}\right]=\left[\begin{array}{lll}{1} \\ {1}  \\ {\dfrac {\partial r}{\partial g}}\end{array}\right]$ 
Please, may you check my attempt and how can I find $\dfrac{\partial r} {\partial g}$, may you help?
 A: Make $\phi(x,y)=
\left(\begin{array}{c}
x\\
y\\
g(x,y)
\end{array}\right)$ and consider $F(x,y)=f\circ\phi(x,y)$.
Then by the chain's rule you have
$F'=f'\cdot\phi'$ that is
\begin{eqnarray*}
{\rm grad}F&=&\left[\frac{\partial f}{\partial x},\frac{\partial f}{\partial y},\frac{\partial f}{\partial z}\right]\left(\begin{array}{cc}
1&0\\
0&1\\
\frac{\partial g}{\partial x}&\frac{\partial g}{\partial y}
\end{array}\right),\\
&=&\left[\frac{\partial f}{\partial x}+\frac{\partial f}{\partial z}\frac{\partial g}{\partial x}\
,\ \frac{\partial f}{\partial y}+\frac{\partial f}{\partial z}\frac{\partial g}{\partial y}
\right]
\end{eqnarray*}
then you will be through.
A: By the chain rule
$$F_x=[f(x,y,g(x,y)]_x =f_x(x,y,g(x,y))+f_z(x,y,g(x,y)) g_x(x,y),$$
$$F_y=[f(x,y,g(x,y)]_y =f_x(x,y,g(x,y))+f_z(x,y,g(x,y)) g_y(x,y).$$
Hence,
$$DF=
\left[\frac{\partial f}{\partial x}+\frac{\partial f}{\partial z} \frac{\partial g}{\partial x} , \frac{\partial f}{\partial y}+\frac{\partial f}{\partial z} \frac{\partial g}{\partial y}\right]_{1\times 2} 
$$
