Matrices

Compact, elegant, and powerful—matrices organize systems of equations into structured arrays. Essential for linear transformations, computation, and data representation. 🧮

Matrix Notation

Suppose we have the following system of linear equations:

\[ \begin{aligned} 2x_1 - x_2 + x_3 &= 8 \\ x_1 &= 2 \\ 4x_3 &= 7 \end{aligned} \]

We can compactly record the essential information of a linear system in a array called a coefficient matrix:

\[ \begin{bmatrix} 2 & -1 & 1 \\ 1 & 0 & 0 \\ 0 & 0 & 4 \end{bmatrix} \]

This matrix is a squared matrix with dimensions \(n\) x \(n\). Since the matrix has the same number rows (\(3\)) as it has columns (\(3\)).

If constants were known, we can also represent them in a augmented matrix:

\[ \begin{bmatrix} 2 & -1 & 1 & 8\\ 1 & 0 & 0 & 2\\ 0 & 0 & 4 & 7 \end{bmatrix} \]

This matrix is a rectangular matrix with dimensions \(m\) x \(n\). Since the array has the different number rows (\(3\)) and columns (\(4\)).

In data science, it’s common for the constants (outputs) to be unknown or variable. As a result, when we refer to matrices, we’re usually talking about the coefficient matrix.

A more general notation for a matrix denoted \(A\) is

\[ A = \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix} \]