Differences between revisions 1 and 10 (spanning 9 versions)
Revision 1 as of 2021-09-06 20:19:33
Size: 3043
Comment:
Revision 10 as of 2024-01-27 23:19:35
Size: 6477
Comment: Non-invertable
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

'''Gaussian elimination''' or '''Gauss-Jordan elimination''' is a foundational process for solving systems of linear equations.

Elimination can be generalized as the process of transforming an unsolvable '''''A'''x = b'' into a solvable '''''U'''x = c''.

<<TableOfContents>>

-----

Line 13: Line 23:


== Algebra ==

The first step to solving this system is eliminating `x`. Note that `x = 2 - 2y - z` (from the first equation) and substitute into the second equation.
The first step to solving this system with traditional algebra is eliminating ''x''.

Trivially rewrite the first equation:

{{{
x + 2y + z = 2
x = 2 - 2y - z
}}}

Substitute this into the second equation:
Line 26: Line 41:
Now `x` has been eliminated. But can either `y` or `z` be eliminated the same way? Now ''x'' has been eliminated. But can either ''y'' or ''z'' be eliminated the same way?

----
Line 32: Line 49:
=== Matrix Picture ===

This system can be expressed in the form `Ax = b`:

{{{
This system can be expressed in the form '''''A'''x = b'':

{{{
    A x = b
Line 46: Line 63:
=== A -> U ===

The first step to solving this system is eliminating the first column. This means identifying a pivot and reducing all below numbers to `0`. The pivot in this case is the boxed `1` in the top-left.

{{{
[1] 2 1
 3 8 1
 0 4 1
}}}

In order to eliminate the `3` below the pivot, the pivot's row should be multiplied by some number such that, by subtracting the rows, the transformed row will have a zero in that position. `3 - m1 = 0`; `m` is trivially `3`.

{{{
   3 8 1
- 1m - 2m - 1m
 ___ ___ ___
   0 2 -2

[1] 2 1 [1] 2 1
 3 8 1 -> 0 2 -2
 0 4 1 0 4 1
}}}

This process repeats until the matrix is fully eliminated.

{{{
[1] 2 1
 0 [2] -2
 0 4 1

4 - 2m = 0
     m = 2

   4 1
- 2m - -2m
____ _____
   0 5

[1] 2 1 [1] 2 1
 0 [2] -2 -> 0 [2] -2
 0 4 1 0 0 5
}}}

This transformed matrix is called `U`.
=== Eliminating A ===

The solution lies in the '''elimination''' of '''''A'''''.

The first step is identifying '''pivots'''. By reducing the entire column to zeros and the pivot, it is eliminated into a '''pivot column'''.

Pivots are noted with boxes or circles in the matrix, as in:

{{{
┌ ┐
│ [1] 2 1│
│ 3 8 1│
│ 0 4 1│
└ ┘
}}}

Algebraically, a value is being zeroed out by expressing that variable in terms of the other equations.

Literally, we are subtracting a multiple of the pivot row from the targeted row to create a zero below the pivot. That multiple is discovered by solving part of the equation.

{{{
┌ ┐ ┌ ┐ ┌ ┐
│ 3│ │ 1│ │ 0│
│ 8│ - m│ 2│ = │ ?│
│ 1│ │ 1│ │ ?│
└ ┘ └ ┘ └ ┘

3 - 1m = 0
     m = 3

┌ ┐ ┌ ┐ ┌ ┐
│ 3│ │ 1│ │ 0│
│ 8│ - 3│ 2│ = │ 2│
│ 1│ │ 1│ │ -2│
└ ┘ └ ┘ └ ┘
}}}

This process is then repeated for every row below. In this specific problem the multiple is zero as there is already a zero in place.

{{{
┌ ┐ ┌ ┐ ┌ ┐
│ 0│ │ 1│ │ 0│
│ 4│ - m│ 2│ = │ ?│
│ 1│ │ 1│ │ ?│
└ ┘ └ ┘ └ ┘

0 - 1m = 0
     m = 0

┌ ┐ ┌ ┐ ┌ ┐
│ 0│ │ 1│ │ 0│
│ 4│ - 0│ 2│ = │ 4│
│ 1│ │ 1│ │ 1│
└ ┘ └ ┘ └ ┘
}}}

The matrix is reconstructed:

{{{
┌ ┐
│ [1] 2 1│
│ 0 2 -2│
│ 0 4 1│
└ ┘
}}}

The process is then repeated with a new pivot.

If a pivot is zero, rows should be swapped using [[LinearAlgebra/SpecialMatrices#Permutation_Matrices|permutation matrices]]. If all rows are zero, then this is a '''free column''' (as opposed to a '''pivot column''') and should be skipped.

In this specific problem we do have another pivot.

{{{
┌ ┐
│ [1] 2 1│
│ 0 [2] -2│
│ 0 4 1│
└ ┘
}}}

Another iteration of elimination yields this matrix, '''''U'''''.
Line 99: Line 153:


=== b -> c ===

Now, replicate the subtractions on `b`. Recall that the multipliers were 3 and 2:

{{{
  12
- 2m
____
   6

┌ ┐ ┌ ┐
│ 2│ │ 2│
│12│ -> │ 6│
│ 2│ │ 2│
└ ┘ └ ┘

   2
- 6m
____
 -10

┌ ┐ ┌ ┐
│ 2│ │ 2│
│ 6│ -> │ 6│
│ 2│ │-10│
└ ┘ └ ┘
}}}



=== Ux = c ===

The system has been reduced to `Ux = c`:
'''''U''''' is the '''row echelon form''' of '''''A'''''. It may also be a [[LinearAlgebra/SpecialMatrices#Upper_Triangular_Matrices|upper triangular matrix]].



=== Balancing the Right Hand Side ===

To re-balance the original equation, replicate the subtractions on ''b''. Recall that the (non-zero) multipliers were 3 and 2:

{{{
┌ ┐
│ 2│
│12│
│ 2│
└ ┘

12 - 2m
12 - 2(3)
6

┌ ┐
│ 2│
│ 6│
│ 2│
└ ┘

2 - 6m
2 - 6(2)
-10

┌ ┐
│ 2│
│ 6│
│-10│
└ ┘
}}}



=== Result of Elimination ===

The system has been reduced to '''''U'''x = c'':
Line 145: Line 205:
2y = 2z = 6 2y + 2z = 6
Line 149: Line 209:
Algebraic substitution can now be used to solve; x=2, y=1, z=-2.



=== Failure of Elimination ===

Elimination is the process to transform `A` -> `U`, where `U` must have `n` non-zero pivots for `n` unknowns.

If the equations align such that a pivot would be `0`, you have '''temporary failure'''. Re-align the equations and re-eliminate.

If the equations cannot be re-aligned to solve, you hve '''permanent failure'''
Algebraic substitution can now be used to solve; ''x''=2, ''y''=1, ''z''=-2.

----



== Simplification with Augmented Matrices ==

Instead of eliminating '''''A''''' then re-balancing ''b'', eliminate the augmented matrix in a single step.

{{{
Augmented matrix = [ A b]

                   ┌ ┐
                   │ 1 2 1 2│
Augmented matrix = │ 3 8 1 12│
                   │ 0 4 1 2│
                   └ ┘
}}}

Elimination proceeds the exact same way.

{{{
┌ ┐
│[1] 2 1 2│
│ 3 8 1 12│
│ 0 4 1 2│
└ ┘
┌ ┐
│[1] 2 1 2│
│ 0 [2] -2 6│
│ 0 4 1 2│
└ ┘
┌ ┐
│[1] 2 1 2│
│ 0 [2] -2 6│
│ 0 0 [5] -10│
└ ┘
}}}

Which can be re-expressed as:

{{{
┌ ┐ ┌ ┐ ┌ ┐
│[1] 2 1 │ │ x│ │ 2│
│ 0 [2] -2 │ │ y│ = │ 6│
│ 0 0 [5]│ │ z│ │-10│
└ ┘ └ ┘ └ ┘
}}}

Note that this matches the reduced system that was achieved above.

----



== Reduced Row Echelon Form ==

'''''U''''' can be further reduced with '''backwards elimination'''. Repeat the process in the opposite direction until all numbers above ''and'' below the pivots are zero, yielding the matrix '''''R'''''.

'''''R''''' is the '''reduced row echelon form''' of '''''A'''''. It may also be a [[LinearAlgebra/SpecialMatrices#Lower_Triangular_Matrices|lower triangular matrix]].

----



== Failure of Elimination ==

'''''U''''' must have ''n'' non-zero pivots for ''n'' unknowns.

As noted above, if a pivot is zero, rows should be swapped using [[LinearAlgebra/SpecialMatrices#Permutation_Matrices|permutation matrices]]. This is a '''temporary failure'''.

If rows cannot be swapped to complete elimination, the system has '''permanent failure'''. The matrix must then be [[LinearAlgebra/MatrixProperties#Invertability|singular and non-invertable]].

Elimination

Gaussian elimination or Gauss-Jordan elimination is a foundational process for solving systems of linear equations.

Elimination can be generalized as the process of transforming an unsolvable Ax = b into a solvable Ux = c.


Introduction

Consider the below system of equations.

x + 2y + z = 2
3x + 8y + z = 12
4y + z = 2

The first step to solving this system with traditional algebra is eliminating x.

Trivially rewrite the first equation:

x + 2y + z = 2
x = 2 - 2y - z

Substitute this into the second equation:

3x + 8y + z = 12
3(2 - 2y - z) + 8y + z = 12
6 - 6y - 3z + 8y + z = 12
2y - 2z = 6

Now x has been eliminated. But can either y or z be eliminated the same way?


Linear Algebra

This system can be expressed in the form Ax = b:

    A      x  =   b

┌      ┐ ┌  ┐   ┌  ┐
│ 1 2 1│ │ x│   │ 2│
│ 3 8 1│ │ y│ = │12│
│ 0 4 1│ │ z│   │ 2│
└      ┘ └  ┘   └  ┘

Eliminating A

The solution lies in the elimination of A.

The first step is identifying pivots. By reducing the entire column to zeros and the pivot, it is eliminated into a pivot column.

Pivots are noted with boxes or circles in the matrix, as in:

┌        ┐
│ [1] 2 1│
│  3  8 1│
│  0  4 1│
└        ┘

Algebraically, a value is being zeroed out by expressing that variable in terms of the other equations.

Literally, we are subtracting a multiple of the pivot row from the targeted row to create a zero below the pivot. That multiple is discovered by solving part of the equation.

┌  ┐    ┌  ┐   ┌  ┐
│ 3│    │ 1│   │ 0│
│ 8│ - m│ 2│ = │ ?│
│ 1│    │ 1│   │ ?│
└  ┘    └  ┘   └  ┘

3 - 1m = 0
     m = 3

┌  ┐    ┌  ┐   ┌   ┐
│ 3│    │ 1│   │  0│
│ 8│ - 3│ 2│ = │  2│
│ 1│    │ 1│   │ -2│
└  ┘    └  ┘   └   ┘

This process is then repeated for every row below. In this specific problem the multiple is zero as there is already a zero in place.

┌  ┐    ┌  ┐   ┌  ┐
│ 0│    │ 1│   │ 0│
│ 4│ - m│ 2│ = │ ?│
│ 1│    │ 1│   │ ?│
└  ┘    └  ┘   └  ┘

0 - 1m = 0
     m = 0

┌  ┐    ┌  ┐   ┌  ┐
│ 0│    │ 1│   │ 0│
│ 4│ - 0│ 2│ = │ 4│
│ 1│    │ 1│   │ 1│
└  ┘    └  ┘   └  ┘

The matrix is reconstructed:

┌         ┐
│ [1] 2  1│
│  0  2 -2│
│  0  4  1│
└         ┘

The process is then repeated with a new pivot.

If a pivot is zero, rows should be swapped using permutation matrices. If all rows are zero, then this is a free column (as opposed to a pivot column) and should be skipped.

In this specific problem we do have another pivot.

┌           ┐
│ [1]  2   1│
│  0  [2] -2│
│  0   4   1│
└           ┘

Another iteration of elimination yields this matrix, U.

┌           ┐
│[1]  2   1 │
│ 0  [2] -2 │
│ 0   0  [5]│
└           ┘

U is the row echelon form of A. It may also be a upper triangular matrix.

Balancing the Right Hand Side

To re-balance the original equation, replicate the subtractions on b. Recall that the (non-zero) multipliers were 3 and 2:

┌  ┐
│ 2│
│12│
│ 2│
└  ┘

12 - 2m
12 - 2(3)
6

┌  ┐
│ 2│
│ 6│
│ 2│
└  ┘

2 - 6m
2 - 6(2)
-10

┌   ┐
│  2│
│  6│
│-10│
└   ┘

Result of Elimination

The system has been reduced to Ux = c:

┌           ┐ ┌  ┐   ┌   ┐
│[1]  2   1 │ │ x│   │  2│
│ 0  [2] -2 │ │ y│ = │  6│
│ 0   0  [5]│ │ z│   │-10│
└           ┘ └  ┘   └   ┘

x + 2y + z = 2
2y + 2z = 6
5x = -10

Algebraic substitution can now be used to solve; x=2, y=1, z=-2.


Simplification with Augmented Matrices

Instead of eliminating A then re-balancing b, eliminate the augmented matrix in a single step.

Augmented matrix = [   A    b]

                   ┌         ┐
                   │ 1 2 1  2│
Augmented matrix = │ 3 8 1 12│
                   │ 0 4 1  2│
                   └         ┘

Elimination proceeds the exact same way.

┌          ┐
│[1] 2 1  2│
│ 3  8 1 12│
│ 0  4 1  2│
└          ┘
┌            ┐
│[1]  2   1 2│
│ 0  [2] -2 6│
│ 0   4   1 2│
└            ┘
┌               ┐
│[1]  2   1    2│
│ 0  [2] -2    6│
│ 0   0  [5] -10│
└               ┘

Which can be re-expressed as:

┌           ┐ ┌  ┐   ┌   ┐
│[1]  2   1 │ │ x│   │  2│
│ 0  [2] -2 │ │ y│ = │  6│
│ 0   0  [5]│ │ z│   │-10│
└           ┘ └  ┘   └   ┘

Note that this matches the reduced system that was achieved above.


Reduced Row Echelon Form

U can be further reduced with backwards elimination. Repeat the process in the opposite direction until all numbers above and below the pivots are zero, yielding the matrix R.

R is the reduced row echelon form of A. It may also be a lower triangular matrix.


Failure of Elimination

U must have n non-zero pivots for n unknowns.

As noted above, if a pivot is zero, rows should be swapped using permutation matrices. This is a temporary failure.

If rows cannot be swapped to complete elimination, the system has permanent failure. The matrix must then be singular and non-invertable.


CategoryRicottone

LinearAlgebra/Elimination (last edited 2024-06-06 02:33:34 by DominicRicottone)