I am new to matrix calculus and have a question regarding finding the derivative of the cost function defined below with respect to $\theta$, which is actually the exponential term of a multinomial distribution.
$$Q = (x-H\theta)^T C^{-1} (x-H\theta)\\ = (x^T -\theta^TH^T) C^{-1} (x-H\theta) \\ = x^T C^{-1} x - x^T C^{-1} H \theta - \theta^T H^T C^{-1} x + \theta^T H^T C^{-1} H \theta$$
How do I get the derivative of the 3rd term since $\theta$ is transposed. The 4th term also since there are 2 $\theta$'s, transposed and not. Help. Thanks.
Rather than expanding the expression immediately, I find it simpler to define new variables (to reduce "clutter" in the function), differentiate, then substitute the original variables in the final steps.
Let
$$\eqalign{ B &= C^{-1} \cr y &= H\theta-x \cr }$$ Write the function in terms of these variables and take the differential $$\eqalign{ Q &= y^TBy \cr dQ &= dy^TBy + y^TB\,dy \cr &= y^T(B^T + B)\,dy \cr &= y^T(B^T + B)H\,d\theta \cr }$$ Since $dQ=(\frac{\partial Q}{\partial\theta}:d\theta),\,$ the gradient must be $$\eqalign{ \frac{\partial Q}{\partial\theta} &= y^T(B^T + B)H \cr &= (H\theta-x)^T(C^{-T} + C^{-1})\,H \cr }$$