diagonalmatrix
A diagonal matrix is a square matrix with zeros in all off-diagonal positions; only the entries on the main diagonal may be nonzero. It is often written as D = diag(d1, ..., dn), where the numbers d1 through dn are the diagonal entries. In index form, D_{ij} = 0 if i ≠ j and D_{ii} = d_i.
Key properties follow directly from the definition. The determinant of a diagonal matrix is the product of
Eigenvalues and eigenvectors are straightforward: the eigenvalues of D are the diagonal entries d1, ..., dn, with
Special cases and related concepts include scalar matrices cI, which are diagonal with equal diagonal entries,