# What is the partial derivative of $f(x,y(x))$?

What is the total derivative of $f(x,y(x,z))$ with respect to $x$? Is it $$\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y}\frac{\partial y}{\partial x}?$$ If this is correct, what is $\frac{\partial f}{\partial x}$? It seems to me that partial $f$ partial $x$ is equal to the derivative of $f$ with respect to $x$. What is the difference? I mean, suppose $f(x,y(x,z))=x^2+y(x,z)$ and $y(x,z)=x^2+z.$ So we have $f(x,y(x,z))=2x^2+z.$ Hence $\frac{\partial f}{\partial x}=4x.$ On the other hand, $\frac{df}{dx}=\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y}\frac{\partial y}{\partial x}=4x+1\cdot 2x=6x.$ Am I making a mistake?

• The meaning is clearer if you introduce a function that only explicitly depends on the independent variables: $g(x,z)=f(x,y(x,z))$. Then you mean $\frac{\partial g}{\partial x}$, which is still a partial derivative (since $z$ is held constant), even though $g$ depends on $x$ in two different ways. By contrast if you had $g(t)=f(t,x(t))$, $\frac{dg}{dt}$ is indeed a total derivative.
– Ian
Feb 8, 2016 at 16:03

The mistake is that $\frac{\partial f}{\partial x}$ means two different things in these cases. In the first case, we assume that $z$ does not depend on $x$, meaning $\frac{\partial z}{\partial x} = 0$. We can write $f(x,z) = 2x^2 + z$. So we get $$\frac{df}{dx} = \frac{\partial f}{\partial x} = 4x.$$

In the second case, we have $f(x,y) = x^2 + y$ with $y(x,z) = x^2 + z$ Whether or not $y$ depends on $x$, we always get $\frac{\partial{f}}{{\partial x}} = 2x$. For the total derivative however, we have to take implict dependencies into account, giving

$$\frac{df}{dx} = \frac{\partial f}{\partial x} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial x} = 2x + 1\cdot 2x = 4x.$$

• Regarding the second case, since $f$ ultimately depended on $x$ and $z$, should we have $\frac{\partial f}{\partial x}$ instead of $\frac{df}{dx}$ in the right hand side of the last equation? If so, the notation $\frac{\partial f}{\partial x}$ is meaning two things: one is the total derivative with respect to $x$ and the other is the partial with respect to $x$, right?
– Kun
Feb 8, 2016 at 20:02
• @Kun I dont' see any $\frac{df}{ dx}$ in the rhs of the last equation. The answer to your question is that there are different notations for the total derivative and the partial derivative. $\frac{\partial f}{\partial x}$ is the partial derivative, and $\frac{df}{dx}$ is the total derivative. They only are equal if there is no implicit dependence on the variable in the function. Feb 8, 2016 at 20:33
• But one classic textbook says under the condition that $f$ depended on two independent variables, we should write $\frac{\partial f}{\partial x}$ to stand for the total derivative. This is because $f$ does not soely depent on $x$. But if so, we have the problem of using one notation for two different meanings. Do you see what I am saying?
– Kun
Feb 8, 2016 at 23:59
• @Kun not really because I cant believe someone would define $\frac{\partial f}{\partial x}$ to be the total derivative, as it is universal notation for the partial derivative (it's even in the latex commands). Which textbook are you referring to? Feb 9, 2016 at 0:36
• Stewart's calculus
– Kun
Feb 9, 2016 at 1:53

Your computation of $\frac{\partial}{\partial x}f(x,y(x,z))$ is correct, but I think what you're stumbling on in your subsequent example is that

$$\frac{\partial}{\partial x}f(x,y(x,z)) \neq \frac{\partial f}{\partial x}.$$

The expression on the left is a composition of functions. The expression on the right is a shorthand for $\frac{\partial f}{\partial x}(x,y)$, which is the derivative of $f$ with respect to $x$ at the point $(x,y)$, where neither $x$ nor $y$ are given in terms of other variables.

It might help conceptually to write down the composition as a separate function. In the case of $f(x,y(x,z)) = x^2 + y(x,z)$ for $y(x,z) = x^2 + z$, you really have a new function $g(x,z) = f(x,y(x,z))$, and the chain rule indeed says that

$$\frac{\partial g}{\partial x} = \frac{\partial f}{\partial x}(x,y(x,z)) + \frac{\partial f}{\partial y}(x,y(x,z))\cdot\frac{\partial y}{\partial x}(x,z),$$

but this is very different from and does not say that $\frac{\partial f}{\partial x} = \frac{\partial f}{\partial x} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial x}$. To verify that this is true, note that we can calculate the lefthand side directly as

$$\frac{\partial g}{\partial x} = \frac{\partial}{\partial x}(2x^2 + z) = 4x,$$

and the righthand side as

\begin{align*} \frac{\partial f}{\partial x}(x,y(x,z)) + \frac{\partial f}{\partial y}(x,y(x,z))\cdot\frac{\partial y}{\partial x}(x,z) &= \frac{\partial}{\partial x}(x^2+y)|_{y = x^2 + z} + \frac{\partial}{\partial y}(x^2 + y)|_{y = x^2 + z}\cdot \frac{\partial}{\partial x}(x^2 + z)\\ &= 2x + 1 \cdot 2x = 4x. \end{align*}