In

linear algebra, a

diagonal matrix is a matrix such that only

elements on the diagonal are non-zero. The diagonal starts on the upper-left element and goes to the lower-right. If the matrix is non-

square, the diagonal still starts at the upper-left.

Sometimes you'll see the following notation for specifying diagonal matricies:

*D* = Diag_{m×n}(*d*_{1}, *d*_{2}, ..., *d*_{p})

This means that

*D* is a

*m*×

*n* diagonal matrix containing the diagonal elements

*d*_{1},

*d*_{2}, ...,

*d*_{p} from upper-left to lower-right. Here,

*p* = min(

*m*,

*n*).

The rank of a diagonal matrix is the number of non-zero diagonal elements.
The determinant of a square matrix is the product of the elements on the diagonal. Hence, a diagonal matrix has an inverse if and only if all the elements on the diagonal are non-zero. In that case, the inverse is given by:

*D* ^{-1} = Diag_{n×m}(1/*d*_{1}, 1/*d*_{2}, ..., 1/*d*_{p})

*D* ^{-1} is a

left inverse if

*m*≥

*n*. It's a

right inverse if

*n*≥

*m*.

A square diagonal matrix is trivially symmetric. The only diagonal matrix which is also an orthogonal matrix is the identity matrix.

Geometrically, multiplication of a vector by a diagonal matrix can be interpreted as a non-uniform scaling of the elements of the vector.