# Matrix differentiation

• Apr 6th 2009, 03:43 AM
Amanda1990
Matrix differentiation
I've never done matrix differentiation before, and I want to differentiate this:

$(Y-X\theta)^{T}(Y-X\theta)$ with respect to $\theta$. I'm told that, using the product rule, we get:

$2X^{T}(Y-X\theta)$.

(In the above, X, Y and $\theta$ are all column matrices). Can someone very quickly run through this for me please? Thanks.
• Apr 6th 2009, 09:12 AM
NonCommAlg
Quote:

Originally Posted by Amanda1990
I've never done matrix differentiation before, and I want to differentiate this:

$(Y-X\theta)^{T}(Y-X\theta)$ with respect to $\theta$. I'm told that, using the product rule, we get:

$2X^{T}(Y-X\theta)$.

(In the above, X, Y and $\theta$ are all column matrices). Can someone very quickly run through this for me please? Thanks.

they can't be all column matrices because then $X \theta$ wouldn't be defined. post the correct version of your problem if you still want to get help.
• Apr 12th 2009, 02:33 AM
Amanda1990
Yes, sorry. What I meant to say was that Y is an n x 1 column vector, X is an n x 2 matrix and $\theta$ is a 2 x 1 matrix.

(Although I think the idea is the same if X is just a n x p matrix and $\theta$ is a p x 1 matrix for a general p).