[Math] Swapping columns in a matrix changes the solution vector order? How to keep track

gaussian eliminationlinear algebranumerical linear algebra

I am doing full pivoting for Gaussian elimination and in order to do the full pivoting I am required to swap columns. I am a bit rusty on my linear algebra but it seems that this process somehow changes the order of the vector solution.

For example given

$\begin{bmatrix}1 & 1 & 1 \\ 2 & 1 & 3 \\ 3 & 1 & 6 \end{bmatrix}\begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} = \begin{bmatrix} 4 \\ 7 \\ 2 \end{bmatrix}$

then without full pivoting, the answer is

$\mathbf{x} = \begin{bmatrix} 19 & -7 & -8\end{bmatrix}^T$.

However, when I do full pivoting, it is necessary to swap some columns (for example in the first step I need to move element $a_{33} = 6$ to position $a_{11}$ by swapping column 3 and 1 and row 3 and 1). When I do this and continue with the Gaussian elimination I end up with

$\mathbf{x} = \begin{bmatrix} -8 & -7 & 19\end{bmatrix}^T$.

I can correct for this but can anyone explain why this is happening?

Cheers

Best Answer

Consider the system:

$$2x+y = 1$$ $$x-y = 0$$

Isn't this the same as:

$$y+2x = 1$$

$$-y + x = 0$$

The first system says:

$$\begin{bmatrix} 2 & 1 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}$$

The second says:

$$\begin{bmatrix} 1 & 2 \\ -1 & 1 \end{bmatrix} \begin{bmatrix} y \\ x \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}$$