# Getting the determinant value of the original matrix from its upper triangular matrix

Sometimes when finding the upper triangular of a matrix, I may just happen to switch rows to make the whole process shorter. Say for this matrix: $$A=\begin{bmatrix} 1 & -1 & -1\\ 3 & -3 & 2\\ 2 & 1 & 1 \end{bmatrix}$$

The determinant of it is $\left | A \right | = -5$.

Then to find the upper triangular matrix of A, I thought maybe switching row2 and row 3 would make the process simpler. So I did this: $$\begin{bmatrix} 1 & 0 & 0\\ 0 & 0 & 1\\ 0 & 1 & 0 \end{bmatrix}\cdot A=\begin{bmatrix} 1 & -1 & -1\\ 2 & -1 & 1\\ 3 & -3 & 2 \end{bmatrix}$$ And I let this be B this way: $B=\begin{bmatrix} 1 & -1 & -1\\ 2 & -1 & 1\\ 3 & -3 & 2 \end{bmatrix}$.

I figure out the elementary rows: $$E_{21} = \begin{bmatrix} 1 & 0 & 0\\ -2& 1 & 0\\ 0 & 0 & 1 \end{bmatrix}, E_{31} = \begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ -3 & 0 & 1 \end{bmatrix}$$

Multiply the elementary row matrices to the matrix $B$: $$E_{31}\cdot E_{21}\cdot B= \begin{bmatrix} 1 & -1 & -1\\ 0 & 1 & 3\\ 0 & 0 & 5 \end{bmatrix}$$

Now I got the upper triangle of matrix B, which is also the upper triangle of matrix $A$. Then I do a check on its determinant: $1\cdot 1\cdot 5=5$.

To my surprise, I get $5$ instead of $-5$! I realise that this is because $\left | B \right | = 5$. But since I had a row exchange to get the upper triangle, how can I make sure that its determinant is also the same as its original matrix $A$, which should be $-5$? I thought this is quite important because sometimes I use this to find the determinant value of higher dimension matrices.

Thanks for any help.

-

## 1 Answer

When you perform row operations on a matrix, you need to know the following three facts:

1. Adding a multiple of one row to another leaves the determinant of the matrix unaltered.
2. Multiplying a row by a real number has the effect of multiplying the determinant by the same real number.
3. Swapping two adjacent rows of a matrix has the effect of changing the sign of the determinant of the matrix.

So in when you switched the rows above really that was where the sign of the determinant was changed.

Proof of 3. Use induction and the fact that for a $n \times n$ matrix,

det $A = (-1)^{i+1}a_{i1}\text{det} A_{i1} + ... + (-1)^{i+n}a_{in}\text{det}A_{in}.$

$A_{ij}$ is the matrix of size $n-1 \times n-1$ obtained by deleting the $ith$ row and $jth$ column of the original $n \times n$ matrix.

-
oh.. So if the original determinant was say -5. And I happen to swap rows for 3 times. Then is the determinant going to be $-5\cdot-1\cdot-1\cdot-1=5$? –  xenon Jul 1 '11 at 15:25
@xEnOn What do you think? –  user38268 Jul 1 '11 at 15:30
I think I am right. But I am not 100% confirm. Am I right? –  xenon Jul 1 '11 at 16:11
@xEnOn First question are you an undergraduate at a university? This material should be standard at a first year linear algebra course in any university. Secondly, look at:en.wikipedia.org/wiki/Determinant –  user38268 Jul 1 '11 at 17:14
@xEnOn: Yes, you are. –  Hans Lundmark Jul 1 '11 at 17:21