高斯消去法
Ax=b
======================
E1 : -x1 + x2 + 2x3 = 2
E2 : 3x1 - x2 + x3 = 6
E3 : -x1 + 3x2 + 4x3 = 4
利用 online gaussian elimination calculator
https://matrix.reshish.com/gauss-jordanElimination.php
Your matrix
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | -1 | 1 | 2 | 2 |
| 2 | 3 | -1 | 1 | 6 |
| 3 | -1 | 3 | 4 | 4 |
Find the pivot in the 1st column in the 1st row (inversing the sign in the whole row)
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | -1 | -2 | -2 |
| 2 | 3 | -1 | 1 | 6 |
| 3 | -1 | 3 | 4 | 4 |
Multiply the 1st row by 3
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 3 | -3 | -6 | -6 |
| 2 | 3 | -1 | 1 | 6 |
| 3 | -1 | 3 | 4 | 4 |
Subtract the 1st row from the 2nd row and restore it
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | -1 | -2 | -2 |
| 2 | 0 | 2 | 7 | 12 |
| 3 | -1 | 3 | 4 | 4 |
Multiply the 1st row by -1
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | -1 | 1 | 2 | 2 |
| 2 | 0 | 2 | 7 | 12 |
| 3 | -1 | 3 | 4 | 4 |
Subtract the 1st row from the 3rd row and restore it
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | -1 | -2 | -2 |
| 2 | 0 | 2 | 7 | 12 |
| 3 | 0 | 2 | 2 | 2 |
Make the pivot in the 2nd column by dividing the 2nd row by 2
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | -1 | -2 | -2 |
| 2 | 0 | 1 | 3.5 | 6 |
| 3 | 0 | 2 | 2 | 2 |
Multiply the 2nd row by -1
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | -1 | -2 | -2 |
| 2 | 0 | -1 | -3.5 | -6 |
| 3 | 0 | 2 | 2 | 2 |
Subtract the 2nd row from the 1st row and restore it
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | 0 | 1.5 | 4 |
| 2 | 0 | 1 | 3.5 | 6 |
| 3 | 0 | 2 | 2 | 2 |
Multiply the 2nd row by 2
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | 0 | 1.5 | 4 |
| 2 | 0 | 2 | 7 | 12 |
| 3 | 0 | 2 | 2 | 2 |
Subtract the 2nd row from the 3rd row and restore it
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | 0 | 1.5 | 4 |
| 2 | 0 | 1 | 3.5 | 6 |
| 3 | 0 | 0 | -5 | -10 |
Make the pivot in the 3rd column by dividing the 3rd row by -5
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | 0 | 1.5 | 4 |
| 2 | 0 | 1 | 3.5 | 6 |
| 3 | 0 | 0 | 1 | 2 |
Multiply the 3rd row by 1.5
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | 0 | 1.5 | 4 |
| 2 | 0 | 1 | 3.5 | 6 |
| 3 | 0 | 0 | 1.5 | 3 |
Subtract the 3rd row from the 1st row and restore it
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 1 |
| 2 | 0 | 1 | 3.5 | 6 |
| 3 | 0 | 0 | 1 | 2 |
Multiply the 3rd row by 3.5
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 1 |
| 2 | 0 | 1 | 3.5 | 6 |
| 3 | 0 | 0 | 3.5 | 7 |
Subtract the 3rd row from the 2nd row and restore it
| X1 | X2 | X3 | b | |
|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 1 |
| 2 | 0 | 1 | 0 | -1 |
| 3 | 0 | 0 | 1 | 2 |
Solution set:
x1 = 1
x2 = -1
x3 = 2

沒有留言:
張貼留言