I want to calculate the derivative of a function with respect to, not a variable, but respect to another function. For example: $$g(x)=2f(x)+x+\log[f(x)]$$ I want to compute $$\frac{\mathrm dg(x)}{\mathrm df(x)}$$ Can I treat $f(x)$ as a variable and derive "blindly"? If so, I would get $$\frac{\mathrm dg(x)}{\mathrm df(x)}=2+\frac{1}{f(x)}$$ and treat the simple $x$ as a parameter which derivative is zero. Or I should consider other derivation rules?
Asked
Active
Viewed 6.4k times
37
-
1This is a good question because it appears a lot, but for future people: This notation or question makes no sense. $g$ is a function with it's own domain and range. You can only take derivatives of $g$ with respect to it's domain. That's it. By writing $\frac{d}{df(x)}$ you are taking derivatives over what set? This notation has to mean that you are taking derivatives over the range set of $f$. Therefore this derivative, $\frac{d}{df(x)}$ only applies to functions whose domain set is this range set of $f$. $g$ is defined over the set $X$. $f$ is defined over the set $X$. You cannot apply – DWade64 Oct 19 '18 at 13:51
-
$\frac{d}{df(x)}$ to either of these functions! You can apply $\frac{d}{df(x)}$ to the inverse function of $f$, which is $f^{-1}$, because this function has the correct domain that the derivative is referring to. You can also apply $\frac{d}{df(x)}$ to the composition function $g \circ f^{-1}$, because this function also has the correct domain that the derivative is referring to. The answer given to this question is the chain rule applied to this composite function (you apply the chain rule to composite functions) – DWade64 Oct 19 '18 at 13:54
3 Answers
41
$$\frac{dg(x)}{df(x)} = \frac{dg(x)}{dx} \cdot \frac{1}{f'(x)} = \frac{g'(x)}{f'(x)}$$
In your example,
$$g'(x) = 2f'(x) + 1 + \frac{f'(x)}{f(x)}$$
So:
$$\frac{dg(x)}{df(x)} = \frac{2f'(x) + 1 + \frac{f'(x)}{f(x)}}{f'(x)} = 2 + \frac{1}{f'(x)} + \frac{1}{f(x)}$$

Deepak
- 26,801
-
2Thanks, can you give me the name of the theorem for this property? Or a link so I can take a look to the proof? – Marco Oct 02 '14 at 13:29
-
11It's all Chain Rule. It's easier to see in Leibniz notation. $\displaystyle \frac{dg}{df} = \frac{dg}{dx}\cdot \frac{dx}{df} = \frac{\frac{dg}{dx}}{\frac{df}{dx}}=\frac{g'(x)}{f'(x)}$. The other application of Chain Rule in differentiating $\ln f(x)$ should be quite obvious. – Deepak Oct 02 '14 at 14:39
-
1What happens in the case $f(x) = 0$? Does the derivative simply not exist? My guess would be that the conclusion $\dfrac{dx}{df} = \dfrac{df}{dx}$ would be wrong here and thus the whole thing reduces to $2 + \dfrac{1}{f}$ – WorldSEnder Jan 20 '16 at 17:08
-
2If $f(x)$ is identically zero over the domain, then $\frac{dg}{df}$ would not exist. In fact, even if $f(x)$ is a constant non-zero function, $\frac{dg}{df}$ would not exist because $f'(x) = 0$ (identically). If either $f(x)$ or $f'(x)$ (or both) are zero at a particular point $x_0$ then $\frac{dg}{df}$ would not exist at that point $x_0$. Also, what you wrote ($\frac{dx}{df} = \frac{df}{dx}$) is wrong in any case. The right hand side is the reciprocal of the left hand side, i.e. $\frac{dx}{df} = \frac{1}{\frac{df}{dx}}$ – Deepak Jan 20 '16 at 22:54
-
@Deepak Actually, I think that if $f'(x_0)=0$ and $f(x_0)=0$, $g'(x)$ might exist. – Simply Beautiful Art Oct 02 '16 at 00:31
-
To whoever downvoted me, know this: a downvote without a comment is totally meaningless. – Deepak Nov 15 '16 at 12:40
-
Does this chain rule hold for complex variables $\displaystyle \frac{dg(z)}{df(z)} = \frac{g'(z)}{f'(z)}$? – ThatsRightJack Nov 03 '17 at 07:19
-
@Deepak What would be the form if this were the second (or third, or fourth...) derivative? Does every successive derivative just bring another multiplicative factor of $1/f'(x)$? In other words if $dg(x)/df(x) = g'(x)/f'(x)$ is $d^2g(x)/df(x)^2 = g'(x)/(f'(x)^2)$? – iwantmyphd Sep 20 '18 at 15:41
-
1@iwantmyphd No. You can apply quotient and chain rules to determine this.$$\frac{d^2g(x)}{d^2f(x)} = \frac{d}{df(x)}(\frac{dg(x)}{df(x)})= \frac{\frac{d}{dx}(\frac{g'(x)}{f'(x)})}{f'(x)} = \frac{f'(x)g''(x) - g'(x)f''(x)}{(f'(x))^3}$$ after simplification. – Deepak Sep 23 '18 at 03:44
-
1
-
@Deepak Is this still true if $g$ is a function of $f$ rather than $x$? In other words, if the second derivative is $d^2g(f(x))/(df(x))^2$, does the result in your comment still hold? Ultimately, I want $d^2g(f)/df^2$, not $d^2g/dx^2$, although I realize that both $f$ and $g$ are themselves functions of $x$. – iwantmyphd Sep 24 '18 at 16:33
-
@iwantmyphd It wouldn't change the answer once you put everything in terms of $x$. I worked everything out in terms of the Leibniz notation, which I favour. If you use Lagrange's notation (like $f'(x)$), you should note that what you wrote is basically equivalent to $g''(f)$, which is a very tricky bit of notation. Basically, you need to express $g$ as a function of $f$, then differentiate it. It all works out in the end. You can try the first and second derivatives using a nice pair of functions like $g(x) = \sin^2 x$ and $f(x) = \sin x$. Here, note that $g(f)$ is in fact $f^2$. – Deepak Sep 26 '18 at 12:06
-
1@iwantmyphd Using that pair of functions I suggested, and applying my second derivative formula, I just proved (I guess with the most counter-intuitive method imaginable) the trig identity $\frac{2\cos x \cos 2x + \sin x \sin 2x}{\cos^3x} =2$. :) :) – Deepak Sep 26 '18 at 12:18
2
You can not. You have to derivate $f(x)$ as function.
$g'(x) = 2f'(x) + 1 + {f'(x) \over f(x)}$
EDIT: Sorry, That would make $dg(x) \over dx$, Deepak is right.

Zereges
- 216
1
You could if it were a function of $f(x)$ But it's not, due to the $x$ term.

orangeskid
- 53,909
-
So, is it true that the derivative of $g(x)=2f(x)+\log[f(x)]$ wrt $f(x)$ is equal to : $\frac{\mathrm dg(x)}{\mathrm df(x)}=2+\frac{1}{f(x)}$ ?
Applying @deepak definition it seems so.
– desmond13 Feb 15 '18 at 10:20