Matrices

A matrix (plural matrices) is an array of numbers, symbols, or expressions, arranged in rows and columns. A general form is:

Matrices and matrix mathematics is important in Machine Learning for a number of reasons:

Data Cluster Manipulation

Machine Learning operations often involve retrieving, using and storing clusters of data points. Matrices are an efficient way to handle this type of data.

Mathematical Formulas and Program Code

Matrices can be represented in compact mathematical formulas which can be programmed for easy access.

Custom Computing Hardware

Custom computing hardware such as GPUs and TPUs are constructed for the efficient and rapid processing of data.

Matrix Addition

The formula for the sum of two matrices A+B to form a new matrix C is:

Matrix Scalar Multiplication

The formula for multiplying a matrix A by a scalar value s to form a new matrix C is:

Matrix Full Multiplication

Matrix multiplication is performed under these conditions:

  • the number of columns in the first matrix must be equal to the number of rows in the second matrix

  • result matrix, known as the matrix product, has the number of rows of the first and the number of columns of the second matrix

The formula for the sum of two matrices AxB to form a new matrix C is:

As shown below, matrix multiplication uses vector dot products to calculate result cell values:

Matrix Concatenation

Matrix concatenation is the process of joining multiple matrices along the vertical axis, horizontal axis, or as a single row to create a new matrix: