IOAI ML Notes Mathematics Fundamentals

Matrix Fundamentals

A practical guide to matrix basics for machine learning: shapes, multiplication, geometry, determinants, rank, and invertibility.

Syllabus Map


What Is a Matrix?


Matrix Operations

Addition and Scalar Multiplication

αA=[αaij]\alpha A = [\alpha a_{ij}]

Matrix Multiplication

ABRm×pAB \in \mathbb{R}^{m \times p} (AB)ij=k=1nAikBkj(AB)_{ij} = \sum_{k=1}^{n} A_{ik}B_{kj} ABBAAB \ne BA

Transpose

Aij=AjiA^\top_{ij} = A_{ji} (AB)=BA(AB)^\top = B^\top A^\top

Geometry of Matrices

Matrix as a Linear Transformation

Column-Space View

Dot Product and Orthogonality

xy=ixiyix^\top y = \sum_i x_i y_i

Determinant

Meaning

Key Facts

For a 2×22 \times 2 matrix:

A=[abcd],det(A)=adbcA=\begin{bmatrix}a & b \\ c & d\end{bmatrix},\quad \det(A)=ad-bc

Invertibility

Inverse Matrix

A1A=AA1=IA^{-1}A = AA^{-1} = I

Equivalent Conditions

For square AA, these are equivalent:


Rank and Linear Independence


Systems of Linear Equations

Ax=bAx=b

Matrices in Machine Learning

y^=Xw+b\hat y = Xw + b w=(XX)1Xyw = (X^\top X)^{-1}X^\top y Σ=1mXX\Sigma = \frac{1}{m}X^\top X

Practical Notes

Check shapes before multiplying.

Avoid explicit matrix inverse when solving systems.

Standardise features for distance-based and regularised methods.


Why This Matters for ML

← Back to Blog