In linear algebra, a pentadiagonal matrix is a matrix that is nearly diagonal; to be exact, it is a matrix in which the only nonzero entries are on the main diagonal, and the first two diagonals above and below it. So it is of the form
It follows that a pentadiagonal matrix has at most nonzero entries, where n is the size of the matrix. Hence, pentadiagonal matrices are sparse. This makes them useful in numerical analysis.