Determinant of a triangular matrix

Using the cofactor expansion, explain why the determinant of a triangular matrix is the product of the elements on its diagonal.

Is it the fact that there are $0$'s in the $L$ or $U$ part of the matrix and that somehow comes into play to where only the diagonal is accounted for? I'm not quite sure.


Let $$A = \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ & a_{22} & \cdots & a_{2n} \\ & & \ddots & \\ & & & a_{nn}\end{pmatrix}$$

be your upper triangular matrix. Expanding the left most column, the cofactor expansion formula tells you that the determinant of $A$ is

$$a_{11} \cdot \textrm{det} \begin{pmatrix} a_{22} & a_{22} & \cdots & a_{2n}\\ & a_{33} & \cdots & a_{3n} \\ & & \ddots & \\ & & & a_{nn}\end{pmatrix}$$ Now this smaller $(n-1)$ by $(n-1)$ matrix is also upper triangular, so you can compute it as $a_{22}$ times an $(n-2)$ by $(n-2)$ upper triangular determinant:

$$\textrm{det } A = a_{11} a_{22} \cdot \textrm{det} \begin{pmatrix} a_{33} & a_{34} & \cdots & a_{3n}\\ & a_{44} & \cdots & a_{4n} \\ & & \ddots & \\ & & & a_{nn}\end{pmatrix}$$

Iterating this argument, you're eventually going to get

$$\textrm{Det } A = a_{11} \cdots a_{n-2,n-2} \cdot \textrm{det} \begin{pmatrix} a_{n-1,n-1} & a_{n-1,n} \\ & a_{nn} \end{pmatrix} = a_{11} \cdots a_{nn}$$