Interactive guide · linear algebra

Rank and inverse

Elementary operations, echelon form, rank and inverse of a matrix with the Gauss-Jordan method. Every property has its step-by-step proof: click any card to see it.

Угостить кофе

Пока этот раздел доступен только на испанском и английском.

Your matrix
A =
Rows Columns
Examples
Step by step
1234
Starting matrix: no operation has been done yet.
Step 0 of 1
Result
rank(A) = 2
The rank is the number of non-zero rows of the echelon form: 2.
The rank never exceeds min(2, 2) = 2, the smaller of the two sizes.
det(A) = −2
The determinant is not 0: A has an inverse.
What A does to the plane
Ae₁Ae₂
Unit square Image under A

The columns of A are the images of the vectors e₁ = (1, 0) and e₂ = (0, 1).

Signed area of the image = det(A) = −2. The determinant is negative: the figure is flipped over.

rank(A) = 2: the plane is not flattened and the square, which had area 1, now has area 2.

01 · Elementary operations

Elementary row operations

To study a matrix (solve it, measure it, invert it) we do row operations that do not change what matters. There are three, and each one can be undone.

Swap two rowsRi ↔ Rj. It changes the order of the rows without touching their numbers.
Multiply a row by k ≠ 0Ri ← k·Ri. Every entry of the row is multiplied by k. With k = 0 the row would be destroyed, so it is not allowed.
Add a multiple of another rowRi ← Ri + k·Rj. To every entry of row i we add k times the entry of row j. It is the operation that makes zeros.
Elementary matrix EThe identity after doing ONE elementary operation to it. Multiplying EA does that operation to A.See proof
All of them can be undoneEach operation is cancelled by another of the same type, so every elementary matrix has an inverse.See why
  1. 1Worked example. We want a 0 below the 1 in the first column of A. We do R₂ ← R₂ − 3·R₁: from row 2 we subtract 3 times row 1.A=(1234)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
  2. 2We compute the new row: (3, 4) − 3·(1, 2) = (0, −2).(1234)∼(120−2)\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \sim \begin{pmatrix} 1 & 2 \\ 0 & -2 \end{pmatrix}
  3. 3The same operation done with the elementary matrix E (the identity with that operation already done):EA=(10−31)(1234)=(120−2)E A = \begin{pmatrix} 1 & 0 \\ -3 & 1 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 1 & 2 \\ 0 & -2 \end{pmatrix}
  4. 4To swap R₁ ↔ R₂ we use the identity with its rows swapped:(0110)(1234)=(3412)\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 3 & 4 \\ 1 & 2 \end{pmatrix}

What it is for. They are the only moves allowed in Gauss's method. Since each one is the same as multiplying by a matrix, a chain of operations is a product of matrices, and that lets us prove things about rank and inverses.

An elementary operation = multiplying by an elementary matrix

(10−31)(1234)=(120−2)\begin{pmatrix} 1 & 0 \\ -3 & 1 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 1 & 2 \\ 0 & -2 \end{pmatrix}

Doing a row operation to A is the same as multiplying A on the left by a matrix E.

See proof

Every elementary operation can be undone

(10−31)−1=(1031)\begin{pmatrix} 1 & 0 \\ -3 & 1 \end{pmatrix}^{-1} = \begin{pmatrix} 1 & 0 \\ 3 & 1 \end{pmatrix}

Elementary matrices always have an inverse, and it is another elementary matrix.

See proof
02 · Row equivalence

Row-equivalent matrices

Two matrices of the same size are row equivalent when one comes from the other by elementary operations. We write A ~ B.

A ~ BThere is a matrix F ∈ Mm(K), a product of elementary matrices, with B = FA. If we work on columns, B = AC with C ∈ Mn(K).
[ Im | A ] ~ [ P | B ]If we do to [I | A] the same operations that take A to B, P is left on the left and B = PA. P keeps a record of everything that was done.See why
  1. 1Worked example with A = (1 2; 3 4). We write [I | A].(10120134)\left(\begin{array}{cc|cc} 1 & 0 & 1 & 2 \\ 0 & 1 & 3 & 4 \end{array}\right)
  2. 2We do R₂ ← R₂ − 3·R₁ and then R₁ ← R₁ + R₂.(1012−310−2)∼(−2110−310−2)\left(\begin{array}{cc|cc} 1 & 0 & 1 & 2 \\ -3 & 1 & 0 & -2 \end{array}\right) \sim \left(\begin{array}{cc|cc} -2 & 1 & 1 & 0 \\ -3 & 1 & 0 & -2 \end{array}\right)
  3. 3P is left on the left and B on the right. We check that B = PA:PA=(−21−31)(1234)=(100−2)=BPA = \begin{pmatrix} -2 & 1 \\ -3 & 1 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & -2 \end{pmatrix} = B

Note. The notes call this «similarity», but the usual name is row equivalence: in linear algebra, «similar» means something else (B = P⁻¹AP). What it is for. P sums up all the operations in a single matrix: it is the basis for computing inverses and for understanding the rank.

[I | A] ~ [P | B] implies B = PA

[ I∣A ]∼[ P∣B ]  ⇒  B=PA[\,I \mid A\,] \sim [\,P \mid B\,] \;\Rightarrow\; B = PA

If you do to [I | A] the same operations that take A to B, the matrix P is left on the left with B = PA.

See proof
03 · Echelon form

Echelon matrix and reduced form

Reducing to echelon form means using row operations to give the matrix a staircase shape. That shows at a glance how many «real» rows it has.

Echelon matrixIt meets two conditions: (1) all rows of zeros are at the bottom; (2) the first non-zero entry of each row is to the right of the first non-zero entry of the row above.
PivotThe first non-zero entry of a row of the echelon matrix.
For every A there is a P with PA = EWe can always reach an echelon matrix E with elementary operations: PA = E, and P comes from [I | A] ~ [P | E].
Reduced formThe echelon matrix with every pivot equal to 1 and zeros above each pivot too. With the pivots in the first columns it looks like [I X; 0 0] or [I X]; the size of I is the rank.
  1. 1Worked example. The first entry of A is 0, so it cannot be a pivot.A=(012111234)A = \begin{pmatrix} 0 & 1 & 2 \\ 1 & 1 & 1 \\ 2 & 3 & 4 \end{pmatrix}
  2. 2We swap R₁ ↔ R₂ to get a 1 at the top left.(111012234)\begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 2 \\ 2 & 3 & 4 \end{pmatrix}
  3. 3We make zeros below the first pivot: R₃ ← R₃ − 2·R₁ leaves the row (0, 1, 2).(111012012)\begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 2 \\ 0 & 1 & 2 \end{pmatrix}
  4. 4R₃ ← R₃ − R₂ cancels row 3. It is now in echelon form: two pivots (1 and 1).(111012000)\begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 2 \\ 0 & 0 & 0 \end{pmatrix}
  5. 5For the reduced form we put a 0 above the second pivot: R₁ ← R₁ − R₂.(10−1012000)\left(\begin{array}{cc|c} 1 & 0 & -1 \\ 0 & 1 & 2 \\ 0 & 0 & 0 \end{array}\right)
  6. 6On the left of the bar we get the 2×2 identity (plus a row of zeros): the rank is 2.(I2X00),X=(−12)\begin{pmatrix} I_2 & X \\ 0 & 0 \end{pmatrix}, \quad X = \begin{pmatrix} -1 \\ 2 \end{pmatrix}
Mind where the pivots areWith row operations alone the pivots sometimes do not fall in the first columns. For example, (1 2 0; 0 0 1) has pivots in columns 1 and 3: the identity is «spread out» and we would also need to swap columns to see [I X]. The number of pivots is still the rank.

What it is for. The echelon form turns a complicated matrix into one with the same information but easy to read: rank, solutions of a system, inverse.

04 · Rank

Rank of a matrix

The rank counts how many «independent» rows a matrix has: how many survive when it is reduced. A row that is a combination of others adds nothing new.

Rank rank(A)Number of non-zero rows of an echelon matrix row-equivalent to A. It is the same as the number of pivots.
rank(A) = rank(Aᵗ)Counting by rows or by columns gives the same number.
Limit: rank(A) ≤ min(m, n)There is at most one pivot per row and per column. In a 4×5 matrix the rank is at most 4.
Full rankWhen the rank reaches the largest possible value: rank(A) = min(m, n).

There are four ways to compute the rank. The first two use the determinant, a number computed from a square matrix: for a 2×2, det = ad − bc (main diagonal minus the other one); for a 3×3 we use Sarrus's rule: det = aei + bfg + cdh − ceg − bdi − afh, where the letters are the entries row by row. A 2×2 minor is the determinant of a 2×2 submatrix (we choose two rows and two columns).

2 × 2det ≠ 0 → rank 2. det = 0 → rank 1 (or 0 if every entry is 0).See why
3 × 3With Sarrus: det ≠ 0 → rank 3. If det = 0, look for a non-zero 2×2 minor: if there is one, rank 2; if they are all 0, rank 1 (or 0 if the matrix is zero).See proof
GaussReduce to echelon form and count the non-zero rows. Best when the matrix is 4×4 or larger, not square, or has many zeros.
TriangularThe determinant is the product of the diagonal. If there are no zeros on the diagonal, the rank is full (n).See why
  1. 1Worked example with Gauss on a non-square 3×4 matrix:A=(121324023615)A = \begin{pmatrix} 1 & 2 & 1 & 3 \\ 2 & 4 & 0 & 2 \\ 3 & 6 & 1 & 5 \end{pmatrix}
  2. 2R₂ ← R₂ − 2·R₁ and R₃ ← R₃ − 3·R₁ make zeros below the first pivot.(121300−2−400−2−4)\begin{pmatrix} 1 & 2 & 1 & 3 \\ 0 & 0 & -2 & -4 \\ 0 & 0 & -2 & -4 \end{pmatrix}
  3. 3Column 2 can no longer hold a pivot. The second pivot is in column 3: R₃ ← R₃ − R₂.(121300−2−40000)\begin{pmatrix} 1 & 2 & 1 & 3 \\ 0 & 0 & -2 & -4 \\ 0 & 0 & 0 & 0 \end{pmatrix}
  4. 4There are two non-zero rows: the rank is 2, below the largest possible value, min(3, 4) = 3.r=2<min⁡(3, 4)r = 2 < \min(3,\,4)

What it is for. The rank measures how much independent information a matrix holds. It says whether a system has a unique solution, whether a square matrix has an inverse (rank n) and how many unknowns stay free.

Rank of a 2×2 matrix with the determinant

det⁡=ad−bc≠0  ⟺  r=2\det = ad - bc \neq 0 \iff r = 2

If det ≠ 0 the rank is 2; if det = 0 the rank is 1 (or 0 if every entry is 0). Here r = rank(A).

See proof

Rank of a 3×3 matrix: Sarrus, minors and Gauss

A=(012111234):det⁡A=0, r=2A = \begin{pmatrix} 0 & 1 & 2 \\ 1 & 1 & 1 \\ 2 & 3 & 4 \end{pmatrix}:\quad \det A = 0,\ r = 2

Three paths to the same rank: the Sarrus determinant, a non-zero 2×2 minor and the echelon form. Here r = rank(A).

See proof

Rank of a triangular matrix

∣t11∗∗0⋱∗00tnn∣=t11 t22⋯tnn\begin{vmatrix} t_{11} & * & * \\ 0 & \ddots & * \\ 0 & 0 & t_{nn} \end{vmatrix} = t_{11}\,t_{22} \cdots t_{nn}

The determinant is the product of the diagonal: if there are no zeros on it, the rank is full. Here r = rank(A).

See proof
05 · Inverse

Inverse of a matrix

The inverse of a matrix is the one that «undoes» it, just as dividing undoes multiplying. It can only exist if the matrix is square.

Inverse A⁻¹For A ∈ Mn(ℝ or ℂ), the matrix B in Mn with AB = BA = In. It is written A⁻¹.
Regular and singularA matrix with an inverse is called regular; without one, singular.
When does it exist?If and only if det A ≠ 0, or equivalently rank(A) = n.See why
How is it computed? Gauss-JordanWe write [A | In] and operate on rows until we reach [In | B]. Then B is A⁻¹.See why
  1. 1Worked 3×3 example: we write [A | I].(123100014010560001)\left(\begin{array}{ccc|ccc} 1 & 2 & 3 & 1 & 0 & 0 \\ 0 & 1 & 4 & 0 & 1 & 0 \\ 5 & 6 & 0 & 0 & 0 & 1 \end{array}\right)
  2. 2R₃ ← R₃ − 5·R₁: we make the 5 in the first column a 0.(1231000140100−4−15−501)\left(\begin{array}{ccc|ccc} 1 & 2 & 3 & 1 & 0 & 0 \\ 0 & 1 & 4 & 0 & 1 & 0 \\ 0 & -4 & -15 & -5 & 0 & 1 \end{array}\right)
  3. 3R₁ ← R₁ − 2·R₂ and R₃ ← R₃ + 4·R₂: zeros in the second column (except the pivot).(10−51−20014010001−541)\left(\begin{array}{ccc|ccc} 1 & 0 & -5 & 1 & -2 & 0 \\ 0 & 1 & 4 & 0 & 1 & 0 \\ 0 & 0 & 1 & -5 & 4 & 1 \end{array}\right)
  4. 4R₁ ← R₁ + 5·R₃ and R₂ ← R₂ − 4·R₃: zeros in the third column.(100−2418501020−15−4001−541)\left(\begin{array}{ccc|ccc} 1 & 0 & 0 & -24 & 18 & 5 \\ 0 & 1 & 0 & 20 & -15 & -4 \\ 0 & 0 & 1 & -5 & 4 & 1 \end{array}\right)
  5. 5On the left we now have I; on the right, the inverse.A−1=(−2418520−15−4−541)A^{-1} = \begin{pmatrix} -24 & 18 & 5 \\ 20 & -15 & -4 \\ -5 & 4 & 1 \end{pmatrix}
  6. 6Check of the first row of A·A⁻¹ (the rest is checked the same way): (1, 2, 3) times each column of A⁻¹ gives 1, 0, 0.1(−24)+2⋅20+3(−5)=11⋅18+2(−15)+3⋅4=01⋅5+2(−4)+3⋅1=0\begin{aligned} 1(-24) + 2\cdot 20 + 3(-5) &= 1 \\ 1\cdot 18 + 2(-15) + 3\cdot 4 &= 0 \\ 1\cdot 5 + 2(-4) + 3\cdot 1 &= 0 \end{aligned}
  1. 1If it does not exist: A = (1 2; 2 4) has rank 1. When we reduce [A | I], a whole row on the left vanishes and I is never reached.(12102401)∼(121000−21)\left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 2 & 4 & 0 & 1 \end{array}\right) \sim \left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 0 & 0 & -2 & 1 \end{array}\right)

For 2×2 matrices there is a shortcut: A⁻¹ = (1/det)·(d −b; −c a), that is, swap the entries of the main diagonal, change the sign of the other two and divide by the determinant. What it is for. With the inverse you «divide» by a matrix: solve systems, undo a transformation or isolate a matrix in an equation.

Why [A | I] ~ [I | A⁻¹] computes the inverse

[ A∣I ]∼[ I∣A−1 ][\,A \mid I\,] \sim [\,I \mid A^{-1}\,]

The same operations that take A to I, applied to the identity, turn it into A⁻¹.

See proof

Example: computing an inverse with Gauss-Jordan

(1225)−1=(5−2−21)\begin{pmatrix} 1 & 2 \\ 2 & 5 \end{pmatrix}^{-1} = \begin{pmatrix} 5 & -2 \\ -2 & 1 \end{pmatrix}

From [A | I] to [I | A⁻¹] step by step with A = (1 2; 2 5), and a check.

See proof

It has an inverse if and only if the rank is n

∃ A−1  ⟺  r=n\exists\, A^{-1} \iff r = n

A square n×n matrix is invertible exactly when its rank is n. Here r = rank(A).

See proof
06 · Properties

Properties of the inverse and systems

Given two regular square matrices A and B of the same order:

Inverse of the transpose

(At)−1=(A−1)t(A^t)^{-1} = (A^{-1})^t

The inverse of the transpose is the transpose of the inverse. Example: A = (1 2; 3 5) has A⁻¹ = (−5 2; 3 −1), and (Aᵗ)⁻¹ = (−5 3; 2 −1) = (A⁻¹)ᵗ.

See proof

Inverse of a product

(AB)−1=B−1A−1(AB)^{-1} = B^{-1}A^{-1}

The inverse of a product is the product of the inverses in REVERSE ORDER, like taking off your shoes and socks. Example with A = (1 2; 0 1) and B = (1 0; 3 1): (AB)⁻¹ = (1 −2; −3 7).

See proof

Solving a system

AX=bAX = b
X=A−1bX = A^{-1}b

To solve a system with a regular A, multiply on the left by A⁻¹: (A⁻¹A)X = A⁻¹b. Example: 2x + y = 3, x + y = 2 gives X = (1, 1).

See proof

What it is for. These rules let you invert, transpose and multiply in whichever order is more convenient without recomputing from scratch. And the last one is the most used: if A is square with an inverse, the system always has a unique solution. When A is not square (more equations than unknowns or the other way round) we need the pseudoinverse, which is the next topic.

07 · Applications

What are rank and inverse for?

Solving systemsCircuits, structures or prices: many equations at once. With A⁻¹, the solution is X = A⁻¹b for any b.
Knowing whether the solution is uniqueIf the rank of A equals the number of unknowns, there is no freedom: the solution, if it exists, is unique.
Graphics and animationRotating or scaling an object is multiplying by a matrix; the inverse undoes the movement, for example to go from the screen back to the 3D world.
CryptographyIn the Hill cipher a message is encrypted by multiplying by a matrix; it is decrypted with its inverse (which must exist).
EconomicsIn Leontief's model, the production needed to meet a demand d is obtained with (I − C)⁻¹d.
Data and statisticsThe rank tells how many truly independent variables a data table has, and how many are redundant.
Proof

An elementary operation = multiplying by an elementary matrix

(10−31)(1234)=(120−2)\begin{pmatrix} 1 & 0 \\ -3 & 1 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 1 & 2 \\ 0 & -2 \end{pmatrix}
  1. E=(10−31)E = \begin{pmatrix} 1 & 0 \\ -3 & 1 \end{pmatrix}

    An elementary matrix E is the identity after doing ONE elementary operation to it. Here we do R₂ ← R₂ − 3·R₁ to the 2×2 identity: row 1 stays the same and from row 2 we subtract 3 times row 1, so its first entry goes from 0 to −3.

  2. (EA)i∙=ei1 A1∙+ei2 A2∙+⋯(EA)_{i\bullet} = e_{i1}\,A_{1\bullet} + e_{i2}\,A_{2\bullet} + \cdots

    What does E do when it multiplies? Row i of EA is a combination of the rows of A: each row k of A (we call it Ak•) is multiplied by the number eik of row i of E, and everything is added up.

  3. (EA)1∙=1⋅(1, 2)+0⋅(3, 4)=(1, 2)(EA)_{1\bullet} = \hl{1}\cdot(1,\ 2) + \hl{0}\cdot(3,\ 4) = (1,\ 2)

    Row 1 of E is (1, 0): 1 times row 1 of A and 0 times row 2. Result: row 1 does not change.

  4. (EA)2∙=−3⋅(1, 2)+1⋅(3, 4)=(0, −2)(EA)_{2\bullet} = \hl{-3}\cdot(1,\ 2) + \hl{1}\cdot(3,\ 4) = (0,\ -2)

    Row 2 of E is (−3, 1): −3 times row 1 of A plus 1 times row 2. That is exactly R₂ − 3·R₁.

  5. EA=(120−2)EA = \begin{pmatrix} 1 & 2 \\ 0 & -2 \end{pmatrix}

    Putting both rows together, EA is A with the operation already done. That is why doing an elementary operation is the same as multiplying on the left by an elementary matrix.

  6. (0110)(abcd)=(cdab)\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} a & b \\ c & d \end{pmatrix} = \begin{pmatrix} c & d \\ a & b \end{pmatrix}

    Swapping rows (R₁ ↔ R₂): the elementary matrix is the identity with its rows swapped, and multiplying swaps the rows of any matrix.

  7. (100k)(abcd)=(abkckd)\begin{pmatrix} 1 & 0 \\ 0 & k \end{pmatrix}\begin{pmatrix} a & b \\ c & d \end{pmatrix} = \begin{pmatrix} a & b \\ kc & kd \end{pmatrix}

    Multiplying a row by k (R₂ ← k·R₂, with k ≠ 0): the elementary matrix is the identity with k in place of the 1 of that row.

What it's for

It turns Gauss's method, which you do by hand row by row, into matrix algebra: a chain of operations is a product of matrices, so you can reason about it (prove that B = PA, compute inverses, understand the rank).

Proof

Every elementary operation can be undone

(10−31)−1=(1031)\begin{pmatrix} 1 & 0 \\ -3 & 1 \end{pmatrix}^{-1} = \begin{pmatrix} 1 & 0 \\ 3 & 1 \end{pmatrix}
  1. E=(10−31),E′=(1031)E = \begin{pmatrix} 1 & 0 \\ -3 & 1 \end{pmatrix},\qquad E' = \begin{pmatrix} 1 & 0 \\ 3 & 1 \end{pmatrix}

    R₂ ← R₂ − 3·R₁ is undone with R₂ ← R₂ + 3·R₁: what you subtracted, you add back. We call E the matrix that subtracts and E′ the one that adds.

  2. E′E=(1031)(10−31)=(1001)=IE'E = \begin{pmatrix} 1 & 0 \\ 3 & 1 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ -3 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} = I

    We multiply E′E. In position (2, 1) we get 3·1 + 1·(−3) = 0 and in (2, 2) we get 1. The identity comes out, so E′ = E⁻¹.

  3. (0110)(0110)=(1001)=I\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} = I

    Swapping two rows is undone by swapping them again: S·S = I. A swap matrix is its own inverse.

  4. (100k)(1001/k)=(1001)=I(k≠0)\begin{pmatrix} 1 & 0 \\ 0 & k \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & 1/k \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} = I\qquad (k \neq 0)

    Multiplying a row by k is undone by multiplying it by 1/k. That is why the operation requires k ≠ 0: multiplying by 0 destroys the row and it can no longer be recovered.

  5. P=Ek⋯E2E1  ⇒  P−1=E1−1E2−1⋯Ek−1P = E_k \cdots E_2 E_1 \;\Rightarrow\; P^{-1} = E_1^{-1} E_2^{-1} \cdots E_k^{-1}

    If we do several operations in a row, P = Ek⋯E₂E₁, they are undone in reverse order: P⁻¹ = E₁⁻¹E₂⁻¹⋯Ek⁻¹. So every product of elementary matrices is invertible.

What it's for

It guarantees that operating on rows loses no information: you can always go back. That is why the relation A ~ B is symmetric and why Gauss-Jordan ends up giving the inverse.

Proof

[I | A] ~ [P | B] implies B = PA

[ I∣A ]∼[ P∣B ]  ⇒  B=PA[\,I \mid A\,] \sim [\,P \mid B\,] \;\Rightarrow\; B = PA
  1. E [ I∣A ]=[ EI∣EA ]=[ E∣EA ]E\,[\,I \mid A\,] = [\,EI \mid EA\,] = [\,E \mid EA\,]

    Doing an elementary operation to [I | A] is the same as multiplying the whole matrix by E (block by block): E·I = E and E·A = EA. After the operation, the left block is no longer I, it is E.

  2. E2 [ E1∣E1A ]=[ E2E1∣E2E1A ]E_2\,[\,E_1 \mid E_1A\,] = [\,E_2E_1 \mid E_2E_1A\,]

    We do a second operation E₂ on the result: the left block becomes E₂E₁ and the right block E₂E₁A.

  3. [ Ek⋯E1∣Ek⋯E1A ]=[ P∣PA ]=[ P∣B ][\,E_k \cdots E_1 \mid E_k \cdots E_1 A\,] = [\,P \mid PA\,] = [\,P \mid B\,]

    After k operations, the left side is P = Ek⋯E₁ and the right side is PA. If we call B the matrix on the right, we have proved that B = PA: P keeps a record of all the operations we have done to A.

  4. (10120134)→(1012−310−2)→(−2110−310−2)\left(\begin{array}{cc|cc} 1 & 0 & 1 & 2 \\ 0 & 1 & 3 & 4 \end{array}\right) \to \left(\begin{array}{cc|cc} 1 & 0 & 1 & 2 \\ -3 & 1 & 0 & -2 \end{array}\right) \to \left(\begin{array}{cc|cc} -2 & 1 & 1 & 0 \\ -3 & 1 & 0 & -2 \end{array}\right)

    Example with A = (1 2; 3 4). First R₂ ← R₂ − 3·R₁ and then R₁ ← R₁ + R₂. We start with I on the left of the bar and A on the right.

  5. PA=(−21−31)(1234)=(100−2)=BPA = \begin{pmatrix} -2 & 1 \\ -3 & 1 \end{pmatrix}\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & -2 \end{pmatrix} = B

    We check: P·A gives exactly the matrix B left on the right.

  6. B=PA  ⇒  A=P−1BB = PA \;\Rightarrow\; A = P^{-1}B

    Since P is a product of elementary matrices, it is invertible. From B = PA we solve A = P⁻¹B: if B comes from A, then A also comes from B. That is why we write A ~ B (row equivalent).

What it's for

It is the practical way to know which matrix P sums up all the operations you did. It is the basis for computing inverses with [A | I] and for understanding the rank.

Proof

Rank of a 2×2 matrix with the determinant

det⁡=ad−bc≠0  ⟺  r=2\det = ad - bc \neq 0 \iff r = 2
  1. a≠0:(abcd)∼(ab0d−bca)a \neq 0:\quad \begin{pmatrix} a & b \\ c & d \end{pmatrix} \sim \begin{pmatrix} a & b \\ 0 & d - \frac{bc}{a} \end{pmatrix}

    Suppose a ≠ 0. To make a zero below a we subtract (c/a) times row 1 from row 2: R₂ ← R₂ − (c/a)·R₁. Below we get (0, d − bc/a).

  2. d−bca=ad−bca=det⁡ad - \dfrac{bc}{a} = \dfrac{ad - bc}{a} = \dfrac{\det}{a}

    We put that number over a common denominator: d − bc/a = (ad − bc)/a. It is the determinant divided by a.

  3. det⁡≠0  ⇒  r=2det⁡=0  ⇒  r=1\det \neq 0 \;\Rightarrow\; r = 2 \qquad\qquad \det = 0 \;\Rightarrow\; r = 1

    The echelon form already has a first pivot a ≠ 0. The second pivot is det/a, which is non-zero exactly when det ≠ 0. Then there are 2 non-zero rows and r = 2. If det = 0, the second row vanishes and r = 1.

  4. a=0:(0bcd)∼(cd0b),det⁡=−bca = 0:\quad \begin{pmatrix} 0 & b \\ c & d \end{pmatrix} \sim \begin{pmatrix} c & d \\ 0 & b \end{pmatrix},\qquad \det = -bc

    If a = 0, we swap the rows: we get (c d; 0 b) and the determinant is −bc. If c ≠ 0 there are two pivots (c and b) when b ≠ 0, that is, when bc ≠ 0. If c = 0, the first column is zero, det = 0 and r ≤ 1.

  5. det⁡(1234)=4−6=−2≠0  ⇒  r=2\det\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} = 4 - 6 = -2 \neq 0 \;\Rightarrow\; r = 2

    Example: (1 2; 3 4) has det = 1·4 − 2·3 = −2 ≠ 0, so r = 2.

  6. det⁡(1224)=4−4=0  ⇒  r=1\det\begin{pmatrix} 1 & 2 \\ 2 & 4 \end{pmatrix} = 4 - 4 = 0 \;\Rightarrow\; r = 1

    Example: (1 2; 2 4) has det = 4 − 4 = 0, so r = 1: row 2 is twice row 1. The rank is 0 only when all four numbers are 0.

What it's for

For a 2×2 matrix the rank can be read from a single number, the determinant. It is also the test for whether the matrix is regular (has an inverse): det ≠ 0.

Proof

Rank of a 3×3 matrix: Sarrus, minors and Gauss

A=(012111234):det⁡A=0, r=2A = \begin{pmatrix} 0 & 1 & 2 \\ 1 & 1 & 1 \\ 2 & 3 & 4 \end{pmatrix}:\quad \det A = 0,\ r = 2
  1. det⁡A=0⋅1⋅4+1⋅1⋅2+2⋅1⋅3−2⋅1⋅2−1⋅1⋅4−0⋅1⋅3\det A = 0\cdot1\cdot4 + 1\cdot1\cdot2 + 2\cdot1\cdot3 - 2\cdot1\cdot2 - 1\cdot1\cdot4 - 0\cdot1\cdot3

    Sarrus's rule: add the three products along the descending diagonals (aei + bfg + cdh) and subtract the three along the ascending ones (ceg + bdi + afh). Here (a, b, c) = (0, 1, 2), (d, e, f) = (1, 1, 1) and (g, h, i) = (2, 3, 4).

  2. det⁡A=0+2+6−4−4−0=0  ⇒  r<3\det A = 0 + 2 + 6 - 4 - 4 - 0 = 0 \;\Rightarrow\; r < 3

    We get det A = 0, so the rank is NOT 3: r < 3.

  3. ∣1123∣=3−2=1≠0  ⇒  r≥2\begin{vmatrix} 1 & 1 \\ 2 & 3 \end{vmatrix} = 3 - 2 = 1 \neq 0 \;\Rightarrow\; r \ge 2

    If det = 0, we look for a non-zero 2×2 minor (a minor is the determinant of a square submatrix). With rows 2 and 3 and columns 1 and 2: 1·3 − 1·2 = 1 ≠ 0. So r ≥ 2 and, since r < 3, r = 2.

  4. (012111234)∼(111012234)∼(111012000)\begin{pmatrix} 0 & 1 & 2 \\ 1 & 1 & 1 \\ 2 & 3 & 4 \end{pmatrix} \sim \begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 2 \\ 2 & 3 & 4 \end{pmatrix} \sim \begin{pmatrix} 1 & 1 & 1 \\ 0 & 1 & 2 \\ 0 & 0 & 0 \end{pmatrix}

    We check with Gauss: R₁ ↔ R₂; then R₃ ← R₃ − 2·R₁ (we get (0, 1, 2)) and R₃ ← R₃ − R₂ (we get 0). There are 2 non-zero rows: r = 2.

  5. B=(123246369): ∣1224∣=0, ∣2346∣=0, …  ⇒  r=1B = \begin{pmatrix} 1 & 2 & 3 \\ 2 & 4 & 6 \\ 3 & 6 & 9 \end{pmatrix}:\ \begin{vmatrix} 1 & 2 \\ 2 & 4 \end{vmatrix} = 0,\ \begin{vmatrix} 2 & 3 \\ 4 & 6 \end{vmatrix} = 0,\ \dots \;\Rightarrow\; r = 1

    If every 2×2 minor is 0 and the matrix is not zero, the rank is 1. Example: all the rows of B are proportional to (1, 2, 3). If every entry were 0, the rank would be 0.

What it's for

For 3×3 matrices Sarrus and minors are handy; for 4×4 or larger, non-square matrices or matrices with many zeros, Gauss is better. All three methods give the same rank.

Proof

Rank of a triangular matrix

∣t11∗∗0⋱∗00tnn∣=t11 t22⋯tnn\begin{vmatrix} t_{11} & * & * \\ 0 & \ddots & * \\ 0 & 0 & t_{nn} \end{vmatrix} = t_{11}\,t_{22} \cdots t_{nn}
  1. det⁡(2130−14005)=2∣−1405∣=2⋅(−5)=−10\det\begin{pmatrix} 2 & 1 & 3 \\ 0 & -1 & 4 \\ 0 & 0 & 5 \end{pmatrix} = 2\begin{vmatrix} -1 & 4 \\ 0 & 5 \end{vmatrix} = 2\cdot(-5) = -10

    An upper triangular matrix has zeros below the diagonal. Expanding along the first column (only its first entry is non-zero), det = t₁₁ times the determinant of what is left; repeating, det = product of the diagonal. Here 2·(−1)·5 = −10.

  2. 2⋅(−1)⋅5=−10≠0  ⇒  r=32 \cdot (-1) \cdot 5 = -10 \neq 0 \;\Rightarrow\; r = 3

    No diagonal entry is 0, so the matrix is already in echelon form with 3 pivots (2, −1 and 5): full rank, r = 3 = n.

  3. T′=(213004005)∼(213004000)  ⇒  r=2T' = \begin{pmatrix} 2 & 1 & 3 \\ 0 & 0 & 4 \\ 0 & 0 & 5 \end{pmatrix} \sim \begin{pmatrix} 2 & 1 & 3 \\ 0 & 0 & 4 \\ 0 & 0 & 0 \end{pmatrix} \;\Rightarrow\; r = 2

    If the second diagonal entry is 0 (matrix T′), det = 2·0·5 = 0. With Gauss, R₃ ← R₃ − (5/4)·R₂ makes the third row vanish and we get r = 2 < 3.

  4. tkk=0  ⇒  tk1=⋯=tkk=0,  tk+1,1=⋯=tk+1,k=0, …t_{kk} = 0 \;\Rightarrow\; t_{k1} = \cdots = t_{kk} = 0,\ \ t_{k+1,1} = \cdots = t_{k+1,k} = 0,\ \dots

    Why does this always happen? If tkk = 0, row k and the rows below it have zeros in columns 1, …, k. Their first possible pivot is in column k + 1 or further right.

  5. n−k+1  >  n−k\hl{n - k + 1} \;>\; \hl{n - k}

    There are n − k + 1 rows (from k to n) for only n − k columns (from k + 1 to n), and each column holds a single pivot. Since n − k + 1 > n − k, at least one of those rows vanishes: r < n.

What it's for

Looking at the diagonal is enough: with no zeros the rank is full and the matrix has an inverse; with any zero, the rank drops. It is useful because many matrices that come out of Gauss are triangular.

Proof

Why [A | I] ~ [I | A⁻¹] computes the inverse

[ A∣I ]∼[ I∣A−1 ][\,A \mid I\,] \sim [\,I \mid A^{-1}\,]
  1. Ek⋯E2E1 A=I(P=Ek⋯E1)E_k \cdots E_2 E_1\,A = I \qquad (P = E_k \cdots E_1)

    If A is n×n and its rank is n, it has a pivot in every row and every column, and row operations lead to the identity I. Each operation is an elementary matrix; we call P the product of all of them, and PA = I.

  2. Ek⋯E1 [ A∣I ]=[ PA∣PI ]=[ I∣P ]E_k \cdots E_1\,[\,A \mid I\,] = [\,PA \mid PI\,] = [\,I \mid P\,]

    We do exactly those same operations to [A | I]. Block by block, each one multiplies both halves by E: in the end [PA | PI] = [I | P].

  3. PA=I  ⇒  A=P−1  ⇒  AP=P−1P=IPA = I \;\Rightarrow\; A = P^{-1} \;\Rightarrow\; AP = P^{-1}P = I

    PA = I only says that P undoes A on one side. But P is a product of elementary matrices, so it is invertible: multiplying PA = I by P⁻¹ gives A = P⁻¹, and then AP = P⁻¹P = I. P works on both sides.

  4. PA=AP=I  ⇒  P=A−1PA = AP = I \;\Rightarrow\; P = A^{-1}

    PA = AP = I is exactly the definition of the inverse: P = A⁻¹. And P is the right half of the final matrix.

What it's for

It is the practical method to compute inverses, by hand or with a program. It also warns you when no inverse exists: if a row vanishes on the left, you cannot reach I.

Proof

Example: computing an inverse with Gauss-Jordan

(1225)−1=(5−2−21)\begin{pmatrix} 1 & 2 \\ 2 & 5 \end{pmatrix}^{-1} = \begin{pmatrix} 5 & -2 \\ -2 & 1 \end{pmatrix}
  1. [ A∣I ]=(12102501)[\,A \mid I\,] = \left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 2 & 5 & 0 & 1 \end{array}\right)

    We write A on the left and the identity on the right, separated by a bar.

  2. ∼(121001−21)\sim \left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 0 & 1 & -2 & 1 \end{array}\right)

    R₂ ← R₂ − 2·R₁ makes the 2 at the bottom left a 0. On the right, the identity changes: (0, 1) − 2·(1, 0) = (−2, 1).

  3. ∼(105−201−21)=[ I∣A−1 ]\sim \left(\begin{array}{cc|cc} 1 & 0 & 5 & -2 \\ 0 & 1 & -2 & 1 \end{array}\right) = [\,I \mid A^{-1}\,]

    R₁ ← R₁ − 2·R₂ makes the 2 at the top a 0. On the right: (1, 0) − 2·(−2, 1) = (5, −2). The left is now I and the right is A⁻¹.

  4. AA−1=(1225)(5−2−21)=(1001)=IAA^{-1} = \begin{pmatrix} 1 & 2 \\ 2 & 5 \end{pmatrix}\begin{pmatrix} 5 & -2 \\ -2 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} = I

    We check: A·A⁻¹ = I. (And also A⁻¹·A = I, because for square matrices the inverse works on both sides.)

  5. A−1=1ad−bc(d−b−ca)=11(5−2−21)A^{-1} = \dfrac{1}{ad - bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix} = \dfrac{1}{1}\begin{pmatrix} 5 & -2 \\ -2 & 1 \end{pmatrix}

    For 2×2 there is a shortcut: A⁻¹ = (1/det)·(d −b; −c a). Here det = 1·5 − 2·2 = 1 and we get the same matrix.

What it's for

Once you have A⁻¹ you can solve AX = b for any b with one multiplication, without repeating Gauss's method.

Proof

It has an inverse if and only if the rank is n

∃ A−1  ⟺  r=n\exists\, A^{-1} \iff r = n
  1. r=n  ⇒  PA=I  ⇒  P=A−1r = n \;\Rightarrow\; PA = I \;\Rightarrow\; P = A^{-1}

    If r = n, the reduced form of A is I. This is the case of the Gauss-Jordan proof: P is built with PA = I and P = A⁻¹. So rank n implies that an inverse exists.

  2. ∃ A−1, r<n  ⇒  PA=E,En∙=(0,…,0)\exists\, A^{-1},\ r < n \;\Rightarrow\; PA = E,\quad E_{n\bullet} = (0, \dots, 0)

    The other way round: suppose A has an inverse but r < n. When we reduce, PA = E has a row of zeros (the last one): En• = (0, …, 0).

  3. P=P(AA−1)=(PA)A−1=EA−1P = P(AA^{-1}) = (PA)A^{-1} = EA^{-1}

    We multiply by A⁻¹ on the right: P = P(AA⁻¹) = (PA)A⁻¹ = EA⁻¹.

  4. Pn∙=En∙ A−1=(0,…,0)P_{n\bullet} = E_{n\bullet}\,A^{-1} = (0, \dots, 0)

    Row n of EA⁻¹ is (row n of E)·A⁻¹, which is zeros. So P has a row of zeros.

  5. (PP−1)n∙=Pn∙ P−1=(0,…,0)≠In∙(PP^{-1})_{n\bullet} = P_{n\bullet}\,P^{-1} = (0, \dots, 0) \neq I_{n\bullet}

    But P has an inverse (it is a product of elementary matrices) and PP⁻¹ = I. Row n of PP⁻¹ would be Pn•P⁻¹ = (0, …, 0), while row n of I is not zero. Contradiction: r < n is impossible.

  6. (12102401)∼(121000−21)  ⇒  ∄ A−1\left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 2 & 4 & 0 & 1 \end{array}\right) \sim \left(\begin{array}{cc|cc} 1 & 2 & 1 & 0 \\ 0 & 0 & -2 & 1 \end{array}\right) \;\Rightarrow\; \nexists\, A^{-1}

    Example: A = (1 2; 2 4) has rank 1. After R₂ ← R₂ − 2·R₁, the left part of [A | I] has a row of zeros: you cannot reach I and A⁻¹ does not exist.

What it's for

It tells you when it is worth looking for the inverse: rank n (det ≠ 0) yes, lower rank no. And for systems, a square A of rank n has a unique solution for any b.

Proof

The inverse of a product: (AB)⁻¹ = B⁻¹A⁻¹

(AB)−1=B−1A−1(AB)^{-1} = B^{-1}A^{-1}
  1. (AB)(B−1A−1)=A(BB−1)A−1(AB)(B^{-1}A^{-1}) = A(BB^{-1})A^{-1}

    To see that B⁻¹A⁻¹ is the inverse of AB we multiply it by AB. With the associative property we group: A(BB⁻¹)A⁻¹.

  2. (AB)(B−1A−1)=A I A−1=AA−1=I(AB)(B^{-1}A^{-1}) = A\,I\,A^{-1} = AA^{-1} = I

    BB⁻¹ = I, and I changes nothing: we are left with AA⁻¹ = I.

  3. (B−1A−1)(AB)=B−1(A−1A)B=B−1B=I(B^{-1}A^{-1})(AB) = B^{-1}(A^{-1}A)B = B^{-1}B = I

    On the other side: (B⁻¹A⁻¹)(AB) = B⁻¹(A⁻¹A)B = B⁻¹B = I. It works on both sides, which is the definition of the inverse.

  4. A=(1201), B=(1031), AB=(7231)A = \begin{pmatrix} 1 & 2 \\ 0 & 1 \end{pmatrix},\ B = \begin{pmatrix} 1 & 0 \\ 3 & 1 \end{pmatrix},\ AB = \begin{pmatrix} 7 & 2 \\ 3 & 1 \end{pmatrix}

    Example: A = (1 2; 0 1) and B = (1 0; 3 1). Their product is AB = (7 2; 3 1).

  5. B−1A−1=(10−31)(1−201)=(1−2−37)=(AB)−1B^{-1}A^{-1} = \begin{pmatrix} 1 & 0 \\ -3 & 1 \end{pmatrix}\begin{pmatrix} 1 & -2 \\ 0 & 1 \end{pmatrix} = \begin{pmatrix} 1 & -2 \\ -3 & 7 \end{pmatrix} = (AB)^{-1}

    B⁻¹ = (1 0; −3 1) and A⁻¹ = (1 −2; 0 1). Their product B⁻¹A⁻¹ = (1 −2; −3 7) is the inverse of AB (with the 2×2 shortcut: det(AB) = 7 − 6 = 1).

  6. A−1B−1=(7−2−31)≠(AB)−1A^{-1}B^{-1} = \begin{pmatrix} 7 & -2 \\ -3 & 1 \end{pmatrix} \neq (AB)^{-1}

    If they were multiplied in the same order, A⁻¹B⁻¹ = (7 −2; −3 1), which is NOT the inverse of AB. The order is reversed.

What it's for

It is like socks and shoes: if you put on socks first and then shoes, to undo it you take off the shoes first. It is used, for example, to prove that R = L = A⁻¹ when the matrix is square.

Proof

The inverse of the transpose: (Aᵗ)⁻¹ = (A⁻¹)ᵗ

(At)−1=(A−1)t(A^t)^{-1} = (A^{-1})^t
  1. (XY)t=YtXt,It=I(XY)^t = Y^tX^t,\qquad I^t = I

    We use two facts: the transpose of a product reverses the order, (XY)ᵗ = YᵗXᵗ, and Iᵗ = I.

  2. At (A−1)t=(A−1A)t=It=IA^t\,(A^{-1})^t = (A^{-1}A)^t = I^t = I

    Aᵗ(A⁻¹)ᵗ = (A⁻¹A)ᵗ, because transposing the product reverses the order; and (A⁻¹A)ᵗ = Iᵗ = I.

  3. (A−1)t At=(AA−1)t=It=I(A^{-1})^t\,A^t = (AA^{-1})^t = I^t = I

    On the other side, (A⁻¹)ᵗAᵗ = (AA⁻¹)ᵗ = Iᵗ = I. So (A⁻¹)ᵗ is the inverse of Aᵗ.

  4. A=(1235),A−1=(−523−1),(A−1)t=(−532−1)A = \begin{pmatrix} 1 & 2 \\ 3 & 5 \end{pmatrix},\quad A^{-1} = \begin{pmatrix} -5 & 2 \\ 3 & -1 \end{pmatrix},\quad (A^{-1})^t = \begin{pmatrix} -5 & 3 \\ 2 & -1 \end{pmatrix}

    Example: A = (1 2; 3 5), with det = −1 and A⁻¹ = (−5 2; 3 −1). We transpose A⁻¹: (A⁻¹)ᵗ = (−5 3; 2 −1).

  5. At=(1325),(At)−1=(−532−1)A^t = \begin{pmatrix} 1 & 3 \\ 2 & 5 \end{pmatrix},\quad (A^t)^{-1} = \begin{pmatrix} -5 & 3 \\ 2 & -1 \end{pmatrix}

    By the other route: Aᵗ = (1 3; 2 5), with det = 5 − 6 = −1, and (Aᵗ)⁻¹ = (−5 3; 2 −1). They match.

What it's for

It lets you invert and transpose in whichever order is more convenient. For example, it proves that the inverse of a symmetric matrix (A = Aᵗ) is also symmetric.

Proof

Solving AX = b with the inverse: X = A⁻¹b

AX=b  ⇒  X=A−1bAX = b \;\Rightarrow\; X = A^{-1}b
  1. AX=b  ⇒  A−1(AX)=A−1bAX = b \;\Rightarrow\; A^{-1}(AX) = A^{-1}b

    We start from AX = b, with A square and invertible. We multiply both sides by A⁻¹ on the LEFT (with matrices the order matters).

  2. (A−1A) X=A−1b(A^{-1}A)\,X = A^{-1}b

    With the associative property we group: (A⁻¹A)X.

  3. I X=X=A−1bI\,X = X = A^{-1}b

    A⁻¹A = I and IX = X. We are left with X = A⁻¹b.

  4. A(A−1b)=(AA−1) b=I b=bA(A^{-1}b) = (AA^{-1})\,b = I\,b = b

    We check that it is a solution: A(A⁻¹b) = (AA⁻¹)b = Ib = b. So a solution exists and, since we chose nothing along the way, it is the only one.

  5. (2111)(xy)=(32)  ⇒  X=(1−1−12)(32)=(11)\begin{pmatrix} 2 & 1 \\ 1 & 1 \end{pmatrix}\binom{x}{y} = \binom{3}{2} \;\Rightarrow\; X = \begin{pmatrix} 1 & -1 \\ -1 & 2 \end{pmatrix}\binom{3}{2} = \binom{1}{1}

    Example: 2x + y = 3 and x + y = 2. With A⁻¹ = (1 −1; −1 2), X = A⁻¹(3, 2) = (3 − 2, −3 + 4) = (1, 1).

What it's for

It solves the system without repeating Gauss: if b changes, you just multiply again. It only works for a square A with an inverse; the other cases (more unknowns than equations, or the other way round) are the topic of the pseudoinverse.

Было полезно?

Это пособие бесплатное и без рекламы. Если оно помогает тебе учиться, можешь угостить меня кофе.

Угостить кофе