RowSwap
Returns a matrix with two of its rows swapped.
Syntax
-
RowSwap(A, i, j)
-
A
is a matrix -
i
is a positive integer -
j
is a positive integer
-
Description
If A
is a matrix and i
and j
are valid row indices in A
, then RowSwap(A, i, j)
returns A
with its i
th and j
th rows swapped.
This is an elementary row operation.
Examples
A ≔ ❨❨5, 1, 2, 3, 4❩, ❨4, 0, 2, 1, 7❩, ❨6, 3, 0, 4, 7❩, ❨4, 5, 2, 3, 9❩, ❨4, 0, 1, 2, 5❩❩
⎛5 1 2 3 4⎞ ⎜4 0 2 1 7⎟ ⎜6 3 0 4 7⎟ ⎜4 5 2 3 9⎟ ⎝4 0 1 2 5⎠
RowSwap(A, 2, 4)
⎛5 1 2 3 4⎞ ⎜4 5 2 3 9⎟ ⎜6 3 0 4 7⎟ ⎜4 0 2 1 7⎟ ⎝4 0 1 2 5⎠