As the title states, say I have a function $f(x,y)$ and I am given $y$ as a function $y(x)$. Say I take the partial derivative of $f$ with respect to $x$: apparently, I am just supposed to let $y$ be a constant as if it were unrelated to $x$, as I can see by googling or from other questions on this site. (For example, this question has an answer which says so, but with no explanation.)

My question then, is why? The way I've learnt partial derivatives is always via a sort of geometric intuition: draw the surface described by $z=f(x,y)$ in $\mathbb{R}^3$, and to take $\partial f/\partial x$ is to draw a plane parallel to the $x$ and $z$ axes and orthogonal to the $y$ axis, and look at the slope of the curve along intersection of the surface of the plot and the plane. It seems then, that we can't treat $y$ as constant in the event that they are non-independant, since doing so would imply that some points on the $xy$-plane as in the previous visualisation would not be achievable. (For example, if $y=x^2$ and $f(x,y)=x+y$, it doesn't make sense to consider the point $(1,2,3)$ since it's not achievable.) I would think then that to take $\partial f/\partial x$ would require finding explicitly a function $g(x)$ so that $g(x)=f(x,y)$, then taking $\partial g/\partial x$, but apparently that is not the case.

Taken to the extreme, say $x=y$ and we have, say, $f(x,y)=x^2+y^2$. According to what's supposed to be the case, $$ \frac{\partial f}{\partial x}(x,y) = 2x. $$ If we however first substitute $x=y$ we will get $4x$. Why is my reasoning wrong? And why is the correct reasoning, well, correct?

(To be clear: I have no problems with taking partial derivatives if the variables are unrelated. I don't think this will be very useful, but for context, I encountered this in trying to apply the Euler-Lagrange equation in an applied math problem. I came into this issue as the equation required me to take the partial derivative of a function $\mathcal{L}(q,q',t)$ with respect to $q'$, where $q'=dq/dt$.)


When you take the Euler Lagrange equation, writing $\mathcal{L}(q,q',t)$ is a bit misleading. You should write $\mathcal{L}(s,p,t)$, where $s$, $p$, $t$ are independent variables. Then you compose $\mathcal{L}$ with a function $q(t)$, that is you consider the composition $g(t)=\mathcal{L}(q(t),q'(t),t)$ and now $g$ is a function of only one variable $t$ and so you cannot take partial derivatives. The only derivative that makes sense is the derivative of the function $g$ with respect to $t$. Using the chain rule you get $$g'(t)=\frac{\partial \mathcal{L}}{\partial s} (q(t),q'(t),t)q'(t)+\frac{\partial \mathcal{L}}{\partial p} (q(t),q'(t),t)q''(t)+\frac{\partial \mathcal{L}}{\partial t} (q(t),q'(t),t) 1.$$ Most people write $\frac{\partial \mathcal{L}}{\partial q'}$ for $\frac{\partial \mathcal{L}}{\partial p} $ and $\frac{\partial \mathcal{L}}{\partial q}$ for $\frac{\partial \mathcal{L}}{\partial s} $ but it is misleading.

So you are right. If you have a function $f(x,y)$ it is OK to take partial derivatives, but if you consider $x=y$ you are composing $f$ with the function $h(x)=(x,x)$ so you have $g(x)=(f\circ h)(x)$ and now the only derivative that makes sense is the one with respect to $x$ and you need the chain rule again.

Edit If you consider the energy $$\int_0^1\Big(\frac12 (q'(t))^2+V(q(t))\Big)\,dt,$$ the Lagrangian is $$\mathcal{L}(s,p)=\frac12 p^2+V(s)$$ where $(s,p)\in\mathbb{R}^2$. There is no relation between $s$ and $p$. They are real numbers and the usual geometric intuition for taking partial derivatives of $\mathcal{L}$ works just fine. Then you compose $\mathcal{L}$ with the function $(q(t),q'(t))$.

  • $\begingroup$ So can I say that we are essentially taking the partial derivative, ignoring the known relationship between two of the variables? If so, then how does the graphical intuition work; since we are confined to a certain part of the $xy$-plane and the usual idea doesn't work anymore? $\endgroup$ – YiFan Jul 29 '18 at 13:44
  • $\begingroup$ If I understand your question, you cannot. You are not ignoring the relationship between two of the variables. If you take partial derivatives the variables have to be independent. When people write Lagrangians they are making an abuse of notation or if you really want they are writing something wrong. $\endgroup$ – Gio67 Jul 29 '18 at 15:10
  • $\begingroup$ I added an example. I am sorry but I don't know how else to explain this. $\endgroup$ – Gio67 Jul 29 '18 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.