# Thread: FOILING the difference of two matrices and its transpose, and then derivative

1. ## FOILING the difference of two matrices and its transpose, and then derivative

https://files.nyu.edu/mrg217/public/ols_matrix.pdf/

On p.2 there are three RHS-expressions of equation 4. How do you go from the first expression to the second expression? Matrices are not like variables x and y, that you can apply FOIL, right?

Furthermore, how can you take the derivative of the result with respect to beta if the matrix beta has more than 1 constituent beta.

Thanks,
Litic

2. ## Re: FOILING the difference of two matrices and its transpose, and then derivative

yes, you can "FOIL" matrices:

(A+B)(C+D) = AC + BD + AD + BC, but remember the order of multiplication in each term is important:

(A+B)(A-B) = A2 + BA - AB - B2, NOT A2 - B2 (because usually AB ≠ BA).

matrix differentiation is just a convenient way of keeping track of the various partial derivatives involved. you might want to look here:

Matrix calculus - Wikipedia, the free encyclopedia