partitioned matrix differentiation

199 Views Asked by At

I know how to differentiate a product of matrices wrt a given matrix-entry e.g., $X_{i, j}$. However, I'm not sure if I'm thinking correctly about how to do that when I have a vector i.e., just one column.

I have $\mathbf{x^{\top}Ax}$ and I want it's derivative wrt $x_{i}$. Suppose that $\mathbf{x}$ is $4 \times 1$ and that $\mathbf{A}$ is $4 \times 4$ and symmetric! What follows is correct?

$$ \frac{\partial \mathbf{x^{\top}Ax}}{\partial x_{1}} = 2\mathbf{J}^{1\cdot}\mathbf{Ax} = 2 \begin{bmatrix} 1 & 1 & 1 & 1\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0 \end{bmatrix} \mathbf{Ax}. $$

Tks in advance!

2

There are 2 best solutions below

0
On BEST ANSWER

The answer is simple, Greg explained clearly in the comments section.

We know that $$ \frac{\partial \mathbf{x}^{\top}\mathbf{Ax}}{\partial \mathbf{x}} = 2\mathbf{Ax}. $$ So, if now I want the derivative wrt $x_{k}$ I just multiply it by the $k^{\text{th}}$ basis vector. i.e., $$ \frac{\partial \mathbf{x}^{\top}\mathbf{Ax}}{\partial x_{k}} = 2e_{k}^{\top}\mathbf{Ax} = e_{k}^{\top} \frac{\partial \mathbf{x}^{\top}\mathbf{Ax}}{\partial \mathbf{x}}. $$

2
On

I assume that $A$ is a matrix having real numbers as entries. Hence with $x^T:=(x_1,\ldots,x_n)$ the term $x^TAx$ is a quadratic polynomial in $n$ variables $x_1,\ldots,x_n$ which you can differentiate w.r.t. $x_1$.

To your calculation: That equation does not hold, since $x^TAx$ is a real number for all $x_1,\ldots,x_n$ and not $4\times 1$ as in the middle and rhs.