# What is the gradient of $\frac{1}{|x|}$? [closed]

Given a function $$V(x)$$: $$\displaystyle V(x) = \frac {1}{||x||}$$ What is the gradient, $$\nabla V$$, of $$V$$?

The result I saw is: $$\displaystyle -\frac {x}{||x||^3}$$.

How do I get this?

• You should complete the question showing what you have tried.
– user
Aug 23 '21 at 21:29
• More explicitly, $V(x_1,\dots, x_n)=\frac{1}{\sqrt{(x_1)^2+\cdots +(x_n)^2}}$. I'm sure using the quotient rule and standard rules of differentiation, you can calculate $\frac{\partial V}{\partial x_i}$ Aug 23 '21 at 21:31
• Hint, how do you calculate the magnitude of a vector given it's coordinates? Aug 23 '21 at 21:33

Using the definition of vector norm $$||x||=\sqrt{\sum\limits_{i}{x_i^2}}$$, we have, $$\frac{\partial V}{\partial x_i}=-\frac{1}{||x||^2}.\frac{1}{2||x||}.2x_i$$, by chain rule. Hence, $$\nabla V=\left[-\frac{x_1}{||x||^3}, -\frac{x_2}{||x||^3}, \ldots\right]^T=-\frac{x}{||x||^3}$$.
Let's first rename your function like so: $$f(\vec{\bf{v}})=\frac{1}{||\vec{\bf{v}}||}$$ We can then name each component of your vector $$\vec{\bf{v}}_x$$ and $$\vec{\bf{v}}_y$$, and have them as the individual parameters of the function and given that $$||\vec{\bf{v}}||=\sqrt{\left(\vec{\bf{v}}_x\right)^2+\left(\vec{\bf{v}}_y\right)^2}$$: \begin{align} & f(\vec{\bf{v}}_x,\vec{\bf{v}}_y)=\frac{1}{||\vec{\bf{v}}||} \\ \implies & f(\vec{\bf{v}}_x,\vec{\bf{v}}_y)=\frac{1}{\sqrt{\left(\vec{\bf{v}}_x\right)^2+\left(\vec{\bf{v}}_y\right)^2}} \end{align} Now we can differentiate this with respect to $$\vec{\bf{v}}_x$$ or $$\vec{\bf{v}}_y$$ like so: \begin{align} &f(\vec{\bf{v}}_x,\vec{\bf{v}}_y)=\left(\left(\vec{\bf{v}}_x\right)^2+\left(\vec{\bf{v}}_y\right)^2\right)^\frac{-1}{2} \\ &\frac{\partial f}{\partial \vec{\bf{v}}_x} = \frac{-1}{2}\left(\left(\vec{\bf{v}}_x\right)^2+\left(\vec{\bf{v}}_y\right)^2\right)^\frac{-3}{2}\cdot\frac{\partial \left(\left(\vec{\bf{v}}_x\right)^2+\left(\vec{\bf{v}}_y\right)^2\right)}{\partial \vec{\bf{v}}_x} \\ &\frac{\partial f}{\partial \vec{\bf{v}}_x} = \frac{-1}{2}\left(\left(\vec{\bf{v}}_x\right)^2+\left(\vec{\bf{v}}_y\right)^2\right)^\frac{-3}{2}\cdot 2 \vec{\bf{v}}_x \\ &\frac{\partial f}{\partial \vec{\bf{v}}_x} = \frac{-2\vec{\bf{v}}_x}{2}\frac{1}{\left(\sqrt{\left(\vec{\bf{v}}_x\right)^2+\left(\vec{\bf{v}}_y\right)^2}\right)^3} \\ &\frac{\partial f}{\partial \vec{\bf{v}}_x} = \boxed{\frac{-\vec{\bf{v}}_x}{\left(\sqrt{\left(\vec{\bf{v}}_x\right)^2+\left(\vec{\bf{v}}_y\right)^2}\right)^3}} \end{align} Which simplifies to: $$\frac{\partial f}{\partial \vec{\bf{v}}_x} = \boxed{\frac{-\vec{\bf{v}}_x}{||\vec{\bf{v}}||^3}}$$ And the same for differentiating with respect to $$\vec{\bf{v}}_y$$. So the gradient of your function is: \begin{align} \nabla f &= \begin{bmatrix} \frac{-\vec{\bf{v}}_x}{||\vec{\bf{v}}||^3} \\ \frac{-\vec{\bf{v}}_y}{||\vec{\bf{v}}||^3} \end{bmatrix} \\ &=\frac{-1}{||\vec{\bf{v}}||^3}\begin{bmatrix} \vec{\bf{v}}_x \\ \vec{\bf{v}}_y \end{bmatrix} \\ &=\frac{-1}{||\vec{\bf{v}}||^3}\vec{\bf{v}} \\ &=\boxed{-\frac{\vec{\bf{v}}}{||\vec{\bf{v}}||^3}} \end{align}