# Matrix Operations

**Matrix operations** are used in many machine learning algorithms. Linear algebra makes matrix operations fast and easy, especially when training on GPUs.

## Transpose

A transpose is a *matrix* which is formed by turning all the rows of a given *matrix* into columns and vice-versa represented as `A^T`

.

## Inversion

**Matrix inversion **is a process that finds another matrix that when multiplied with the matrix, results in an **identity matrix **(1's in main diagonal, zeros everywhere else)** **represented as **AB = BA = I**

**Note: **A square matrix that is not invertible is referred to as **singular**. The matrix inversion operation is not computed directly, but rather the inverted matrix is discovered through forms of matrix decomposition.

## Trace

A trace of a square matrix is the sum of the values on the main diagonal of the matrix represented as **tr(A)**

## Determinant

The determinant of a square matrix is a scalar representation of the volume of the matrix represented as **|A| or det(A)**

**Note: T**he determinant is the product of all the **eigenvalues **of the matrix. Also, a determinant of **0** indicates that the matrix **cannot **be **inverted**.

## Rank

The rank of a matrix is the number of dimensions spanned by all of the vectors within a matrix.

Rank of 0: All vectors span a point

Rank of 1: All vectors span a line

Rank of 2: All vectors span a two-dimensional plane.

**Calculating rank mathematically **(matrix decomposition method)**:
**https://www.youtube.com/watch?v=59z6eBynJuw

Link: https://machinelearningmastery.com/matrix-operations-for-machine-learning/

Last updated