Special types of matrices

In Linear Algebra there are a few notable types of matrices, I'll cover them in short.

Square Matrix

The square matrix is a matrix that has an equal number of rows and columns.

$$\begin{bmatrix} 4 & 2 & 7\\ 5 & 1 & 9\\ 4 & 0 & 1 \end{bmatrix}$$

They are primarily used to represent linear tranformations and are a requirement for many operations like eigendecomposition.

Identity Matrix

The identity matrix is a aquare matrix that has a diagonal of 1s while the other values are 0.

$$\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}$$

The big deal with identity matrices is when you have an identity matrix, you essentially have undone a transformation and found your starting basis vectors. Which plays a big role in solving systems of equations.

Inverse matrix

An inverse matrix is a matrix that undoes the transformation of another matrix. Let's say A is:

$$A = \begin{bmatrix} 4 & 2 & 4\\ 5 & 3 & 7\\ 9 & 3 & 6 \end{bmatrix}$$

The inverse of matrix A is called A^{-1}, which look like this:

$$A^{-1} = \begin{bmatrix} -\frac{1}{2} & 0 & \frac{1}{3}\\ 5.5 & -2 & \frac{4}{3}\\ -2 & 1 & \frac{1}{3} \end{bmatrix}$$

When a matrix multiplication is performed between A^{-1} and A, we end up with an identiy matrix:

$$\begin{bmatrix} -\frac{1}{2} & 0 & \frac{1}{3}\\ 5.5 & -2 & \frac{4}{3}\\ -2 & 1 & \frac{1}{3} \end{bmatrix} \begin{bmatrix} 4 & 2 & 4\\ 5 & 3 & 7\\ 9 & 3 & 6 \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}$$

Diagonal Matrix

Similar to the identity matrix is the diagonal matrix, which has a diagonal of nonzero values while the rest of the values are 0.

$$\begin{bmatrix} 4 & 0 & 0\\ 0 & 2 & 0\\ 0 & 0 & 5 \end{bmatrix}$$

Diagnoal matices are desirable in certain computations because they represent simple scalars being applied to a verctor space. It shows up in some linear algebra operations.

Triangular Matrix

Similar to the diagonal matrix is the triangular matrix, which has a diagonal of nonzero values in front of a triangle of values, while the rest of the values are 0.

$$\begin{bmatrix} 4 & 2 & 9\\ 0 & 1 & 6\\ 0 & 0 & 5 \end{bmatrix}$$

Triangular matrices are desirable in many numerical analysis tasks, because they typically are easier to solve in systems of equations. They also show up in certian decomposition tasks like LU Decomposition.

Sparse Matrix

Occasionally, you will run into matrices that are mostly zeroes and have very few nonzero elements. THese are called sparse matrices. From a pure mathematical standpoint, they are not terribly intereseting. But from a computing standpoint, they provide opportunities to create effeciency. If a matrix has mostly 0s, a sparse matrix implementation will not waste space storing a bunch of 0s, and instead only keep track of the cells that are nonero.

$$\begin{bmatrix} 0 & 0 & 0\\ 0 & 0 & 2\\ 0 & 0 & 0\\ 0 & 0 & 0 \end{bmatrix}$$

Source: Essential Math for Data Science by Thomas Nield

4
Subscribe to my newsletter

Read articles from Abdullah Alhariri directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Abdullah Alhariri
Abdullah Alhariri