# Derivative of a function with respect to another function. [duplicate]

This question already has an answer here:

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?

## marked as duplicate by Namaste, Brian Borchers, JonMark Perry, Daniel McLaury, Claude LeiboviciMar 19 '18 at 8:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• This 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

$$\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)}$$

• Thanks, 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 2 '14 at 13:29
• It'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 2 '14 at 14:39
• What 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
• If $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 2 '16 at 0:31

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.

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

• 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. – kalmanIsAGameChanger Feb 15 '18 at 10:20