Exercise What is the condition for a diagonal matrix to be invertible? What is the inverse? What about an upper (lower) triangular matrix?

Answer Based on the discussion in an earlier exercise, it is easy to see that the condition for a diagonal matrix

[ | a_{1} |
0 | . . | 0 | ] |

0 | a_{2} |
. . | 0 | ||

: | : | : | |||

0 | 0 | . . | a_{n} |

to be invertible is that the diagonal numbers
`a`_{1}, `a`_{2}, ..., `a _{n}` are nonzero. Moreover, the inverse is

[ | a_{1}^{-1} |
0 | . . | 0 | ] |

0 | a_{2}^{-1} |
. . | 0 | ||

: | : | : | |||

0 | 0 | . . | a_{n}^{-1} |

Similar statement holds for upper and lower triangular matrices.