[Math] Can you find the determinant of a matrix given its row echelon form

determinantlinear algebramatrices

I believe I stumbled on a resource for quickly computing the determinant of a matrix by converting it to row echelon form then acting upon the diagonal elements, either they're sum or product. However, I cannot find the specific link/resource, and so I'm no longer sure that this is a valid way of reaching the determinant.

Edit: B is an upper-triangular matrix, so detB is the product of its diagonal entries so perhaps my question should be, is it better/easier to just use the upper triangular matrix than to work with row echelon form?

Best Answer

You need to keep track of how many row swaps you have done because this multiplies the determinant by $-1$.

You can use elementary row operation matrices. The ones that correspond to adding/subtracting a row to another one have determinant one. Swapping rows has determinant $-1$. Hence, your determinant is the determinant of the matrix in row echelon from multiplied by $(-1)^n$, where $n$ is the number of row swaps you have done.

EDIT: I was using the wrong definition of row echelon form. One also has to keep track of the values you get in the diagonal before you divide to get $1$, and multiply it at the end as well.