Diagonal matrix
Matrix operations

The operations of matrix addition and matrix multiplication are especially simple for diagonal matrices. Write diag(a,..., a) for a diagonal matrix whose diagonal entries starting in the upper left corner are a,..., a. Then, for addition, we have

and for matrix multiplication,

The diagonal matrix diag(a,..., a) is invertible if and only if the entries a,..., a are all nonzero. In this case, we have

In particular, the diagonal matrices form a subring of the ring of all n -by- n matrices.

Multiplying an n -by- n matrix A from the left with diag(a,..., a) amounts to multiplying the i -th row of A by a for all i; multiplying the matrix A from the right with diag(a,..., a) amounts to multiplying the i -th column of A by a for all i.
detectable_format:multiple_sections[3]