The derivative of $f(x,g(x))$ Assume $f$ is a smooth function on the real plane and $g$ is a smooth function on the real line. Define $h$ by $h(x)=f(x,g(x))$. I'm struggling to see that $$\frac{dh}{dx}=\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y}\frac{\partial g}{\partial x}$$
 A: You should be using the system of variables $t\in\Bbb{R}$ and $(x,y)\in{\Bbb{R}}^2$. So in  the chain's rule for $h=h(t)=f(x(t),y(t))$ you are going to have 
$$\frac{dh}{dt}=\frac{\partial f}{\partial x}\frac{dx}{dt}+\frac{\partial f}{\partial y}\frac{dy}{dt},$$ 
in general. Now adapt to your problem.
A: We have
\begin{align}
f(x+\Delta x,g(x+\Delta x))-f(x,g(x))=f(x+\Delta x,g(x+\Delta x))-f(x,g(x+\Delta x)) \\
+f(x,g(x+\Delta x))-f(x,g(x)).
\end{align}
Then, by virtue of the Mean Value Theorem
$$
f(x+\Delta x,g(x+\Delta x))-f(x,g(x+\Delta x))=\Delta x \,f_x(x+\vartheta\Delta x,g(x+\Delta x)),
$$
for some $\vartheta\in(0,1)$. Thus
$$
\frac{f(x+\Delta x,g(x+\Delta x))-f(x,g(x+\Delta x))}{\Delta x}=f_x(x+\vartheta\Delta x,g(x+\Delta x)) \to
f_x(x,g(x)),
$$
as $\Delta x\to 0$. Next
$$
f(x,g(x+\Delta x))-f(x,g(x))=\big(g(x+\Delta x)-g(x)\big)\, f_y\big(x,g(x)+\vartheta(g(x+\Delta x)-g(x))\big),
$$
and thus
$$
\frac{f(x,g(x+\Delta x))-f(x,g(x))}{\Delta x}=
f_y\big(x,g(x)+\vartheta(g(x+\Delta x)-g(x))\big)\frac{g(x+\Delta x)-g(x)}{\Delta x},
$$
and as $\Delta x\to 0$, then the right hand side of the above tends to
$$
f_y(x,g(x))\,g'(x).
$$
A: You are given a function $f(x,y)$ and evaluate it in a point $(x,y)=(x,g(x))$ to obtain the composed function $h(x)=f(x,g(x))$. Now differentiation is the same as linearization is the same as finding out how the results change in first order if the variables change. Since $y$ is a dependent variable, change $x$ to $x+v$. Then in first order $g(x+v)=g(x)+g'(x)v+o(v)$. Insert this into $h$ to get
$$h(x+v)=f(x+v,g(x)+g'(x)v+o(v))$$
and you see why you will need the derivatives in both directions to compute the linearization of $h$ in $x$.
A: Let $h(z) = (z,g(z))$. Then you want to compute the derivative of $\phi = f \circ h$, which is given by $D \phi(z) = D f (h(z)) Dh(z)$. Since
$D f (h(x)) = ( { \partial f(z,h(z)) \over \partial x} , { \partial f(z,h(z)) \over \partial y} )$, and $Dh(z) = \binom{I}{{ \partial g(z) \over \partial x}}$, we obtain the desired result.
