# Partial derivatives seem to depend on how variables are defined

Suppose I have $$f_1(x,y) = x^2+xy+y^2$$. Then $$\frac{\partial f_1}{\partial x} = 2x + y$$.

But then if I define $$u=x^2$$, and then $$f_2(x,y,u)=u+xy+y^2$$. Then $$\frac{\partial f_2}{\partial x} = y$$. Yet, $$f_1$$ and $$f_2$$ are in some sense exactly the same function.

Is this expected, or am I misusing the partial derivative?

How I think this paradox is resolved: The first function maps from $$\mathbb{R}^2$$ to $$\mathbb{R}$$, and the second function could really be seen as a mapping from a particular 2-dimensional manifold $$M\subseteq \mathbb{R}^3$$ (defined by $$M=\{(x,y,z):z=x^2\}$$). If we first map $$\mathbb{R}^2$$ to $$M$$, then compose with $$f_2$$, that's exactly equal to $$f_1$$.

So: maybe the answer is that viewing $$f_2$$ as a function from $$\mathbb{R}^3\rightarrow\mathbb{R}$$, then $$\frac{\partial f_2}{\partial x}=y$$ is exactly right. But if we use the fact that $$u=x^2$$, then we view $$f_2$$ as a function from $$\mathbb{R}^2\rightarrow\mathbb{R}$$, it's not right. The ambiguity seems to come from the fact that $$\frac{\partial}{\partial x}$$ could be a tangent vector of either $$\mathbb{R}^3$$ or $$\mathbb{R}^2$$, and on a case-by-case basis, one would need to be clear about which one it is.

Except, I don't see that clarity in most uses of partial derivatives. If there is a function defined on $$n$$ variables, and then it's decided that there is actually some relationship between those variables (so the function really describes a function from some lower-dimensional manifold in $$\mathbb{R}^n$$), how is that denoted, and does it change how I should approach partial derivatives?

EDIT: To make the example more clear: If we define $$f_1(x,y,u)=x^2+xy+y^2$$, then $$f_1=f_2$$ when restricted to $$\{(x,y,u):u=x^2\}$$. Then both are most naturally thought of as functions from $$\mathbb{R}^2$$ to $$\mathbb{R}$$, but both are defined using $$\mathbb{R}^3$$.

• In which sense are $f_1$ and $f_2$ the same function? Nov 4, 2021 at 10:58
• Of course this is expected, since the meaning of $\partial/\partial x$ depends not only on what $x$ is, but also on what other quantities are supposed to be held constant as $x$ varies (which has to be spelled out explicitly or deduced from the context). Nov 4, 2021 at 11:16
• You can simplify your example. $f_1(x) = x$, define $u =x$ and $f_2(x,u) = u$. Do you think $f_1,f_2$ are the same function? Nov 4, 2021 at 12:04
• If $f_1(x,u)=x$, then they are different functions over $\mathbb{R}^2$, but the same function from the 1-D manifold $\{(x,u):x=u\}$. Which perspective does the partial derivative take? Nov 4, 2021 at 17:34

From a modern point of view, it's best to just not use dependent variables. Dependent variables have long been replaced by the concept of a function. Whenever you use dependent variables, especially in the context of analysis, you should instead model those dependent variables as functions.

Here specifically, you have a function $$f_2$$ of three variables. That's a function $$f_2:\mathbb R^3\to \mathbb R$$. Then you say that you want $$u$$ to equal $$x^2$$. Now all three variables are supposed to depend on only two variables. So here you should introduce a new function $$h:\mathbb R^2\to\mathbb R^3$$ which maps $$(x,y)\mapsto(x^2,x,y)$$. This function models how your three variables $$u,x,y$$ depend on $$x$$ and $$y$$. Now your function $$f_1$$ is simply

$$f_1=f_2\circ h.$$

Note that $$f_1$$ and $$f_2$$ are not the same function. They don't even have the same domain. So it should be no surprise that their partial derivatives are different. When taking partial derivatives of functions with dependent variables, you should be very clear which function you're taking the partial derivatives of, because they're not the same!

In a physics context, I've seen the following way of specifying the function to differentiate: $$\frac{\mathrm d}{\mathrm dx}$$ means to take the partial derivative of $$f_1$$ with respect to $$x$$ (though they call this a total derivative), while $$\frac{\partial}{\partial x}$$ means to take the partial derivative of $$f_2$$ with respect to $$x$$. The $$\mathrm d$$ essentially says to take all dependencies on $$x$$ into account, while $$\partial$$ says to only take "explicit" dependencies into account.

• So in this case it's correct that $\frac{\partial f_2}{\partial x} = y$, but to use that in a more meaningful context (say, finding the total derivative), one would end up needing to account for the relationship between $x$ and $u$. Nov 4, 2021 at 17:24
• Yes, that's right. Nov 4, 2021 at 18:06

Unfortunately, $$f_1$$ and $$f_2$$ are not the same functions, indeed as you observed the domain is the same and so will be the graphic, differential, and so on.

Your principal mistake stands in the very beginning:

$$\frac{\partial}{\partial x}f_2=\frac{\partial}{\partial x}u+y=2x+y=\frac{\partial}{\partial x}f_1$$

Although a partial derivative is not exactly the same as a derivative on $$\mathbb{R}$$, the derivation of a sum still holds: the derivative of a sum is the sum of derivatives and the function $$u$$ depends on $$x$$, thus you can't ignore its derivative.

• Wikipedia disagrees: en.wikipedia.org/wiki/…. This matches a few other places where people say a partial derivative assumes another variable stays fixed. Nov 4, 2021 at 11:55
• @SamJaques Where exactly do you think Wikipedia tells something else? Nov 4, 2021 at 11:59
• @SamJaques I invite you to look at the chain rule: en.wikipedia.org/wiki/Chain_rule#Multivariable_case in multivariable case you will find out what I meant. Nov 4, 2021 at 14:22
• "However, if y depends on x, the partial derivative does not give the true rate of change of f as x changes because the partial derivative assumes that y is fixed." If $f_2$ is seen as a function from $\mathbb{R}^3$ to $\mathbb{R}$, I don't see why the relationship between $u$ and $x$ should appear as part of the partial derivative. More specifically, suppose I tell you that $g(x,y,u)=0$ for some $g$, but don't tell you $g$, does that really mean that you can't compute $\frac{\partial f_2}{\partial x}$? Nov 4, 2021 at 17:29
• @DavideTrono the page you linked discusses cases where we're focusing on a change of variables, which seems (sort of?) different than this case. Even at the end of that section, though, it says "For example, the total derivative of $f(x(t),y(t))$ is $\frac{df}{dt} = \frac{\partial f}{\partial x}\frac{\partial x}{\partial t} + \frac{\partial f}{\partial y}\frac{\partial y}{\partial t}$. Here there is no $\partial f/\partial t$ term since $f$ itself does not depend on the independent variable $t$ directly." Nov 4, 2021 at 17:33

Yet, f1 and f2 are in some sense exactly the same function.

They are the same function if you set $$u$$ as $$x^2$$.   In that case, $$x$$ and $$u$$ are not independent variables; so $$\tfrac{\partial u}{\partial x}\neq 0$$ .

You have $$f_1(x,y)= f_2(x,y,x^2)$$. Applying the chain rule gives:

\begin{align}\dfrac{\partial f_1(x,y)}{\partial x}&=\left.\dfrac{\partial f_2(x,y,u)}{\partial x}\right|_{u=x^2}\dfrac{\partial x}{\partial x}+\left.\dfrac{\partial f_2(x,y,u)}{\partial y}\right|_{u=x^2}\dfrac{\partial y}{\partial x}+\left.\dfrac{\partial f_2(x,y,u)}{\partial u}\right|_{u=x^2}\dfrac{\partial x^2}{\partial x}\\[3ex]\dfrac{\partial (x^2+xy+y^2)}{\partial x}&=\left.\dfrac{\partial (u+xy+y^2)}{\partial x}\right|_{u=x^2}+0+\left.\dfrac{\partial (u+xy+y^2)}{\partial u}\right|_{u=x^2}\dfrac{2x}{}\\[3ex]2x+y&=[0+y+0]_{u=x^2}+[1+0+0]_{u=x^2}\cdot 2x\end{align}

• Under your notation, then $\frac{\partial f_2}{\partial x}\vert_{u=x^2}$ is still $y$. What does the $\vert_{u=x^2}$ add? Nov 5, 2021 at 8:42
• Substitute $x^2$ for $u$ (which takes place after the derivation). Nov 6, 2021 at 0:40