Derivative of function with respect to function of function If I have a function $f$ of $g$ where $g$ is also a function of $f$, is it possible to find $\frac{df}{dg}$? In my eyes, the problem is that one would have some kind of "infinite chain rules" problem, as you want to find
$\frac{df(g(f(g(f(g(f(g...)}{dg(f(g(f(g(f(g...)}$
or am I mistaken? To give an explicit example, consider the following system of equations:
$ W = \frac{\sum_i x_iw_i(x_i)}{\sum_i x_i} $
$ x_1 = W(x_1) * \frac{\gamma_1(x_1)}{\delta_1(x_1)}$
Is it possible to find $\frac{dx_1}{dW}$ ?
Thanks!
 A: It makes no sense to take a derivative with respect to a function(*). Remember what a derivative is: it's a limit $\lim_{h\to 0} \frac{f(x+h)-f(x)}{h}$. You can make $f$ a complicated expression involving the composition of a lot of functions, but at the end of the day you are taking the derivative with respect to some variable $x$ (and fixing everything else).
If $f(x) = F(x, g(x))$ and $g(x) = G(x, f(x))$ both depend on $x$ and each other, you can still compute the (total) derivative:
$$\frac{df}{dx} = D_1F + D_2F\frac{dg}{dx} = D_1F + D_2F(D_1G + D_2 G \frac{df}{dx}$$
where $D_i$ means partial differentiation with respect to the $i$th parameter; you shouldn't think of this as "infinite recursion"(**) but rather as a linear equation relating $\frac{df}{dx}$ to some other functions. You can even solve for $\frac{df}{dx}$:
$$\frac{df}{dx} = \frac{D_1F + D_2FD_1G}{1-D_2FD_2G}.$$
As for your example, I'm not ever sure what you mean by the notation $\frac{dx_1}{dW}$. My best guess is that you want to use the inverse function theorem to write $x_1$ as a function of $W$ (holding all of the other $x_i$ fixed), which you can do from your first equation, but then I'm not seeing where the second equation comes in, or the "infinite chain rule."
(*) Well you can, in the context of the calculus of variations, but that's not what you mean here.
(**) Setting aside the question of how you plan to evaluate $f$ or $g$ in the first place.
