How do you find gradient of an undefined vector?

216 Views Asked by At

I have the function:

$$f(\vec{x}) = \vec{x} \vec{x}^T$$

All we know is that $\vec{x}$ is a vector. Shouldn't I know how many values ($x,y,z$ etc.) my vector holds? I haven't done gradient with a vector function before, so a hint in the right direction would be much appreciated.

3

There are 3 best solutions below

1
On BEST ANSWER

The gradient is an operation that measures the increasing rate of a given function and is denoted by $grad f(\vec{x})$ or $\nabla f(\vec{x})$ and defined by $[i\partial_x+j\partial_y+k\partial_z]f(\vec{x})$, where we considered $f(x)$ in $R^3$; $i,j,k$ the unit vectors; and $\partial_x$ the derivative in $x$. It works like a derivative in n-dimensional spaces. For example, consider the function: f((x,y))=2x+3y, than the gradient of this is given by $\nabla f((x,y))=2i+3j$. This idea can be extended to $n$ dimensions, assuming the following format: Given $\vec{x}=(x_1,x_2,\ldots,x_n):=e_1x_1+e_2x_2+\ldots+e_nx_n$ and $f(\vec{x})$, then $\nabla f(\vec{x})=(e_1\partial_{x_1}+e_2\partial_{x_2}+\ldots+e_n\partial_{x_n})f(\vec{x})$, where $e_l$ works like arrow matrices, l=1,2,\ldots,n.

Now, let us see your function: $f(\vec{x})=\vec{x}\vec{x}^T$. If $\vec{x}$ is represented like above by an arrow matrix, then $\vec{x}^T$ will be a column matrix and your function is a scalar function -- and the proposed computation above can be done --, i.e., for each point $\vec{x}$ in the space $R^n$ we have a scalar value of $f(\vec{x})$. In this way: $$f(\vec{x})=(x_1)^2+(x_2)^2+\ldots+(x_n)^2 $$ $$\Rightarrow \nabla f(\vec{x})=e_1\partial_{x_1}[(x_1)]^2+e_2\partial_{x_2}[(x_2)]^2+\ldots+e_n\partial_{x_n}[(x_n)]^2=2[e_1x_1+e_2x_2+\ldots +e_n x_n] $$ $$ \Rightarrow\nabla f(\vec{x})=2\vec{x} $$

1
On

Write $x = (x_1, x_2, \ldots, x_n)$. Then your function $f$ is just $$ f(x_1, \ldots, x_n) = \sum_{i=1}^n (x_i)^2 = x_1 ^2 + \ldots + x_n^2 $$ Now $$ \frac{\partial f}{\partial x_j} = 2x_j $$ so the gradient, which is a vector of all the partials, is just $$ \nabla f(x_1, \ldots, x_n) = (2x_1, 2x_2, \ldots, 2x_n) = 2x $$ and it turns out that the number $n$ of components of $x$ was irrelevant: no matter how many components there are, you have $$ \nabla f (x) = 2x. $$

0
On

Note that you can also calculate directly with ordinary rules:

$$f(\vec{x}) = \vec{x} \vec{x}^T =\vec{x} \cdot \vec{x}$$

$$\nabla f=\frac{df}{d\vec x}=1\cdot\vec x+\vec x\cdot1=2\cdot\vec x=(2x_1,2x_2,...,2x_n)$$