Skip to content

Instantly share code, notes, and snippets.

@Deamon5550
Created October 7, 2013 10:31
Show Gist options
  • Save Deamon5550/6865770 to your computer and use it in GitHub Desktop.
Save Deamon5550/6865770 to your computer and use it in GitHub Desktop.
Solve the following system:
{2x+y-2z = 10
3x+2y+2z = 1
5x+4y+3z = 4
Express the system in matrix form:
(2 | 1 | -2
3 | 2 | 2
5 | 4 | 3)(x
y
z) = (10
1
4)
Write the system in augmented matrix form and use Gaussian elimination:
(2 | 1 | -2 | 10
3 | 2 | 2 | 1
5 | 4 | 3 | 4)
Swap row 1 with row 3:
(5 | 4 | 3 | 4
3 | 2 | 2 | 1
2 | 1 | -2 | 10)
Subtract 3/5 × (row 1) from row 2:
(5 | 4 | 3 | 4
0 | -2/5 | 1/5 | -7/5
2 | 1 | -2 | 10)
Multiply row 2 by 5:
(5 | 4 | 3 | 4
0 | -2 | 1 | -7
2 | 1 | -2 | 10)
Subtract 2/5 × (row 1) from row 3:
(5 | 4 | 3 | 4
0 | -2 | 1 | -7
0 | -3/5 | -16/5 | 42/5)
Multiply row 3 by 5:
(5 | 4 | 3 | 4
0 | -2 | 1 | -7
0 | -3 | -16 | 42)
Swap row 2 with row 3:
(5 | 4 | 3 | 4
0 | -3 | -16 | 42
0 | -2 | 1 | -7)
Subtract 2/3 × (row 2) from row 3:
(5 | 4 | 3 | 4
0 | -3 | -16 | 42
0 | 0 | 35/3 | -35)
Multiply row 3 by 3/35:
(5 | 4 | 3 | 4
0 | -3 | -16 | 42
0 | 0 | 1 | -3)
Add 16 × (row 3) to row 2:
(5 | 4 | 3 | 4
0 | -3 | 0 | -6
0 | 0 | 1 | -3)
Divide row 2 by -3:
(5 | 4 | 3 | 4
0 | 1 | 0 | 2
0 | 0 | 1 | -3)
Subtract 4 × (row 2) from row 1:
(5 | 0 | 3 | -4
0 | 1 | 0 | 2
0 | 0 | 1 | -3)
Subtract 3 × (row 3) from row 1:
(5 | 0 | 0 | 5
0 | 1 | 0 | 2
0 | 0 | 1 | -3)
Divide row 1 by 5:
(1 | 0 | 0 | 1
0 | 1 | 0 | 2
0 | 0 | 1 | -3)
Collect results:
Answer: |
| {x = 1
y = 2
z = -3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment