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?


1 Answer 1


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.

  • $\begingroup$ would row swaps mean literally exchanging row positions or also include (scaled) additions of row one row to another? $\endgroup$
    – jbuddy_13
    Commented Mar 24, 2021 at 17:10
  • $\begingroup$ Likewise, in REF, the leading non-zero entries for each row should be 1. So, $1^n$ or $-1^n$ would only return $1|-1$ depending on the specific value of $n$, right? $\endgroup$
    – jbuddy_13
    Commented Mar 24, 2021 at 17:12
  • $\begingroup$ @jbuddy_13 my bad, look at my edit $\endgroup$ Commented Mar 24, 2021 at 17:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .