Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am struggling to find the first derivative of a composed function with several variables. I think the solution of the problem involves the chain rule or some generalised form, but I can not see how to do it. Any hint or help is appreciated.

The situation: Lets assume we have variables $x_1, \dots, x_4$. These are transformed by a function $f$, which returns more than the given $4$ parameters.

For example: $$ f: \mathbb{R}^4 \rightarrow \mathbb{R}^6, \quad x_1, x_2, x_3, x_4 \rightarrow (0, x_1 + x_3, 2 \cdot x_1 + x_4, 0, x_2 + x_3, 2 \cdot x_2 + x_4) $$

The 'output' of $f$, let us call it $\mathbf{y} = (y_1, y_2, \dots, y_6)$, is processed by another function $g$ which is defined as followed: $$g:\mathbb{R}^6 \rightarrow \mathbb{R}^6, (y_1, y_2, \dots, y_6) \rightarrow (\exp(-y_1), \exp(-y_2), \dots, \exp(-y_6))$$

Then we have a third function $h$ which takes the 'output' of $g$, let us call this 'output' $\mathbf{z} = (z_1, z_2, \dots, z_6)$, and processes it further, returning some single value, so we have $h: \mathbb{R}^6 \rightarrow \mathbb{R}$. (I will not show the concrete definition of $h$, because I do not think it does help, but rather complicates things.)

What I am looking for is the first derivative of $h$ with respect to the original four parameters $x_1, \dots, x_4$.

What I tried is to apply the simple chain rule, like in the following. But I am not shure if this is correct or if I do miss something. Let's say we are interested in the first derivative of $h$ with respect to $x_2$. Then I got the following with the simple chain rule: $$ \frac{\partial h}{\partial x_4} = \frac{dh}{d\mathbf{z}} \cdot \frac{dg}{d\mathbf{y}} \cdot \frac{\partial f}{\partial x_2} $$

While writing this question, I ask myself if I need some 'partial derivative' of $h$ and $g$, but with respect to which parameter? All involving $x_2$?

Any help or hints will be appreciated. Thank you!

Best, Michael

share|cite|improve this question
up vote 1 down vote accepted

One considers a function $K:\mathbb R^4\to\mathbb R$ such that $K=h\circ g\circ f$ for some functions $f$, $g$ and $h$, with $f:\mathbb R^4\to\mathbb R^6$, $g:\mathbb R^6\to\mathbb R^6$, and $h:\mathbb R^6\to\mathbb R$.

Let $f=(f_i)_{1\leqslant i\leqslant6}$ and $g=(g_i)_{1\leqslant i\leqslant 6}$. Let $\partial_k$ denote the partial derivative with respect to the $k$th coordinate. Then, for every functions $\varphi:\mathbb R^n\to\mathbb R^m$ and $\psi:\mathbb R^m\to\mathbb R$ and every $\mathbf a$ in $\mathbb R^n$, the chain rule indicates that $$ \partial_k(\psi\circ\varphi)(\mathbf a)=\sum\limits_{i=1}^{m}\partial_i\psi(\mathbf b)\cdot\partial_k\varphi(\mathbf a), $$ where $\mathbf b=\varphi(\mathbf a)$ is in $\mathbb R^m$. Using the chain rule twice, one sees that, for every $1\leqslant k\leqslant4$ and every $\mathbf a$ in $\mathbb R^4$, $$ \partial_k K(\mathbf a)=\sum_{i=1}^6\partial_ih(\mathbf c)\cdot\sum_{j=1}^6\partial_jg_i(\mathbf b)\cdot\partial_kf_j(\mathbf a), $$ where one used the shorthands $\mathbf b=f(\mathbf a)$ and $\mathbf c=g(\mathbf b)$, hence $\mathbf b$ and $\mathbf c$ are in $\mathbb R^6$.

share|cite|improve this answer
Thank you very much for your answer! It helps me. But it also created two new questions: (a) Does this rule have a name? (I want to look it up and see some more examples) and (b) the index of $f$ in your solution of $\partial_k K(\mathbf{a})$ is $j$ which goes from $1, \dots, 6$, but $f$ has only four components? Is this correct? – Michael Mar 8 '12 at 7:44
The chain rule. – Did Mar 8 '12 at 7:47
Re (b), $f$ depends on 4 variables and has 6 components. – Did Mar 8 '12 at 7:48
Alright, thank you. I confused variables with components. Now it is clear. – Michael Mar 8 '12 at 7:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.