How to swap rows in square a matrix algebraically
Is there some way to achieve swapping of rows of a 3x3 square matrix(for example exchanging rows 0 and 2) by using matrix algebra? Or is it something that cannot be done with algebra? What about row operations in general like multiplying a row with a constant, can it be expressed in terms of matrix algebra?
$\endgroup$ 23 Answers
$\begingroup$What you described are elementary operations.
To swap row $1$ and row $3$, pre-multiply the matrix $\begin{bmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0\end{bmatrix}$ (we swap row $1$ and row $3$ of the identity matrix).
To multiply row $2$ by $c$, pre-multiply the matrix $\begin{bmatrix} 1 & 0 & 0 \\ 0 & c & 0 \\ 0 & 0 & 1\end{bmatrix}$ (we multiply $c$ to the second row of the identity matrix).
You might like to check out elementary matrices.
$\endgroup$ $\begingroup$Depends on what do you mean by algebraically. If by algebraically you mean by addition, subtraction, or multiplication, then that depends on the rows of the matrix. Suppose $Row_1$ is 2$Row_3$, then yes you can swap them by multiplying $Row_1$ by 2 and dividing $Row_2$ by 2. That said, if you mean swapping as in matrix row operation than that is easily done. Since a Matrix with $Row_1$, $Row_2$, and $Row_3$ from top to bottom is equivalent, but not necessarily equal to the same matrix with $Row_2$, $Row_3$, and $Row_1$ from top to bottom.
$\endgroup$ $\begingroup$Left-multiplying by the $i$th row of the identity matrix picks out the $i$th row of the matrix being multiplied. So, to swap two rows of a matrix, left-multiply it by the appropriately-sized idenity matrix that has had its corresponding rows swapped. For example, to swap rows 0 and 2 of a $3\times n$ matrix, left-multiply it by $$\begin{bmatrix}0&0&1\\0&1&0\\1&0&0\end{bmatrix}.$$ A similar method works for picking out columns of a matrix, but you right-multiply by the appropriate column of the identity matrix.
$\endgroup$