## Differentiate a Hermitian transposition

Hi,

I am trying to differentiate the following. It contains matrices, vectors and hermitian transposes. I am not really getting the result I should be.

Differentiate J with respect to a. All the bold letters represent a matrix or vector. T is the transpose.

J= P + a^T*R*a - a^T*r- r^T*a

So far I have,

dJ/da = a^T * (R + R^T) - r^T - r^T

I am supposed to eventually get a - R^-1 * r.

What am I doing wrong?