Derivation of $\frac{\partial}{\partial A} \left( y^T A x \right) = y x^T$

177 Views Asked by At

I would like to see a detailed, step-by-step derivation of the following identity

$$\frac{\partial}{\partial A} \left( y^T A x \right) = y x^T$$

where $x, y \in \mathbb R^n$ and $A \in \mathbb R^{n \times n}$. I thought it would be easy to do using Einstein notation, but I am messing up with the reciprocal basis.

2

There are 2 best solutions below

4
On BEST ANSWER

Since $y^\intercal A x = \sum_{i,j} a_{ij}y_i x_j$, where $A = (a_{ij})$, we can easily compute element-wise \begin{align*} \frac{\partial y^\intercal A x}{\partial a_{kl}} = y_k x_l \end{align*} So clearly \begin{align*} \frac{\partial y^\intercal A x}{\partial A} = \left(\frac{\partial y^\intercal A x}{\partial a_{kl}}\right)_{kl} = (y_k x_l)_{kl} = y x^\intercal \end{align*}

0
On

Let

$$f (\mathrm X) := \mathrm b^\top \mathrm X \,\mathrm a = \mbox{tr} \left( \mathrm b^\top \mathrm X \,\mathrm a \right) = \mbox{tr} \left( \mathrm a \mathrm b^\top \mathrm X \right) = \langle \mathrm b \mathrm a^\top, \mathrm X \rangle$$

where $\langle \cdot \,, \cdot \rangle$ denotes the Frobenius inner product. Since $f$ is linear in $\rm X$, its gradient is simply

$$\nabla f (\mathrm X) = \mathrm b \mathrm a^\top$$