Let $f(x,y)=x-y$. If I let $y=-x$, then $$\frac{\partial f(x,y)}{\partial x}=\frac{\partial x}{\partial x}=1$$ (since $y$ is treated as constant in the partial derivative) or $$\frac{\partial f(x,y)}{\partial x}=\frac{\partial (x-(-x))}{\partial x}=2$$ (since $y=-x$ is actually not a constant)?
2026-04-15 13:22:01.1776259321
Partial derivatives of $f(x,y)=x-y$
87 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
2
If you let $y=-x$ then it doesn't make sense to speak about partial differentiation. Recall that a partial derivative is a notion tailored to differentiate a function of several variables along a certain "path"; that is to say, if $f: \mathbb{R}^3 \rightarrow \mathbb{R}$, then $\frac{\partial f}{\partial x}(r)=\lim_{t\rightarrow0}\frac{f(r+te_x)-f(r)}{t}$, and $r$ stands for $(x,y,z)$. This means $f$ is differentiated along the path of constant $y$ and $z$.
When you say "let $y=-x$" you are composing your original function with the function $g(x)=(x,-x)$ to create the function $f^*(x)=f\circ g=2x$. At that point your function is no longer a function of several variables, but only of one; partial differentiation becomes useless (or rather, redundant as it simply coincides with the ordinary derivative). Hence, one could write $\frac{\partial f^*}{\partial x}=\frac{df^*}{dx}=2$.
None of this takes away from the fact that $\frac{\partial f}{\partial x}=1$. But the second differentiation is no longer of $f$, but of $f^*$, that is, of $f$ composed with your restriction that $y=-x$; hence there is no contradiction in noting that they are not equal. In fact one can even write one in terms of the other, with the aid of our dear chain rule.
EDIT: Main Takeaway
The main takeaway of this answer is that one needs to be careful when saying things like "so and so variables are fixed/ depend on that and that variable". These statements are made precise by the notion that "a variable dependending on another variable" is equivalent to composing the original function with another function which relates the relevant variables. But at that point the new function which results from the composition is no longer the same function; in particular, its derivative will no longer be the same. I suggest you begin thinking of the functions in themselves instead of the whole "what variable depends on what" deal; that way, you will never be confused, because you can always go back to the definition of derivative of composite functions, the chain rule. But to answer your comment concretely and to connect this view with your previous intuition, it would be more correct to say: $\frac{\partial f}{\partial x}=1$ always, because $f$ is a definite univocal function of $(x,y)$; which is to say, in your terms, that $\frac{\partial f}{\partial x}=1$ when $y$ doesn't depend on $x$(which is always, in the sense that the function $f$ is a function which always sends $x$ and $y$ to a unique number, irrespectively of the values of $y$ in relation to $x$).
As for your second statement, it would be more correct to say that $\frac{d(f\circ g)}{dx}=df[g'(x)]$ or $\frac{d(f\circ g)}{dx}=\nabla f^T g'(x)$, whichever you prefer, that in any case is the same as saying $\frac{d(f\circ g)}{dx}=\frac{\partial f}{\partial x}-\frac{\partial f}{\partial y}$, because $g'(x)=(1,-1)$. The notation $$\begin{equation} \frac{df}{dx}=\sum_{i=1}^2 \frac{dx^i}{dx}\frac{\partial f}{\partial x_i} \tag{1}\label{1} \end{equation}$$ where $x^i$ ranges from $x$ to $y$ is merely sugestive; a mnemonic, if you will, to remember the chainrule. One should not dispose of it but one should also not take it too seriously: after all, it is only a symbolic representation of the chain rule, a computational trick. $f$ still stands for $f \circ g$ and the $x^i$ functions that are being differentiated stand for the component functions of g(x), i.e $x^1=x$ and $x^2=y=-x$; that all is to say that the correct notion is still that of the derivative of a composition of function $f$ with some other function.
You will often, in physics for example all the time, encounter some variant of equation \eqref{1}. They will merely say: "let $y$ depepend on $x$": usually they won't change the name of $f$, that is, they call $f$ and $f \circ g$ both $f$, and they name the component functions by $x,y,z,...$; then, they call the derivative the "total" derivative of $f$. But this never ceases to be just the ordinary derivative of a composite function. The only harm in thinking like this is that it is ambiguous and unnecessarily obscure, as you have found; and the perks are that the chain rule is easier to remember that way and it is computationally more efficient.
To conclude, your two statements are slightly imprecise but the general idea is correct in general, assuming that all the notation has been properly defined and everyone knows what you're doing. I say this because in practice no one will go to such lengths as to say "oh actually this function is no longer $f$", they'll just call it $f$ anyway.