2014-10-01 15:03:30 8 Comments

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?

### Related Questions

#### Sponsored Content

#### 1 Answered Questions

### [SOLVED] Deriving multivariate equations with respect to one variable

**2017-12-30 23:19:03****duhaime****72**View**1**Score**1**Answer- Tags: calculus multivariable-calculus derivatives

#### 1 Answered Questions

### Which variable has to be with respect to for partial derivative in minimization algorithm?

**2017-08-14 02:38:55****Jan****67**View**0**Score**1**Answer- Tags: calculus algorithms partial-derivative

#### 0 Answered Questions

### Derivative of a vector with respect to a vector

**2017-06-22 15:29:40****Paolo Caputo****120**View**0**Score**0**Answer- Tags: partial-derivative matrix-equations matrix-calculus jacobian

#### 2 Answered Questions

### [SOLVED] Partial derivative of the logistic function

**2014-05-17 18:02:06****Jack Twain****1567**View**2**Score**2**Answer- Tags: calculus partial-derivative

#### 1 Answered Questions

### [SOLVED] Derivative of vector product with respect to a vector

**2017-05-23 10:00:06****Neostek****917**View**2**Score**1**Answer- Tags: derivatives partial-derivative vector-analysis

#### 1 Answered Questions

### [SOLVED] Derivative of a function w.r.t another function

**2017-02-07 10:03:53****user137684****374**View**-1**Score**1**Answer- Tags: derivatives

#### 2 Answered Questions

### [SOLVED] Derivative of a function with respect to x containing integral over y

**2015-08-06 15:09:42****Nina****1684**View**2**Score**2**Answer- Tags: integration derivatives

#### 2 Answered Questions

### [SOLVED] Derivative of function composed with itself

**2015-02-04 21:46:15****Libor****500**View**0**Score**2**Answer- Tags: derivatives partial-derivative

#### 1 Answered Questions

### [SOLVED] Derivative with respect to another function

**2015-01-16 09:55:56****Varun Iyer****348**View**3**Score**1**Answer- Tags: calculus reference-request derivatives

#### 1 Answered Questions

### [SOLVED] Partial Derivative of the one variable function

**2014-09-01 17:07:05****Fsantus****880**View**2**Score**1**Answer- Tags: derivatives

## 3 comments

## @Orest Bucicovschi 2014-10-01 15:43:36

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

## @kalmanIsAGameChanger 2018-02-15 10:20:08

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.

## @Deepak 2014-10-01 15:09:54

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

## @Marco 2014-10-02 13:29:40

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?

## @Deepak 2014-10-02 14:39:52

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.

## @WorldSEnder 2016-01-20 17:08:15

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

## @Deepak 2016-01-20 22:54:18

If $f(x)$ is

identicallyzero 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 aparticular 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}}$## @Simply Beautiful Art 2016-10-02 00:31:54

@Deepak Actually, I think that if $f'(x_0)=0$ and $f(x_0)=0$, $g'(x)$ might exist.

## @Deepak 2016-11-15 12:40:39

To whoever downvoted me, know this: a downvote without a comment is totally meaningless.

## @ThatsRightJack 2017-11-03 07:19:11

Does this chain rule hold for complex variables $\displaystyle \frac{dg(z)}{df(z)} = \frac{g'(z)}{f'(z)}$?

## @iwantmyphd 2018-09-20 15:41:53

@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)$?

## @Deepak 2018-09-23 03:44:57

@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 2018-09-23 05:41:46

Sorry the extreme LHS should've read $$\frac{d^2g(x)} {(df(x))^2} $$

## @iwantmyphd 2018-09-24 16:33:57

@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$.

## @Deepak 2018-09-26 12:06:32

@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 2018-09-26 12:18:43

@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$. :) :)

## @Zereges 2014-10-01 15:08:53

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.