Home page for accesible maths 3 Inverting matrices

Style control - access keys in brackets

Font (2 3) - + Letter spacing (4 5) - + Word spacing (6 7) - + Line spacing (8 9) - +

3.2. Inverting matrices

We now give the algorithm for inverting square matrices of any size. That is, given a matrix A=(aij)Mn() we try to find a matrix B=(bij)Mn() such that AB=BA=In, and if we cannot find such a B, then it means that A is not invertible. We shall see in Section 5 that the method comes down to finding a simultaneous solution to n systems of n linear equations each, and with n2 variables. Namely, we want to solve the following n systems of linear equations, one for each 1jn, in the variables bij, where 1in,

a11b1j++a1nbnj=δ1j=ai1b1j++ainbnj=δij=an1b1j++annbnj=δnj

As in Remark 3.1.1, δij is the Kronecker symbol, which equals 1 if i=j, and is zero otherwise.

Hence, we encode these equations in the following augmented matrix

(1) (a11a1n10000100ai1ain0010an1ann0001)=(A|In).

The goal is to perform successive elementary row operations (simultaneously on both sides of this split array), in order to pass from (1) to an array of the form

(In|B).

If this is possible, then B is the inverse of A, that is A-1=B. Otherwise, the matrix on the left becomes something other than the identity matrix; in this case A is not invertible. The above method for finding the inverse of a matrix is called the augmented matrix method.

Example 3.2.1.

  • Let’s use the above method on the matrix A from Example 3.1. Then we row reduce the augmented matrix as follows

    (A|I2)=(1-410-1301)R2=r2+r1R2=-r2(1-41001-1-1)
    R1=r1+4r2(10-3-401-1-1).

    So this confirms that the inverse of A is the same as B from Example 3.1.

Now let us work out the example of an arbitrary 2×2 matrix, for which we already have the answer (Theorem 3.1.7).

Example 3.2.2.

  • Let A be the following matrix.

    A=(abcd)M2()where a0.

    We calculate A-1.

    The additional assumption that a is non-zero is a technical question that will allow us to go straight to the point of the above algorithm. If a=0, then an additional argument is needed, which we leave as an exercise.

    We write the augmented matrix

    (ab10cd01)

    In order to get the identity matrix on the left-hand side, we need to do row operations that make the left-hand side into reduced echelon form. The echelon form will tell us whether the matrix is invertible or not. Since a0, we do

    R2=ar2R2=r2-cr1and we get(ab100ad-bc-ca).

    So A is invertible if and only if the bottom row is non-zero, which is true if and only if ad-bc is non-zero. This quantity ad-bc we will later call the determinant. For later purposes, let us record that using elementary matrices we can write:

    (10-ca)=E21(-c)E2(a)I2.

    (Beware that E21(-c)E2(a)E2(a)E21(-c). Also, this is where the assumption a0 shortens the algorithm.)

    To actually find the inverse, we assume that ad-bc0, and we carry on our computations to find the reduced echelon form of the left-hand side matrix (which will thus be I2). We obtain the augmented matrix

    (10dad-bc-bad-bc01-cad-bcaad-bc)=(I2|B),where
    B=1ad-bc(d-b-ca)=E1(1a)E12(-b)E2(1ad-bc)E21(-c)E2(a)I2.

    The conclusion is that the right-hand side B of the augmented matrix is the inverse of A. That is,

    A-1=B=1ad-bc(d-b-ca).

This method works with square matrices of any size, and we will shortly handle a few more examples. First though, let us recap the algorithm: given a square matrix AMn(),

  1. (i)

    Write the augmented (n×n|n×n) matrix (A|In).

  2. (ii)

    Put (A|In) into echelon form (Ae|C), i.e. put A into echelon form and perform simultaneously the elementary row operations on the right-hand side identity matrix.

  3. (iii)

    If the bottom row of Ae is filled with zeros, then A is not invertible and the algorithm stops. Otherwise:

  4. (iv)

    Carry on with elementary row operations until the left-hand side is Ar=In.

  5. (v)

    The right-hand side of this last augmented matrix is A-1.

As mentioned above, the synopsis of this algorithm for inverting matrices is to use elementary row operations in order to

pass from(A|In)to(In|A-1)if A is invertible.

Example 3.2.3.

  • Let A=(123234345). We prove that A is not invertible using the above algorithm.

    We perform the following row operations on the augmented matrix. For short, we give the key steps and write the order of the successive row operations from top to bottom.

    (123100234010345001)R3=r3-3r1R2=r2-2r1(1231000-1-2-2100-2-4-301)R3=r3-2r2(1231000-1-2-2100001-21)

    Since the bottom row in the left-hand side is a zero row, we conclude that A is not invertible. Recall that when we stack row operations over a single arrow, it means “do the top one first, then the next, etc.”.