Gold Member
Hey,
I have been trying to figure out how to solve $\triangledown_x ||f(x)||^2_2$.
I have used the chain rule (hopefully correctly) to get the following:
$$\triangledown_x ||f(x)||^2_2=2\triangledown_xf(x)^T \frac{f(x)^T}{||f(x)||_2}$$
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: $x \in \Re^n$ and I am using the convection that the gradient, $\triangledown_x$, of a function is a row vector. Also assume $f: \Re^n\rightarrow \Re^m$ .

Last edited:

Gold Member
So, I was washing the dishes when I realized that $$2\triangledown_xf(x)^T \frac{f(x)^T}{||f(x)||_2}$$ is not a scalar. This is because $\triangledown_xf(x)^T$ 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:
Gold Member
So I have made a couple of fixes, specifically making sure the matrix multiplaction agrees "dimensionally" $$\triangledown_x ||f(x)||^2_2=\frac{2f(x)^T}{||f(x)||_2}(\triangledown_xf(x))$$
I wonder if this is correct now. Anyone?

Gold Member
My work is wrong! Here is the correct method for the sake of completeness.
$$\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*}$$