Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this system:


And I've done:


then multiply first row by $(-1)$ in order to make the (lin:2, col:1) 0. and I get:


now I have to switch the line 2 with 3 or the col 2 with 3? (because there is a zero on the main diagonal)

If I switch, then how my variable will be switched?

share|cite|improve this question
Have you tried continuing to see what happens? – J. M. Nov 19 '11 at 18:18
None of them gives me the right result.. – Totty.js Nov 19 '11 at 18:47
Maybe because the first row should be $1,2,-1$ instead of $1,2,1$? – J. M. Nov 19 '11 at 18:50
there was a typo when I've wrote here. as you see in the second step that is right. – Totty.js Nov 19 '11 at 19:00
You should not exchange columns; but you can exchange rows. – Arturo Magidin Nov 19 '11 at 20:02
up vote 4 down vote accepted

Member of the Answering the unanswered ones party here :)

Suppose you have the equation $Ax=b$, every time you make an elemantary row operation you are actually multiplying with a matrix that represents this action. Example: you have performed one such action, multiplying the first row with $-1$ and adding it to the second row and multiplying the first row with $-2$ and adding it to the third row which is: $$ \pmatrix{1 &0 &0\\-1 &1 &0\\-2&0&1}Ax=\pmatrix{1 &0 &0\\-1 &1 &0\\-2&0&1}b $$ That is the reason why it shows up on the right part of your matrix. If you keep doing this you would get $$ R_n\ldots R_1Ax= R_n\ldots R_1 b $$ and $R_n\ldots R_1A$ would be an upper triangular matrix from which you can start back substitution. Hence you wouldn't be needing the column swaps at all.

The column swap can be seen by rewriting the $Ax=b$ as $APP^{-1}x = b$. This means that whenever you apply a column swap, your variables are also permuted with the inverse of the permutation matrix. The inverse of a permutation is $\ldots$ehm$\dots$ permuting back, hence easy to obtain. Suppose we apply a column swap between the column number $2$ and $3$, $$ \underbrace{\left(\begin{array}{ccc}1&2&-1\\1&1&1\\2&-1&2\end{array}\right)\pmatrix{1 &0 &0\\0 &0 &1\\0 &1&0}}_{AP} \underbrace{\pmatrix{1 &0 &0\\0 &0 &1\\0 &1&0}\pmatrix{x\\y\\z}}_{P^{-1}x} = b $$ which is equal to $$ \left(\begin{array}{ccc}1&-1&2\\1&1&1\\2&2&-1\end{array}\right)\pmatrix{x\\z\\y} = b $$ we can see that $b$ couldn't care less about this operation. Hence, column swap only results with more things that we have to care about (In the context of solving linear equations!). For example you can continue your work by adding $-5$ times the second row and add it to the third and you are done.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.