Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Gradient of ||f(x)||^2

  1. Apr 19, 2016 #1

    perplexabot

    User Avatar
    Gold Member

    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: Apr 19, 2016
  2. jcsd
  3. Apr 19, 2016 #2

    perplexabot

    User Avatar
    Gold Member

    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: Apr 19, 2016
  4. Apr 20, 2016 #3

    perplexabot

    User Avatar
    Gold Member

    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?
     
  5. Apr 21, 2016 #4

    perplexabot

    User Avatar
    Gold Member

    My work is wrong! Here is the correct method for the sake of completeness.
    [tex]
    \begin{equation*}
    \begin{split}
    \triangledown_x ||f(x)||^2_2 &=\triangledown_x (f(x)^Tf(x)) \\
    &=(\triangledown_xf(x)^T)^Tf(x)+(\triangledown_xf(x))^Tf(x) \\
    &=(\triangledown_xf(x))^Tf(x)+(\triangledown_xf(x))^Tf(x) \\
    &=2(\triangledown_xf(x))^Tf(x)
    \end{split}
    \end{equation*}
    [/tex]

    Thank you all for reading.
    EDIT: Also here and here are some references I used.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Gradient of ||f(x)||^2
Loading...