You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapters/matrix_methods/gaussian_elimination/gaussian_elimination.md
+16-11Lines changed: 16 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -81,12 +81,12 @@ $$
81
81
$$
82
82
83
83
84
-
and it has a particular name: _Row Eschelon Form_. Basically, any matrix can be considered in row eschelon form if
84
+
and it has a particular name: _Row Echelon Form_. Basically, any matrix can be considered in row echelon form if
85
85
86
86
1. All non-zero rows are above rows of all zeros
87
87
2. The leading coefficient or _pivot_ (the first non-zero element in every row when reading from left to right) is right of the pivot of the row above it.
88
88
89
-
Now, Row Eschelon Form is nice, but wouldn't it be even better if our system of equations looked simply like this
89
+
Now, Row Echelon Form is nice, but wouldn't it be even better if our system of equations looked simply like this
90
90
91
91
92
92
$$
@@ -112,9 +112,9 @@ $$
112
112
$$
113
113
114
114
115
-
And again has a special name * **Reduced** Row Eschelon Form*. Now, it seems obvious to point out that if we remove the values to the right of the equals sign \($$=$$\), Row Eschelon Form is an upper triangular matrix, while Reduced Row Eschelon Form is diagonal. This might not be important now, but it will play an important role in future discussions, so keep it buzzing in the back of your brain.
115
+
And again has a special name * **Reduced** Row Echelon Form*. Now, it seems obvious to point out that if we remove the values to the right of the equals sign \($$=$$\), Row Echelon Form is an upper triangular matrix. This might not be important now, but it will play an important role in future discussions, so keep it buzzing in the back of your brain.
116
116
117
-
For now, I hope the motivation is clear: we want to convert a matrix into Row Eschelon and (potentially) Reduced Row Eschelon Form to make large systems of equations trivial to solve, so we need some method to do that. What is that method called? \(Hint: It's the title of this section\)
117
+
For now, I hope the motivation is clear: we want to convert a matrix into Row Echelon and (potentially) Reduced Row Echelon Form to make large systems of equations trivial to solve, so we need some method to do that. What is that method called? \(Hint: It's the title of this section\)
118
118
119
119
That's right! _Gaussian Elimination_
120
120
@@ -128,7 +128,7 @@ In the end, reducing large systems of equations boils down to a game you play on
128
128
2. You can multiply any row by a non-zero scale value
129
129
3. You can add any row to a multiple of any other row
130
130
131
-
That's it. Before continuing, I suggest you try to recreate the Row Eschelon matrix we made above. That is, do the following:
131
+
That's it. Before continuing, I suggest you try to recreate the Row Echelon matrix we made above. That is, do the following:
132
132
133
133
$$
134
134
\left[
@@ -150,7 +150,7 @@ $$
150
150
151
151
There are plenty of different strategies you could use to do this, and no one strategy is better than the rest. Personally, I usually try to multiply each row in the matrix by different values and add rows together until the first column is all the same value, and then I subtract the first row from all subsequent rows. I then do the same thing for the following columns.
152
152
153
-
After you get an upper triangular matrix, the next step is diagonalizing to create the Reduced Row Eschelon Form. In other words, we do the following:
153
+
After you get an upper triangular matrix, the next step is diagonalizing to create the Reduced Row Echelon Form. In other words, we do the following:
154
154
155
155
$$
156
156
\left[
@@ -170,7 +170,7 @@ $$
170
170
\right]
171
171
$$
172
172
173
-
Here, the idea is similar to above. You can do basically anything you want. My strategy is usually the same as before, but starts from the right-most column and subtracts upwards instead of downwards.
173
+
Here, the idea is similar to above. The strategy is the same as before, but starts from the right-most column and subtracts upwards instead of downwards.
As with all code, it takes time to fully absorb what is going on and why everything is happening; however, I have tried to comment the above psuedocode with the necessary steps. Let me know if anything is unclear!
264
+
As with all code, it takes time to fully absorb what is going on and why everything is happening; however, I have tried to comment the above pseudocode with the necessary steps. Let me know if anything is unclear!
263
265
264
-
Now, to be clear: this algorithm creates an upper-triangular matrix. In other words, it only creates a matrix in *Row Eschelon Form*, not * **Reduced** Row Eschelon Form*! So what do we do from here? Well, we could create another step to further reduce the matrix, but another method would be to use *Back-Substitution*.
266
+
Now, to be clear: this algorithm creates an upper-triangular matrix. In other words, it only creates a matrix in *Row Echelon Form*, not * **Reduced** Row Echelon Form*! So what do we do from here? Well, we could create another step to further reduce the matrix, but another method would be to use *Back-Substitution*.
265
267
266
268
The back-substitution method is precisely what we said above.
267
-
If we have a matrix in Row-Eschelon Form, we can directly solve for $$z$$, and then plug that value in to find $$y$$ and then plug both of those values in to find $$x$$!
269
+
If we have a matrix in Row Echelon Form, we can directly solve for $$z$$, and then plug that value in to find $$y$$ and then plug both of those values in to find $$x$$!
268
270
Even though this seems straightforward, the pseudocode might not be as simple as you thought!
Now, as for what's next... Well, we are in for a treat! The above algorithm clearly has 3 `for` loops, and will thus have a complexity of $$\sim O(n^3)$$, which is abysmal! If we can reduce the matrix to a specifically **tridiagonal** matrix, we can actually solve the system in $$\sim O(n)$$! How? Well, we can use an algorithm known as the _Tri-Diagonal Matrix Algorithm_\(TDMA\) also known as the _Thomas Algorithm_.
@@ -281,6 +285,8 @@ The full code can be seen here:
0 commit comments