Solving Gradient of ||f(x)||^2 - Chain Rule

  • Context: Undergrad 
  • Thread starter Thread starter perplexabot
  • Start date Start date
  • Tags Tags
    Gradient
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 2K views
perplexabot
Gold Member
Messages
328
Reaction score
5
Hey,
I have been trying to figure out how to solve [itex]\triangledown_x ||f(x)||^2_2[/itex].
I have used the chain rule (hopefully correctly) to get the following:
[tex]\triangledown_x ||f(x)||^2_2=2\triangledown_xf(x)^T \frac{f(x)^T}{||f(x)||_2}[/tex]
Is this correct?

The reason I doubt my answer is because I know the gradient of a scalar valued function should be a vector. My answer seems to give a scalar. Can anyone please shed some light...

Note: [itex]x \in \Re^n[/itex] and I am using the convection that the gradient, [itex]\triangledown_x[/itex], of a function is a row vector. Also assume [itex]f: \Re^n\rightarrow \Re^m[/itex] .
 
Last edited:
Physics news on Phys.org
So, I was washing the dishes when I realized that [tex]2\triangledown_xf(x)^T \frac{f(x)^T}{||f(x)||_2}[/tex] is not a scalar. This is because [itex]\triangledown_xf(x)^T[/itex] is a matrix (this is actually the jacobian!). So now I have a feeling the above may be close, but still wrong. I would appreciate a confirmation tho.

Thank you :)

EDIT: Just realized this is my 300th post! YAY me! Love you physics forums!
 
Last edited:
So I have made a couple of fixes, specifically making sure the matrix multiplaction agrees "dimensionally" [tex]\triangledown_x ||f(x)||^2_2=\frac{2f(x)^T}{||f(x)||_2}(\triangledown_xf(x))[/tex]
I wonder if this is correct now. Anyone?
 
My work is wrong! Here is the correct method for the sake of completeness.
[tex] \begin{equation*}<br /> \begin{split}<br /> \triangledown_x ||f(x)||^2_2 &=\triangledown_x (f(x)^Tf(x)) \\<br /> &=(\triangledown_xf(x)^T)^Tf(x)+(\triangledown_xf(x))^Tf(x) \\<br /> &=(\triangledown_xf(x))^Tf(x)+(\triangledown_xf(x))^Tf(x) \\<br /> &=2(\triangledown_xf(x))^Tf(x)<br /> \end{split}<br /> \end{equation*}[/tex]

Thank you all for reading.
EDIT: Also here and here are some references I used.