Taking the gradient of $||\nabla f(x) - p||$ with respect to $x$ and $p$

65 Views Asked by At

$$||\nabla f(x) - p||$$

I'm trying to take the gradients of this with respect to $x$ and $p$.

For $x$, this is what I did:

$$g(x) = ||\nabla f(x) - p || = \sqrt{(\frac{\partial f}{\partial x_1}-p_1)^2 + \cdots +(\frac{\partial f}{\partial x_n}-p_n)}\implies\\ \frac{\partial g}{\partial x_i} = \frac{2(\frac{\partial f}{\partial x_i}-p_i)\frac{\partial ^2 f}{\partial x_i^2}}{2\sqrt{(\frac{\partial f}{\partial x_1}-p_1)^2 + \cdots +(\frac{\partial f}{\partial x_n}-p_n)}}$$

however I don't think there's a closed form of writing $\nabla g$. Am I right?

For $p$:

$$h(p) = ||\nabla f(x) -p|| = \sqrt{(\frac{\partial f}{\partial x_1}-p_1)^2 + \cdots +(\frac{\partial f}{\partial x_n}-p_n)}\implies \\ \frac{\partial h}{\partial p_i} = \frac{2(\frac{\partial f}{\partial x_i}-p_i)(-1)}{2\sqrt{(\frac{\partial f}{\partial x_1}-p_1)^2 + \cdots +(\frac{\partial f}{\partial x_n}-p_n)}}$$

So $$\nabla h(p) = \frac{p-\nabla f(x)}{||\nabla f(x) -p||}$$

but the result in my book is just $p-\nabla f(x)$. What am I doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

Define the variables $$\eqalign{ g &= \nabla f, \,\,\,\,\, H=\nabla g, \,\,\,\,\, dg = H\,dx \cr \phi &= \|g-p\| \cr \phi^2 &= \|g-p\|^2 = (g-p):(g-p) \cr }$$ Take the differential of the last expression and solve for $d\phi$. $$\eqalign{ 2\phi\,d\phi &= 2 (g-p):(dg-dp) = 2 (g-p):(H\,dx-dp) \cr d\phi &= \phi^{-1}H(g-p):dx + \phi^{-1}(p-g):dp \cr }$$ The desired gradients can be plucked out of this differential. $$\eqalign{ \frac{\partial\phi}{\partial x} &= H(g-p)\phi^{-1},\,\,\,\,\,\,\,\, \frac{\partial\phi}{\partial p} = (p-g)\phi^{-1} \cr\cr }$$ In some of the steps above, a colon was used to denote the trace/Frobenius product, i.e. $$A:B={\rm tr}(A^TB)$$ and property $H^T=H$ was used to simplify some expressions.

So either the book was wrong, or you made a mistake transcribing the problem.