0

Determine the gradient of $f:\mathbb{R}^4 \rightarrow \mathbb{R}$ given by $f(x)=x^tAx$

($x^t$ denotes transpose and $A$ is $4\times 4$ matrix)

So let $$A=\begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14}\\ a_{21} & a_{22} & a_{23} & a_{24} \\ a_{31} & a_{32} & a_{33} & a_{34}\\ a_{41} & a_{42} & a_{43} & a_{44}\ \end{bmatrix} $$ and $x^t=(x_1,x_2,x_3,x_4)$. I explicitly computed out the value of $f$ and then took the gradient I came up with the answer $ \nabla f(x)=Ax+A^tx $. Can anyone tell me if this is correct?

Miz
  • 2,739
  • This can be useful: https://math.stackexchange.com/questions/222894/how-to-take-the-gradient-of-the-quadratic-form – Tomi27 Dec 18 '17 at 04:59

1 Answers1

1

It's actually true for general $n$. First, for $i,j=1,\ldots,n$, let $E_{i,j}$ be the $n\times n$ matrix with 1 in the $(i,j)$-th entry and 0 elsewhere. Also let $e_i$ be the vector in $\mathbb{R}^n$ with 1 in the $i$-th entry and 0 elsewhere. Define $f_{i,j}(x)=x^tE_{i,j}x=x_ix_j,\quad x\in\mathbb{R}^n$. So we have $$\nabla f_{i,j}(x)=x_je_i+x_ie_j=E_{i,j}x+E_{j,i}x=(E_{i,j}+E_{i,j}^t)x,\quad x\in\mathbb{R}^n.$$ Now given $A=[a_{i,j}]_{n\times n}$, we have $A=\sum_{i=1}^n\sum_{j=1}^na_{i,j}E_{i,j}$. So we get $$f(x)=x^tAx=x^t\bigg(\sum_{i=1}^n\sum_{j=1}^na_{i,j}E_{i,j}\bigg)x=\sum_{i=1}^n\sum_{j=1}^na_{i,j}x^tE_{i,j}x=\sum_{i=1}^n\sum_{j=1}^na_{i,j}f_{i,j}(x),\quad x\in\mathbb{R}^n.$$ So $$\nabla f(x)=\sum_{i=1}^n\sum_{j=1}^na_{i,j}\nabla f_{i,j}(x)=\sum_{i=1}^n\sum_{j=1}^na_{i,j}(E_{i,j}+E_{i,j}^t)x=(A+A^t)x,\quad x\in\mathbb{R}^n.$$

VENKITESH
  • 483