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?
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!