Skip to the content of the web site.

Elementary Matrices

There were three types of elementary matrices covered in your linear algebra course. Their purposes were to:

  1. Multiply a row by a scalar multiple,
  2. Swap two rows, and
  3. Add a scalar multiple of one row onto another.

Elementary matrices have nice properties: their inverses are easy to calculate and their products with other matrices are often easy to determine.

Multiply a Row by a Scalar Multiple

Multiplying the ith row of an n × n matrix by a scalar multiple c may done by multiplying on the left by the matrix which is the identity matrix with entry ei,i = c. For example, multiplying the 3rd row of a 4 × 4 matrix may be done by multiplying the matrix by the elementary matrix:

To visualize this in Matlab, run the following code:

M = [1 2 3 4 5;2 3 4 5 6;3 4 5 6 7;4 5 6 7 8;5 6 7 8 9]
E = eye( 5 )      % generate a 5x5 identity matrix (ha, ha)
E(2,2) = 1.271543 % set the 2,2 entry to 1.271543
E * M

If the row is being multiplied by a non-zero value, the reciprocal of the elementary matrix is the identity matrix with entry ei,i = 1/c.

Swapping Two Rows

The elementary matrix which swaps two rows i and j is the identity matrix with rows i and j swapped.

To visualize this in Matlab, run the following code:

M = [1 2 3 4 5;2 3 4 5 6;3 4 5 6 7;4 5 6 7 8;5 6 7 8 9]
E = eye( 5 )      % generate a 5x5 identity matrix
E([2,5],:) = E([5,2],:) % swap rows 2 and 5 -- try to figure out how it works
E * M

The inverse of this elementary matrix is itself.

Add a Scalar Multiple of One Row onto Another

The elementary matrix which adds to row i, row j (≠ i) multiplied by c is the identity matrix with entry i,j set to c. For example, adding to row 3, 3.2 times row 1, is done by the following elementary matrix:

To visualize this in Matlab, run the following code:

M = [1 2 3 4 5;2 3 4 5 6;3 4 5 6 7;4 5 6 7 8;5 6 7 8 9]
E = eye( 5 )      % generate a 5x5 identity matrix
E(4,2) = 0.1      % set entry (4,2) to 0.1
E * M             % add to row 4, 0.1 times row 2

The inverse of this elementary matrix is the identity matrix with entry i,j set to -c.