Q:

Partial derivative: Why does substitution order matter?

Simple example:
$f(x) = x \cdot g(x) \cdot h(x)$
$g(x) = 5x^2$
$h(x) = 2x^3$
First, derive $f$ by $x$, then substitute $g$ and $h$:
$\frac{\partial f}{\partial x} = g(x) \cdot h(x) = 10x^5$
And now the other way round, substitute and then derive:
$\frac{\partial f}{\partial x} = \frac{\partial (10 x^6)}{\partial x} = 60 x^5$
What's wrong here? Why does it matter in which order I subsitute known functions in a partial derivative? What is the meaning of this?

A:

The problem is that you treated $g(x)$ and $h(x)$ as constants. They're not, they depend on $x$. If you take that into account and write $g'(x)$ and $h'(x)$ for their derivatives with respect to $x$, respectively, you'll get the same result regardless of when you substitute for them.

