Quant GT
Browse all lessons
Section 17 · Lesson 17.2

Matrix Operations

Multiplication, transposes, and matrix algebra essentials.

Matrices are linear transformations. The product ABAB composes them: applying BB then AA. Composition is associative (A(BC)=(AB)CA(BC) = (AB)C) but in general not commutative (ABBAAB \ne BA).

Key operations:

Transpose: AA^\top swaps rows and columns. (AB)=BA(AB)^\top = B^\top A^\top.Inverse: A1A^{-1} exists iff AA is square and full-rank (non-zero determinant). (AB)1=B1A1(AB)^{-1} = B^{-1} A^{-1}.Trace: tr(A)=iAii\mathrm{tr}(A) = \sum_i A_{ii}. Cyclic property tr(ABC)=tr(BCA)=tr(CAB)\mathrm{tr}(ABC) = \mathrm{tr}(BCA) = \mathrm{tr}(CAB) is endlessly useful.Determinant: scaling factor of the linear map. det(AB)=det(A)det(B)\det(AB) = \det(A) \det(B).

In quant work, matrix algebra appears everywhere: β^=(XX)1Xy\hat{\beta} = (X^\top X)^{-1} X^\top y in regression, Var(wX)=wΣw\mathrm{Var}(w^\top X) = w^\top \Sigma w in portfolio variance, and Markov chain transitions πPn\pi P^n for state distributions.