|
1 | 1 | # Gaussian Elimination
|
2 | 2 |
|
3 |
| -So, how exactly do we go about solving a system of linear equations? Well, one way is _Gaussian Elimination_, which you may have encountered before in a math class or two. The basic idea is that we take a system of equations, |
| 3 | +How exactly do we go about solving a system of linear equations? Well, one way is _Gaussian Elimination_, which you may have encountered before in a math class or two. The basic idea is that we take a system of equations, |
4 | 4 |
|
5 | 5 |
|
6 | 6 | $$
|
@@ -195,7 +195,7 @@ That's right! _Gaussian Elimination_
|
195 | 195 |
|
196 | 196 | ## The Method
|
197 | 197 |
|
198 |
| -Here I should point out that Gaussian elimination makes sense from a purely analytical point of view. That is to say that for small systems of equations, it's relatively straightforward to do this method by hand; however, for large systems, this \(of course\) become tedious and we will need to find an appropriate numerical solution. For this reason, I have split this section into two parts. One will cover the analytical framework, and the other will cover an algorithm you can write in your favorite programming language. |
| 198 | +Here I should point out that Gaussian elimination makes sense from a purely analytical point of view. For small systems of equations, it's relatively straightforward to do this method by hand; however, for large systems, this \(of course\) become tedious and we will need to find an appropriate numerical solution. For this reason, I have split this section into two parts. One will cover the analytical framework, and the other will cover an algorithm you can write in your favorite programming language. |
199 | 199 |
|
200 | 200 | In the end, reducing large systems of equations boils down to a game you play on a seemingly random matrix where you have the following moves available:
|
201 | 201 |
|
|
263 | 263 | \end{array}
|
264 | 264 | \right]
|
265 | 265 | $$
|
266 |
| - |
267 | 266 | If that value is $$0$$, the matrix is singular and the system has no solutions. Feel free to exit here, but I'm powering through by moving on to the next column, baby!
|
268 | 267 |
|
269 | 268 | 2. Swap the row with the highest valued element with the current row.
|
@@ -338,8 +337,6 @@ In code, this looks like:
|
338 | 337 | [import:4-33, lang:"haskell"](code/haskell/gaussianElimination.hs)
|
339 | 338 | {% endmethod %}
|
340 | 339 |
|
341 |
| -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 code with the necessary steps. Let me know if anything is unclear! |
342 |
| - |
343 | 340 | 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 continue further reducing the matrix, but with a twist: using the *Back-Substitution*.
|
344 | 341 |
|
345 | 342 | The back-substitution method is precisely what we said above, but for every pivot starting from the bottom right one.
|
|
0 commit comments