I would like to differentiate Ax with respect to A where A is a matrix. Now, obviously, I know the derivative is x but for more nasty expressions, is there a way to differentiate expressions with respect to matrices in Mathematica? I've only seen scalar differentiation so far.

  • 1
    $\begingroup$ probably a real nontrivial example would be useful. $\endgroup$ – george2079 Oct 20 '15 at 16:17
  • $\begingroup$ What you have written is incorrect. The gradient of $Ax$ with respect to $x$ is $A^T$, but the derivative of $Ax$ with respect to $A$ is actually a rank-3 tensor (i.e. you need to take the derivative of $(Ax)_i$ with respect to each $A_{jk}$). $\endgroup$ – Ross B. Sep 20 '16 at 20:49

I suppose the answer may not be general enough but there isn't to much info in the quesion.

Let's make MMA forget about the fact that A is a matrix.

A = Array[a, {5, 5}];

 D[A x, A]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.