# When substitution works and when it fails (differentiation)

I would like to solve a problem, where I differentiate a function by a fraction, something like this:

$$\frac{\partial (x_1^\delta / x_2^\gamma)}{\partial (x_1/x_2)}$$

I was told that such a problem could be solved by a substitution: $$z = x_1/x_2$$, expressing problematic variables in terms of $$z$$ and then differentiating by $$z$$. Supposedly, this approach could function as a substitute to chain rule.

However, I stumbled upon few problems and decided to test it out. The new case I tried it on was the following:

$$\frac{\partial(x_1/x_2)^\gamma}{\partial(x_1/x_2)}$$

I know the solution of this problem:

$$\frac{\partial(x_1/x_2)^\gamma}{\partial(x_1/x_2)} = \gamma \left( \frac{x_1}{x_2} \right)^{\gamma-1}$$

Nevertheless, when I try to solve it by the substitution, the results differ:

$$\frac{\partial \left( \frac{z \cdot x_2}{x_1/z} \right)^\gamma}{\partial z} = \frac{\partial(z x_2 x_1^{-1} z)^\gamma}{\partial z} = \frac{\partial(z^2 x_2 x_1^{-1} )^\gamma}{\partial z} = \gamma (z^2 x_2 x_1^{-1} )^{\gamma-1} x_2 x_1^{-1} 2 z$$

Substituting $$z = x_1/x_2$$ back I obtain the following:

$$\gamma \left(\frac{x_1}{x_2} \right)^{\gamma-1} \cdot2$$

As we can see, the results differ... Not substantially (only constant) but differ none the less...

The question:

• Did I do some mistake?
• Do I use this approach correctly?
• When this approach can be used and when it cannot be?
• To begin with, what do you even mean by the partial derivative with respect to $x_1/x_2$? In order for that to make sense, you need to specify what other quantity (or quantities) should be held constant; see this question, for example. Mar 18, 2023 at 16:16

You correctly chose $$z = \frac{x_1}{x_2}$$, but then you plugged it in incorrectly (not sure how). If you substitute in directly, you should have gotten

$$\frac{\partial z^\gamma}{\partial z} = \gamma z^{\gamma - 1}$$

Your expression $$\frac{z x_2}{x_1/z}$$ is also correct by plugging in $$z$$ but you missed that there is an additional dependence on $$z$$! In the way you plugged in, there is $$z$$ in the numerator and $$z$$ in the denominator of the denominator, but you missed that

$$\frac{x_2}{x_1} = \frac{1}{z} \implies x_2 x_1^{-1} = z^{-1}$$

This explains the difference and the mistake you made--you missed the product rule here (or more simply you just missed the full simplification). This is why the substitution method is challenging--an extra variable could come from anywhere and it's easy to lose track!

• ooooooh... Thank you very much! That is really clever! I plugged it in like this: $x_1 = z x_2$ and $x_2 = x_1/z$. And I thought my work there is done... BUT, does this mean some hardcore functional form could be insolvable this way? What if my function was $x_1^\delta$ differentiated by the fraction? Does this mean: $x_1^\delta = (z x_2)^\delta = (z z^{-1} x_1)^\delta = (z z^{-1} z x_2)^\delta = \dots = (z z^{-1} z z^{-1} z z^{-1} z z^{-1} \dots x_1)^\delta$? Mar 18, 2023 at 15:07
• I thought this substitution would allow me to work with $x_1$ and $x_2$ as constants, if I differentiate only by $z$. This is not correct, right? Mar 18, 2023 at 15:13
• That's right. That is where use the chain rule. So like your derivative should have had $\frac{\partial x_1}{\partial z}$ and $\frac{\partial x_2}{\partial z}$ in it, if you used the complicated transformation you did. Mar 18, 2023 at 15:35
• For you question, like $x_1^\delta/x_2^\gamma$, you would substitute as $z^{\gamma} x_1^{\delta - \gamma}$. And then differentiating with the product rule would give $\gamma z^{\gamma - 1} x_1^{\delta - \gamma} + z^{\gamma} (\delta - \gamma) x_1^{\delta - \gamma - 1} \frac{\partial x_1}{\partial z}$. Mar 18, 2023 at 15:38
• $\frac{\partial x_1}{\partial z} = x_2$ and $\frac{\partial x_2}{\partial z} = -\frac{x_1}{z^2}$. Mar 18, 2023 at 15:39