# Diagonal Matrix – Definition and Examples

Here you will learn what is the diagonal matrix definition and order of diagonal matrix with examples.

Let’s begin –

## Diagonal Matrix

Definition : A square matrix A = $$[a_{ij}]_{n\times n}$$ is called a diagonal matrix if all the elements, except those in the leading diagonal, are zero

i.e. $$a_{ij}$$ = 0  for all i $$\ne$$ j.

A diagonal matrix of order $$n \times n$$ having $$d_1$$, $$d_2$$, …. , $$d_n$$ as diagonal elements is denoted by $$diag[d_1, d_2, …. , d_n]$$.

## Examples :

1). $$\begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{bmatrix}$$ is a diagonal matrix.

The order of above matrix is $$3 \times 3$$ and it is denoted by diag[1, 2, 3].

2). $$\begin{bmatrix} 2 & 0 \\ 0 & -2 \end{bmatrix}$$ is a diagonal matrix.

The order of above matrix is $$2 \times 2$$ and it is denoted by diag[2, -2].

3). $$\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 2 & 0 & 0 \\ 0 & 0 & 3 & 0 \\ 0 & 0 & 0 & 4 \end{bmatrix}$$ is a diagonal matrix.

The order of above matrix is $$4 \times 4$$ and it is denoted by diag[1, 2, 3, 4].