# Confusion about differentiating a variable with respect to a function of that variable (and others).

I was considering this function $$F(g(x_1,x_2,...,x_n),x_1,x_2,...,x_n, y,z)$$ (I guess you could really forget about listing $$g$$ as an argument of $$F$$ but I just wanted to stress that the $$x_j$$ appear in a combination which equals $$g$$. I wanted to find the mixed derivative $$\frac{\partial }{\partial x_i } \frac{\partial F(g(x_1,x_2,...,x_n),x_1,x_2,...,x_n, y,z)}{\partial g }$$ (I'm not sure the use of partials here is technically correct). I was wondering (A) is this a valid thing to do and (B) if it is how would you differentiate the "loose" $$x_j$$ terms with respect ot $$g$$? Something like $$\frac{\partial }{\partial g} = \sum \limits_{i}^{} \frac{\partial x_i}{\partial g} \frac{\partial }{\partial x_i}$$ doesn't seem to give a reasonable result? Does this only work if $$g$$ is a function of a single variable, say $$x_1$$?

• please don't ever write things like $\frac{\partial}{\partial g}$. I suggest you take a look at the following answer of mine: partial derivative of functions of functions to see how to properly interpret the partial derivative notation and how to write things correctly Jul 31, 2021 at 21:24
• Hi, thanks a lot for pointing me to that post. I find your notation very helpful in clearing things up. There were just a couple of things that I was still unsure about after reading. If we have have $f:\mathbb{R}\times \mathbb{R} \to \mathbb{R}: f(x(t),t) = x(t)+t^2$ with $x(t)=t^2$ say, what if we were to consider $(\partial_1 f)(x(t),t)$? Would this be equal to 2 or to 1 (I would have thought the former as surely we just note $t^2=x(t)$? Aug 1, 2021 at 11:13
• Secondly, how exactly do we consider $(\partial_1 f)(x(t),t)$ because, as you say, it's not possible to vary $x(t)$ without varying $t$? Are we literally thinking about varying the definition of the function $x:\mathbb{R} \to \mathbb{R}$? Aug 1, 2021 at 11:13

First of all, saying the definition of $$f$$ is "$$f(x(t),t)=x(t)+t^2$$ with $$x(t)=t^2$$" is a nonsense definition for the function $$f$$. One should say "define $$f:\Bbb{R}^2\to\Bbb{R}$$ as $$f(\xi,\eta)=\xi+\eta^2$$" for example. Or even saying "$$f:\Bbb{R}^2\to\Bbb{R}$$ as $$f(@,\sharp)=@+\sharp^2$$" is fine, because as I mentioned, the choice of symbols do not matter. What is important however is that you have to prescribe for me the value of $$f$$ at any arbitrary point of the domain. In this case, the function $$f$$ takes as input a tuple of real numbers,and as an output it gives you the first entry of the tuple added to the square of the second entry. So, $$f(7,4)=7+4^2=23$$ and so on.

Next, I think you should reread the entire second half of my answer there because it seems you're still not clear on the difference between the distinction between a function and its values at certain points.

Now you're saying you want to introduce a new function $$x:\Bbb{R}\to\Bbb{R}$$ defined as $$x(t)=t^2$$ for all $$t$$. Ok. At this stage, I could define a billion other functions. It still will not affect what $$\partial_1f$$ and $$\partial_2f$$ are. Just to make this abundantly clear: for all $$(\xi,\eta)\in\Bbb{R}^2$$, we have \begin{align} (\partial_1f)(\xi,\eta)&=1\\ (\partial_2f)(\xi,\eta)&=2\eta \end{align} So, $$\partial_1f$$ is the function which regardless of what it takes as input, always gives the number $$1$$ as output, i.e it is the constant function $$1$$. Next, $$\partial_2f$$ is the function which eats a tuple of numbers and spits out twice the second entry of the tuple. That's it.

So, for each $$t\in\Bbb{R}$$, the quantity $$(x(t),t)$$ is a tuple of numbers, hence we can plug this into $$\partial_1f$$ and $$\partial_2f$$. So, as per above, we get \begin{align} (\partial_1f)(x(t),t)&=1\\ (\partial_2f)(x(t),t)&=2t \end{align}

For your question about how can we consider $$(\partial_1f)(x(t),t)$$, I suggest you reread my linked answer. By definition, the symbol $$(\partial_1f)(@,\sharp)$$ means \begin{align} (\partial_1f)(@,\sharp)&:=\lim_{h\to 0}\frac{f(@+h,\sharp)-f(@,\sharp)}{h} \end{align} As you can see, the only thing needed to compute this limit is knowledge of the function $$f$$ and the point of consideration $$(@,\sharp)$$. So, similarly, if you fix a value of $$t\in\Bbb{R}$$, then $$(x(t),t)$$ is a particular tuple of real numbers, and we have \begin{align} (\partial_1f)(x(t),t)&:=\lim_{h\to 0}\frac{f(x(t)+h,t)-f(x(t),t)}{h} \end{align}

What you're probably getting confused with is what happens when we consider the single variable function $$g:\Bbb{R}\to\Bbb{R}$$ defined as $$g(t)=f(x(t),t)$$. Suppose I want to calculate the derivative of $$g$$ at $$\pi$$. Well, the chain rule tells us \begin{align} g'(\pi)&=(\partial_1f)(x(\pi),\pi)\cdot x'(\pi)+(\partial_2f)(x(\pi),\pi)\cdot 1\\ &=1\cdot x'(\pi)+2\pi\cdot 1\\ &=2\pi+2\pi\\ &=4\pi \end{align} Just so we're absolutely sure, lets verify this another way. We have \begin{align} g(t)=f(x(t),t)=x(t)+t^2=t^2+t^2=2t^2 \end{align} So, of course, $$g'(\pi)=4\pi$$, just as we calculated. Of course, this entire calculation holds not only for the specific number $$\pi$$, but for any real number $$t$$. So, \begin{align} g'(t)=(\partial_1f)(x(t),t)\cdot x'(t)+(\partial_2f)(x(t),t)\cdot 1 = 4t. \end{align}

In my linked answrr, I explicitly wrote down the limit definitions of $$(\partial_2f)(x(t),t)$$ and of $$g'(t)$$. Compare the differences.

• Thank you very much for your detailed answer. This is a very helpful way of thinking about multivariate functions and partial derivatives which I shall certainly keep in mind moving forward. I believe my confusion was rooted in the fact that it is not possible to think about taking the partial derivative with respect to some function of the arguments of a multivariate function. In my head this seemed plausible because it is possible for single-variable functions. Aug 5, 2021 at 10:09