Skip to content

Inversion of matrices
using Gauss-Jordan elimination ​

Introduction ​

Square matrices

A∈Kn×n

are invertible if and only if their determinant is not zero.

det(A)≠0⇔A−1 exists

The inverse of a matrix is a matrix that when multiplied with the original matrix produces the identity matrix.

I=A⋅A−1=A−1⋅A

Inverse calculation ​

Let

A=[a11a12⋯a1na21a22⋯a2n⋮⋮⋱⋮an1an2⋯ann]

be a square matrix. The inverse of A is calculated using the following steps:

  1. Create an augmented matrix
  2. Transform the matrix into a reduced row echelon form
  3. Extract the inverse matrix from the augmented matrix
  4. Check the result

Augmented matrix ​

The augmented matrix is created by appending the identity matrix to the right of the original matrix.

[a11a12⋯a1n10⋯0a21a22⋯a2n01⋯0⋮⋮⋱⋮⋮⋮⋱⋮an1an2⋯ann00⋯1]

Reduced row echelon form ​

The augmented matrix is transformed into a reduced row echelon form using the Gauss-Jordan elimination method.

[10⋯0b11b12⋯b1n01⋯0b21b22⋯b2n⋮⋮⋱⋮⋮⋮⋱⋮00⋯1bn1bn2⋯bnn]

The inverse matrix is extracted from the augmented matrix.

A−1=[b11b12⋯b1nb21b22⋯b2n⋮⋮⋱⋮bn1bn2⋯bnn]

The result is checked by multiplying the original matrix with the inverse matrix.

A⋅A−1=I

Notes ​

  • The inverse matrix is calculated only if the original matrix is invertible.
  • The inverse matrix is calculated only for square matrices.

Example ​

Let

A=[52−331−22−3−4]

be a square matrix. Let's calculate the inverse of A.

Augmented matrix ​

The augmented matrix is created by appending the identity matrix to the right of the original matrix.

[52−310031−20102−3−4001]

Reduced row echelon form ​

Getting reduced row echelon form using Gauss-Jordan elimination method step-by-step:

[52−310031−20102−3−4001]→R3+3R2R1−2R2[−1011−2031−2010110−10031]→R3+10R1R2+2R1→R3+10R1R2+2R1[−1011−201102−3010010−171]→R2−R3R1+R3[00111−191010−814−110010−171]

To extract the inverse matrix from reduced row echelon form, we need to transform the matrix into a diagonal form.

[00111−191010−814−110010−171]→R1↔R3[10010−171010−814−100111−191]

Now inverse matrix can be extracted from the augmented matrix.

A−1=[10−171−814−111−191]

The result is checked by multiplying the original matrix with the inverse matrix.

A⋅A−1=[52−331−22−3−4]⋅[10−171−814−111−191]==[5⋅10+2⋅(−8)+(−3)⋅115⋅(−17)+2⋅14+(−3)⋅(−19)5⋅1+2⋅(−1)+(−3)⋅13⋅10+1⋅(−8)+(−2)⋅113⋅(−17)+1⋅14+(−2)⋅(−19)3⋅1+1⋅(−1)+(−2)⋅12⋅10+(−3)⋅(−8)+(−4)⋅112⋅(−17)+(−3)⋅14+(−4)⋅(−19)2⋅1+(−3)⋅(−1)+(−4)⋅1]==[50−16−33−85+28+575−4−330−8−22−51+14+383−1−220+24−44−34−42+762+3−4]=[100010001]=I