1

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?

Foo Bar
  • 457

3 Answers3

5

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.

joriki
  • 238,052
  • But I thought the partial derivative does exactly this: take everything as constant but the variable that shows up directly itself. – Foo Bar Nov 02 '12 at 15:50
  • 2
    @FooBar: that is what I call the "first fundamental mistake of multivariable calculus". Partial derivatives don't "take everything as constant". A partial derivative is the derivative taken with respect to one chosen independent variable while other independent variables are held to be fixed. If you declare $g$ and $h$ to be independent variables, then $f$, the dependent variable, is a function of $x$, $g$, and $h$. This is different from the case where you declare only $x$ as the independent variable and make $g$ and $h$ dependent variables. In performing the partial differentiation ... – Willie Wong Nov 02 '12 at 15:54
  • @FooBar: The potential for confusion surrounding partial derivatives is endless because our notation for them is so ambiguous. You might want to search for some of my other answers to questions about partial derivatives. In a nutshell, when you use partial derivatives you need to have very clear in your mind what you're treating as independent variables, what you're changing and what you're keeping constant. As a rule, if you have a function $g(x)$, then $g$ depends on $x$ and you can't use both $x$ and $g$ as independent variables simultaneously, i.e. you can't keep $g$ fixed as $x$ varies. – joriki Nov 02 '12 at 15:56
  • ... you can only take other independent variables as fixed. You are not allowed to hold other dependent variables as fixed. Incidentally, this leads to the "second fundamental mistake of multivariable calculus": to specify a partial derivative, you must specify what are the independent and dependent variables. There are times when it is not clear from context (for example in studying thermodynamics). If one is not clear about which are precisely the independent and dependent variables, the notation $\partial/\partial x$ is meaningless. – Willie Wong Nov 02 '12 at 15:57
  • Thanks all of you. I chose this answer as the correct one in combination with Willies comment which solved my problem fully ("independent" was the keyword, I was not aware of this). – Foo Bar Nov 02 '12 at 16:03
3

It doesn't appear that you're applying the product rule correctly in the first case.

If you apply the product rule on $f(x)=xg(x)h(x)$ you should get

$$\frac{df}{dx} = xg(x)h'(x)+xg'(x)h(x)+g(x)h(x).$$

Emily
  • 35,688
  • 6
  • 93
  • 141
  • partial derivative of f(x, g(x), h(x)) by x treats g and h as constant, I thought? Or the other way round: Then why partial derive at all if I'm not allowed to treat something as constant? – Foo Bar Nov 02 '12 at 15:52
  • Nope, there is no "partial" derivative of $f$ in this sense. Partial derivatives are taken with respect to independent variables, but $g$ and $h$ are dependent variables with respect to $x$. – Emily Nov 02 '12 at 15:55
  • Another way of looking at it is $\frac{df}{dx}$ is the change in $f$ as a result of a small change in $x$. If $x$ changes, then as you have written it, so too does $g(x)$ and $h(x)$. Therefore, we must account for the effects of changes of $g(x)$ and $h(x)$ as a consequence of small changes of $x$. – Emily Nov 02 '12 at 15:56
1

Looking at your other replies, I see you want to think of f(x) & g(x) as 2 seperate variables.

The answer to your question is, the partial derivative expression can change depending on the form of f, specifically, if you substitute relations between the variables into f.

Eg. f(x,y) = xy, where y=x

$$\frac{\partial f}{\partial x} = y = x $$ (without substitution)

$$\frac{\partial f}{\partial x} = 2x $$ (with substitution)

What remains consistent is the total derivative, which is given by,

$$\frac{df}{dx} = \frac{\partial f}{\partial x} + \frac{\partial f}{\partial y}\frac{dy}{dx}$$

For f = xy,

$$ \frac {df}{dx} = y + x.1 = x + x = 2x $$

For f = x.x, $$ \frac {df}{dx} = 2x + 0.1 = 2x $$

Paritial derivative kind of pretends that the independent variables are constants. In cases where the variables are actually independent, partial and total derivatives are the same. But if there is some relation between the variables, partial derivative may not paint a proper picture of the actual ratio of change for a particular variable. That's where total derivative comes in.