# derivative of a modulus of a gradient of a function with respect to the same function

I've tryied to calculate the following derivative using the chain rule, but in vain. Could you please help me with it? So I have a absolute value of a gradient of a function f, and I need to calculate the derivative of it with respect to the same function f.

$$\frac{d(|\nabla f|)}{df}$$

thanks!

To correct my question.

I came to the $$\frac{d(|\nabla f|)}{df}$$ derivative mistakenly.

The expression that wanted to evalualte was $$\nabla e^{f(x)|\nabla f(x)|}$$, and thanks to @mfl now I know how to do it.

• Look again. A gradient is a vector. Absolute values are for scalars. So those vertical bars mean what? – mvw Aug 9 '18 at 18:44
• @mvw It is $|\nabla f|=\sqrt{\nabla f\cdot \nabla f}.$ In any case it is not clear to me what derivative you want to have. Is it possible that you are looking for the derivative of $|\nabla f|$ in the direction of $\nabla f?$ – mfl Aug 9 '18 at 18:57
• Don't tell me.There seems to be something missing or wrong. – mvw Aug 9 '18 at 19:05
• @mfl So I have the magnitude of the gradient of a function $f$ with respect to the same function $f$. It came when I was calculating the following: $\nabla (exp(f(\textbf{r})|\nabla f(\textbf{r})|))$ – user582956 Aug 9 '18 at 19:30
• So, you want to get $\nabla e^{f(x)|\nabla f(x)|}.$ Is it correct? – mfl Aug 9 '18 at 19:35

We have that

\begin{align} \dfrac{\partial}{\partial x_i}e^{f(x)|\nabla f(x)|}&=e^{f(x)|\nabla f(x)|}\dfrac{\partial}{\partial x_i}(f(x)|\nabla f(x)|) \\&=e^{f(x)|\nabla f(x)|}\left(|\nabla f(x)|\dfrac{\partial}{\partial x_i}f(x)+f(x)\dfrac{\partial}{\partial x_i}|\nabla f(x)|\right) \end{align}

Now, it is

$$|\nabla f|=\sqrt{\sum_{i=j}^n\left(\dfrac{\partial f}{\partial x_j}\right)^2}$$

and thus

$$\dfrac{\partial}{\partial x_i}|\nabla f(x)|=\dfrac{\displaystyle\dfrac{\partial}{\partial x_i}\sum_{j=1}^n\left(\dfrac{\partial f}{\partial x_j}\right)^2}{\displaystyle2\sqrt{\sum_{j=1}^n\left(\dfrac{\partial f}{\partial x_j}\right)^2}}=\dfrac{\displaystyle\sum_{j=1}^n\dfrac{\partial^2 f}{\partial x_i\partial x_j}}{\displaystyle\sqrt{\sum_{j=1}^n\left(\dfrac{\partial f}{\partial x_j}\right)^2}}.$$

And now I hope you can get the answer.

• thanks so much, now I see my mistake. That derivative of the magnitude appeared because I used incorrectly the chain rule for a gradient of a composite function. – user582956 Aug 9 '18 at 21:26