Suppose we have a composite function: $f(g(h(x)))$, and we want $\frac{\partial f}{\partial h}$.
By the chain rule $\frac{\partial f}{\partial h} = \frac{\partial f}{\partial g}\frac{\partial g}{\partial h}$.
My question is: what about any occurrences of $x$? Do we have to express all the $x$ as functions of $h$? Or even write the $x$s in terms of $g$? Does it make a difference?
$~\\$
For example $f = g\times (x^2+1)$, and $g = h^2; h=1/x^2$. Then
1) $\frac{\partial f}{\partial h} = \frac{\partial f}{\partial g}\frac{\partial g}{\partial h} = (x^2+1)\times 2h$,
or write $f = h^2\times(x^2+1)$, and
2) $\frac{\partial f}{\partial h} = 2h\times(x^2+1)$,
or write $f = h^2\times(1/h+1) = h + h^2$, and
3) $\frac{\partial f}{\partial h} = 1+2h$.
(1) and (2) give the same result, and $x$ is not acted on. What about case (3)?