# Partial derivatives of $f(x_1, \dots, x_n, g(x_1, \dots, x_n))$

I have some arbitrary differentiable function of $n+1$ variables, $f(x_1, \dots, x_n, y)$, and some other arbitrary differentiable function of $n$ variables, $g(x_1, \dots, x_n)$. I then define a new function of $n$ variables: $$h(x_1, \dots, x_n) = f\left(x_1, \dots, x_n, g(x_1, \dots, x_n)\right).$$ I would like to be able to express the partial derivatives $\partial h/\partial x_i$ in terms of $f$, $g$ and their partial derivatives. It seems I need something a bit like the multivariable chain rule, but slightly different, and I'm not sure how to obtain it. Can anyone help?

• $\frac{\partial h}{\partial x_i}=\frac{\partial f}{\partial x_i}+\frac{\partial f}{\partial g}\frac{\partial g}{\partial x_i}$ – Shuchang Nov 19 '13 at 6:14
• @ShuchangZhang that looks right - but how can I derive it? – Nathaniel Nov 19 '13 at 6:16
• $\frac{\partial h}{\partial x_i}=\sum_{k=1}^n\frac{\partial f}{\partial x_k}\frac{\partial x_k}{\partial x_i}+\frac{\partial f}{\partial g}\frac{\partial g}{\partial x_i}$. But $\frac{\partial x_k}{\partial x_i}=\delta^k_i$ – Shuchang Nov 19 '13 at 6:22
• @ShuchangZhang got it, thanks. Feel free to post that as an answer if you'd like the points. – Nathaniel Nov 19 '13 at 6:26
• Well, since you say it. Ironically, I just came up with how to avoid answered questions in unanswered list, but I was making one. – Shuchang Nov 19 '13 at 6:36

It follows directly from chain rule $$\frac{\partial h}{\partial x_i}=\sum_{k=1}^n\frac{\partial f}{\partial x_k}\frac{\partial x_k}{\partial x_i}+\frac{\partial f}{\partial g}\frac{\partial g}{\partial x_i}=\sum_{k=1}^n\frac{\partial f}{\partial x_k}\delta^k_i+\frac{\partial f}{\partial g}\frac{\partial g}{\partial x_i}=\frac{\partial h}{\partial x_i}=\frac{\partial f}{\partial x_i}+\frac{\partial f}{\partial g}\frac{\partial g}{\partial x_i}$$