How to differentiate formulas that have matrices as variables

58 Views Asked by At

I have this formula where $x,Q, b$ and $\lambda$ are matrices...

$\frac 12 x^TQx-\lambda^T(Ax-b)$.

I need to differentiate this equation with respect to $x$. I have multiplied it all out and I get this...

$\frac 12 x^TQx-\lambda^TAx-\lambda^Tb$

When I differentiate it I get...

$\frac 12 Qx-\lambda^TA$ ($x^Tx = x^2$ and $\frac 12x^2$ differentiated is just $x$).

but, according to the solutions, it should be...

$\frac 12 Qx-\lambda A^T$. I don't understand why the transpose is in the A and not the lambda.