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

  • I
  • Thread starter perplexabot
  • Start date
  • Tags
    Gradient
In summary, the conversation discusses the process of solving for the gradient of a function with the given parameters. The individual has used the chain rule to obtain a potential solution, but they are unsure if it is correct as the resulting expression appears to be a scalar instead of a vector. After further analysis and corrections, the individual provides the correct method for finding the gradient. They also provide references for additional information on the topic.
  • #1
perplexabot
Gold Member
329
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
  • #2
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:
  • #3
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?
 
  • #4
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.
 

1. What is the gradient of ||f(x)||^2?

The gradient of ||f(x)||^2 is the vector that contains the partial derivatives of the function f(x) with respect to each of its input variables.

2. How do you solve for the gradient of ||f(x)||^2 using the chain rule?

To solve for the gradient of ||f(x)||^2 using the chain rule, you first need to calculate the derivative of the function ||f(x)||^2 using the chain rule. Then, you can plug in the values for the partial derivatives of f(x) in the resulting expression to obtain the gradient.

3. Why is the chain rule important in solving for the gradient of ||f(x)||^2?

The chain rule is important in solving for the gradient of ||f(x)||^2 because it allows us to find the derivative of a composite function, which is necessary in calculating the gradient of a function that involves multiple input variables.

4. Can the chain rule be applied to any function?

Yes, the chain rule can be applied to any function, as long as it is a composite function where one function is nested inside another.

5. Are there any other methods for solving for the gradient of ||f(x)||^2?

Yes, there are other methods for solving for the gradient of ||f(x)||^2, such as using the product rule or quotient rule depending on the form of the function. However, the chain rule is often the most efficient and straightforward method for finding the gradient.

Similar threads

Replies
2
Views
1K
Replies
3
Views
1K
Replies
4
Views
1K
  • Calculus
Replies
9
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
456
  • Calculus
Replies
2
Views
1K
Replies
3
Views
1K
Replies
3
Views
1K
Back
Top