Compute the derivative of $f (x) := Ax$ w.r.t. matrix $A$ [closed]

Let function $f : \Bbb R^{3 \times 2} \to \Bbb R^3$ be defined by $f(A) := Ax$. Compute the derivative of $f$ with respect to $A$.


I would like to check if my computation is correct. Is it?

enter image description here


Solution 1:

Given the vector-valued function $$\eqalign{ f &= Ax \\ }$$ or in index notation $$\eqalign{ f_i &= A_{ij}x_j \\ }$$ Find its differential and gradient wrt $A$ $$\eqalign{ df_i &= dA_{ij}\,x_j \\\\ \frac{\partial f_i}{\partial A_{km}} &= \left(\frac{\partial A_{ij}}{\partial A_{km}}\right)\,x_j \\ &= \big(\delta_{ik}\,\delta_{jm}\big) \,x_j \\ &= \delta_{ik}\,x_m \\ }$$ Note that the result is a third-order tensor.

Vectorization can be used to flatten the gradient into a matrix $$\eqalign{ df \;&= \Big(I\;dA\;x\Big) \\ \;&= \Big(x^T\otimes I\Big)\;{\rm vec}(dA) \\ \frac{\partial f}{\partial\,{\rm vec}(A)} &= \Big(x^T\otimes I\Big) \\\\ }$$