# Confusion about commuting partial derivatives

I was wondering if someone knows what exactly the error is in the following manipulations involving partial derivatives. Supposing that $$y=x^2$$ then $$\frac{\partial}{\partial x} \frac{\partial}{\partial y} y = \frac{\partial}{\partial x} 1 = 0$$ but $$\frac{\partial}{\partial y}\frac{\partial}{\partial x} y = \frac{\partial}{\partial y} 2x = \frac{\partial}{\partial y} 2 y^{1/2} = y^{-1/2}$$. I feel like it must be something to do with treating y as an independent variable but I'm not sure what the rigorous reason is?

• Hi, I hope this is clearer. Essentially $\partial_y = \frac{\partial}{\partial y}$ for instance. Jul 30, 2021 at 20:11
• That is only true when x and y are independent variables. Here y is dependent on x. Hence, you can't commute the operators. Jul 30, 2021 at 20:16
• What you are doing is not partial differentiation. Not even remotely close to it. Jul 30, 2021 at 20:18
• To have partial derivatives you need a function of $n$ inputs, and the partial derivative is what happens if you vary one input while holding all other inputs constant. It has nothing to do with the names of variables; the $\partial_x$ notation is merely a convenient way to identify which input you're varying when you have labeled all the inputs. Here you have two variables but you have not identified them with the inputs of any two-variable function. Jul 30, 2021 at 20:23
• Hi, thanks a lot for your comments. What I wrote did seem very illegitimate. Essentially the question arose when considering another function $g=g(y(x),z)$ and considered differentiating first with respect to $y$ and then with respect to $x$. Is this a valid thing to consider doing? Perhaps this would require taking the total derivative w.r.t x after the partial w.r.t $y$? Jul 30, 2021 at 20:30

Your $$y$$ is a function of the variable $$x$$. Hence $$\frac{\partial}{\partial y}y =1$$ is wrong, because $$y$$, being a function of $$x$$, does not depend on $$y$$ at all. For all purposes, I can replace your $$y$$ by $$f(x)$$, and then obviously $$\frac{\partial}{\partial y}f =0$$, and so is $$\frac{\partial}{\partial f}f$$, which may look a bit unusual, and for a good reason too - it is unusual because it is nonsensical.
• Hi, thank you for your answer. I was wondering if I could ask a follow-up question. Supposing that we had the function $f=f(y(x))=y(x)= x^2$ what would be the error in the manipulations: $\frac{\partial}{\partial x} \frac{\partial}{\partial y} f = 0$ but $\frac{\partial}{\partial y} \frac{\partial}{\partial x} f = \frac{\partial}{\partial y} (2x) = 2/(\frac{\partial}{\partial x}y)=1/x$? Jul 31, 2021 at 8:11