In linear algebra
, a diagonal matrix
is a matrix such that only element
s 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 = Diagm×n(d1, d2, ..., dp)
This means that D
is a m
diagonal matrix containing the diagonal elements d1
, ..., dp
from upper-left to lower-right. Here, p
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 = Diagn×m(1/d1, 1/d2, ..., 1/dp)
is a left inverse
. It's a right inverse
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.