How do I find the gradient of a function like this? $F: \mathbb{R}^n-\{0\} \rightarrow \mathbb{R}^n$. $F(x)=\frac{x}{||x||}$ Attempt I guess find the gradient each component $D_1\frac{x_1}{\sqrt{x_1^2+\dots +x_n^2}}=\frac{x_2^2+\dots+x_n^2}{(x_1^2+\dots+x_n^2)^{3/2}}$ $D_2\frac{x_1}{\sqrt{x_1^2+\dots +x_n^2}}=\frac{-x_1x_2}{(x_1^2+\dots+x_n^2)^{3/2}}$ ,$D_3\frac{x_1}{\sqrt{x_1^2+\dots +x_n^2}}=\frac{-x_1x_3}{(x_1^2+\dots+x_n^2)^{3/2}}$,$...$ The answer given to me was $\nabla F(x)=\frac{I}{||x||}-\frac{xx^T}{||x||^3}$
Find the gradient of the function
125 Views Asked by user892057 https://math.techqa.club/user/user892057/detail AtThere are 3 best solutions below
On
To simplify, I'll do it with $n=2$. Then$$F(x,y)=\left(\frac x{\sqrt{x^2+y^2}},\frac y{\sqrt{x^2+y^2}}\right).$$Let$$F_1(x,y)=\frac x{\sqrt{x^2+y^2}}\quad\text{and}\quad F_2(x,y)=\frac y{\sqrt{x^2+y^2}}.$$Then\begin{align}\nabla F(x,y)&=\begin{bmatrix}\frac{\partial F_1}{\partial x}(x,y)&\frac{\partial F_1}{\partial y}(x,y)\\\frac{\partial F_2}{\partial x}(x,y)&\frac{\partial F_2}{\partial y}(x,y)\end{bmatrix}\\&=\begin{bmatrix}\frac1{\sqrt{x^2+y^2}}-\frac{x^2}{(x^2+y^2)^{3/2}}&-\frac{xy}{(x^2+y^2)^{3/2}}\\-\frac{xy}{(x^2+y^2)^{3/2}}&\frac1{\sqrt{x^2+y^2}}-\frac{y^2}{(x^2+y^2)^{3/2}}\end{bmatrix}\\&=\frac1{\sqrt{x^2+y^2}}\begin{bmatrix}1&0\\0&1\end{bmatrix}-\frac1{(x^2+y^2)^{3/2}}\begin{bmatrix}x^2&xy\\xy&y^2\end{bmatrix}.\end{align}Besides,$$\begin{bmatrix}x^2&xy\\xy&y^2\end{bmatrix}=\begin{bmatrix}x&y\end{bmatrix}\begin{bmatrix}x&y\end{bmatrix}^T.$$
On
As always, avoid coordinates. As $$D_p\|x\|=\frac{\langle x,p\rangle}{\|x\|}$$ we have $$D_p\frac{x}{\|x\|}= \frac{p\|x\|-x\frac{\langle x,p\rangle}{\|x\|}}{\|x\|^2}= \frac{1}{\|x\|}\left(p-\frac{x}{\|x\|} {\langle \frac{x}{\|x\|},p\rangle}\right).$$ This admits an geometric interpretation: It is the perpendicular from $p$ to $\mathbb Rx$, divided by the length of $x$.
You can use the following product rule for a scalar function $f$ and a vector valued function $F$: $$ \nabla(fF) = \nabla f\otimes F + f\nabla F, $$ in order to compute your gradient without components (Here, $v\otimes w = vw^T$). In your case $f(x) = (x^Tx)^{-\frac12}$ and $F(x)=x$, hence you get $$\begin{aligned} \nabla(fF) & = -\frac{1}{2}(x^Tx)^{-\frac32}\cdot (2x)\otimes x+(x^Tx)^{-\frac12}\nabla x \\ & = -\frac{x\otimes x}{\|x\|^3}+\frac{\mathrm{id}}{\|x\|} \end{aligned}.$$