Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

 Open In Colab

Common Matrix Types

Before discussing advanced structural properties, here is a formal classification of fundamental matrix types encountered in numerical methods:

Matrix TypePropertyExample 2×22 \times 2
Zero Matrixaij=0a_{ij} = 0 for all i,ji,j[0000]\begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}
Identity MatrixAx=x\mathbf{A}\mathbf{x} = \mathbf{x}, (aii=1,aij=0a_{ii}=1, a_{ij}=0)[1001]\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
Diagonalaij=0a_{ij} = 0 for i≠ji \neq j[2003]\begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix}
Upper Triangularaij=0a_{ij} = 0 for i>ji > j[2−103]\begin{bmatrix} 2 & -1 \\ 0 & 3 \end{bmatrix}
Lower Triangularaij=0a_{ij} = 0 for i<ji < j[20−13]\begin{bmatrix} 2 & 0 \\ -1 & 3 \end{bmatrix}
SymmetricA=AT\mathbf{A} = \mathbf{A}^T[2−1−13]\begin{bmatrix} 2 & -1 \\ -1 & 3 \end{bmatrix}
Positive DefinitexTAx>0\mathbf{x}^T \mathbf{A} \mathbf{x} > 0 for all x≠0\mathbf{x} \neq 0[2−1−12]\begin{bmatrix} 2 & -1 \\ -1 & 2 \end{bmatrix}
Symmetric Positive Definite (SPD)A=AT\mathbf{A} = \mathbf{A}^T and xTAx>0\mathbf{x}^T \mathbf{A} \mathbf{x} > 0[2−1−12]\begin{bmatrix} 2 & -1 \\ -1 & 2 \end{bmatrix}
OrthogonalA−1=AT\mathbf{A}^{-1} = \mathbf{A}^T[0−110]\begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}

What is Sparsity?

Sparsity refers to the fraction of non-zero elements in a matrix.

Sparse matrices have a significant fraction of exactly 0 elements. In real-world engineering problems (like discretizing differential equations or finite element analysis), matrices are often incredibly sparse.

Exploiting sparsity offers massive benefits:

  • Storage: Instead of storing a massive 2D array full of zeros, we can store only the non-zero entries (and their locations), saving gigabytes of memory.

  • Computation: Algorithms can be designed to ignore operations involving zeros, dramatically reducing execution time and computational complexity.

Sparsity patterns and matrix

Sparsity patterns are condensly viewed as monochrome matricies filled in according to 0 or non-zero.

Example: A sparsity pattern from a finite element problem in 2D.

Finite_element_sparse_matrix.png

Banded Matrices

Banded matrices only have non-zero elements running parallel to the main diagonal. The bandwidth describes how many parallel diagonal bands exist.

We have already seen how useful diagonal and triangular matrices are for controlling computational complexity (e.g. back-substitution).

Tridiagonal (Bandwidth 3)

A classic matrix structure in 1D physics problems (heat conduction, fluid flow) where every node only interacts with its immediate left and right neighbors.

Pentadiagonal (Bandwidth 5)

Commonly arises in 2D grid problems or higher-order finite difference methods.

Block Matrices

Sometimes, a large sparse matrix can be logically partitioned into smaller sub-matrices, called blocks.

M=[2−10∣100−12−1∣0100−12∣001−−−−−−∣−−−−−−100∣2−10010∣−12−1001∣0−12]=[ABCD]\mathbf{M} = \begin{bmatrix} 2 & -1 & 0 & | & 1 & 0 & 0 \\ -1 & 2 & -1 & | & 0 & 1 & 0 \\ 0 & -1 & 2 & | & 0 & 0 & 1 \\ --&--&--&|&--&--&-- \\ 1 & 0 & 0 & | & 2 & -1 & 0 \\ 0 & 1 & 0 & | & -1 & 2 & -1 \\ 0 & 0 & 1 & | & 0 & -1 & 2 \end{bmatrix} = \begin{bmatrix} \mathbf{A} & \mathbf{B} \\ \mathbf{C} & \mathbf{D} \end{bmatrix}

This situation arises constantly in multi-physics applications (e.g., modeling Temperature and Pressure fields simultaneously).

Instead of solving the massive matrix as a whole (monolithic solution), we can solve the blocks individually (operator splitting or segregated solving).

Solving Block Matrices

Because the cost of matrix inversion scales as O(n3)\mathcal{O}(n^3), breaking a 2n×2n2n \times 2n system into two n×nn \times n blocks is a massive computational savings!

For a block diagonal matrix (where off-diagonal blocks B=C=0\mathbf{B} = \mathbf{C} = \mathbf{0}), the inverse is completely trivial:

[A00D]−1=[A−100D−1]\begin{bmatrix} \mathbf{A} & \mathbf{0} \\ \mathbf{0} & \mathbf{D} \end{bmatrix}^{-1} = \begin{bmatrix} \mathbf{A}^{-1} & \mathbf{0} \\ \mathbf{0} & \mathbf{D}^{-1} \end{bmatrix}