How exactly could I take the derivative of the following expression?
$$ y = xA^T + b$$
Let's say that I have $x \in \mathbb{R}^{n}$, $A \in \mathbb{R}^{m,n}$, $y \in \mathbb{R}^{m}$, and $b \in \mathbb{R}^{m}$. And, I wish to take the derivative of $y$ with respect to $A$ and $b$, i.e. $\frac{\partial y}{\partial A}$ and $\frac{\partial y}{\partial b}$. I understand that $\frac{\partial y}{\partial A}$ would a rank-3 tensor containing $\frac{\partial y_i}{\partial A_{jk}}$, although I'm not entirely sure how to get to the solution. I've tried looking through the matrix cookbook but the only other solution (that I can find at least) is for $\frac{\partial x^Ta}{\partial x}$ where $x$ and $a$ in this case are both vectors. So, I'm a little confused!
With regards to the second term, $\frac{\partial y}{\partial b}$, I would assume that this is just the identity matrix ($\mathbb{I} \in \mathbb{R}^{m \times m}$) as the terms is just element-wise addition?
Thank you in advance!
E = reshape(speye(m*n), m,n,m,n)In Julia I sometimes use an array comprehensionE = [1*(i==k)*(j==l) for i=1:m,j=1:n,k=1:m,l=1:n]You can do something similar in Python / NumPy. – greg Feb 03 '21 at 13:53