## What is Sparse Matrix?

Sparse matrix is a matrix which contains very few non-zero elements. When a sparse matrix is represented with a 2-dimensional array, we waste a lot of space to represent that matrix. For example, consider a matrix of size 100 X 100 containing only 10 non-zero elements.

Matrix with a relatively high proportion of zero entries is called sparse matrix. There are several representations of Sparse Matrix. Triangular Matrix & Tridiagonal Matrix are common form of Sparse Matrix.

## What is Triangular Matrix?

In the mathematics and computer science, a triangular matrix is a special kind of square matrix where all non-zero value gathers at only one side of any diagonal of the matrix.

A square matrix is called lower triangular if all the entries above the main diagonal are zero. Alternatively, a square matrix is called upper triangular if all the entries below the main diagonal are zero.

## What is Tridiagonal Matrix?

In the mathematics and computer science, a tridiagonal matrix is a special kind of square matrix where all non-zero value gathers at diagonal or on elements immediately above or below to diagonal of the matrix.

A square matrix is called lower triangular if all the entries above the main diagonal are zero. Alternatively, a square matrix is called upper triangular if all the entries below the main diagonal are zero.

## Difference Between Triangular Matrix and Tridiagonal Matrix?

Triangular Matrix | Tridiagonal Matrix |

In triangular matrix non-zero values can occur only above or below of a diagonal. | In tridiagonal matrix non-zero values can occur on diagonal and on elements immediate to the diagonal. |

In triangular matrix zeros occur at only one side of the diagonal. | In tridiagonal matrix zeros occur at both side of the diagonal. |

Hope your experience with this tutorial is quite good. Let’s know by comment. Thanks.