Need a formula for $\frac{d}{dx}f(g(x), h(x))$ I know the derivative chain rule $\frac{d}{dx}f(g(x))= f^{\prime}(g(x))\cdot g^{\prime}(x)$.
What is the formula if $f$ is a function of two variables, i.e. what is $\frac{d}{dx}f(g(x), h(x))$?
Thanks for help. 
 A: For $f(u, v)$, $g(x)$, $h(x)$ sufficiently differentiable (what Thomas Andrews in his comment terms nice), taking
$u = g(x) \tag 1$
and
$v = h(x), \tag 2$
we have
$\dfrac{df}{dx} = \dfrac{\partial f(u, v)}{\partial u} \dfrac{dg(x)}{dx} + \dfrac{\partial f(u, v)}{\partial v} \dfrac{dh(x)}{dx}; \tag 3$
or, in terms of (1), (2),
$\dfrac{df}{dx} = \dfrac{\partial f(g(x), h(x))}{\partial u} \dfrac{dg(x)}{dx} + \dfrac{\partial f(g(x), h(x))}{\partial v} \dfrac{dh(x)}{dx}. \tag 4$
The above is simply an application of the multiple-variable chain rule.  See this widipedia page for more.
A: The function $f: \mathbb{R}^2 \to \mathbb{R}$ has as its derivative a matrix:
$$ f^\prime(x,y) = \begin{bmatrix}\partial_1 f(x,y) & \partial_2 f(x,y)\end{bmatrix},$$
where $\partial_i$ denotes the $i$th partial derivative. This matrix is also called the Jacobi matrix (which is more general and applies for maps $\mathbb{R}^n \to \mathbb{R}^m$). Note that this is only truly a derivative when $f$ is differentiable in the $\mathbb{R}^n$ sense - it is not always sufficient the partial derivatives merely exist.
Assuming $f$ is differentiable, the chain rule holds in a very similar way to how it does in $\mathbb{R}$, just with matrix multiplication instead of the scalar one:
$$(f \circ \phi)^\prime(x) = f^\prime(\phi(x)) \cdot \phi^\prime(x).$$
Define $\phi: \mathbb{R} \to \mathbb{R}^2: x \mapsto (g(x),h(x)).$ Assuming differentiability, 
$$\phi^\prime(x) = \begin{bmatrix} g^\prime (x)\\ h^\prime (x)\end{bmatrix},$$ and so:
$$ (f \circ \phi)^\prime(x) = f^\prime (\phi(x)) \cdot \phi^\prime(x)\\
= f^\prime(x,y) = \begin{bmatrix}\partial_1 f(\phi(x,y)) & \partial_2 f(\phi(x,y))\end{bmatrix} \cdot \begin{bmatrix} g^\prime (x)\\ h^\prime (x)\end{bmatrix}\\ 
=\partial_1 f_1(g(x),h(y))\cdot g^\prime(x)+\partial_2 f(g(x),h(x))\cdot h^\prime(x)$$
