solve the system of equations and convert to a matrix
\(x_1 + 2x_2 + 8x_3 - 7x_4 = -2\)
\(3x_1 + 2x_2 + 12x_3 - 5x_4 = 6\)
\(-x_1 + x_2 + x_3 - 5x_4 = -10\)
using the matlib package we can show each step as well:
A <-matrix(c(1,3,-1,2,2,1,8,12,1,-7,-5,-5), nrow=3,ncol=4)
b <- c(-2,6,10)
echelon(A, b, verbose=TRUE, fractions=TRUE)
##
## Initial matrix:
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 2 8 -7 -2
## [2,] 3 2 12 -5 6
## [3,] -1 1 1 -5 10
##
## row: 1
##
## exchange rows 1 and 2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 3 2 12 -5 6
## [2,] 1 2 8 -7 -2
## [3,] -1 1 1 -5 10
##
## multiply row 1 by 1/3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 2/3 4 -5/3 2
## [2,] 1 2 8 -7 -2
## [3,] -1 1 1 -5 10
##
## subtract row 1 from row 2
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 2/3 4 -5/3 2
## [2,] 0 4/3 4 -16/3 -4
## [3,] -1 1 1 -5 10
##
## multiply row 1 by 1 and add to row 3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 2/3 4 -5/3 2
## [2,] 0 4/3 4 -16/3 -4
## [3,] 0 5/3 5 -20/3 12
##
## row: 2
##
## exchange rows 2 and 3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 2/3 4 -5/3 2
## [2,] 0 5/3 5 -20/3 12
## [3,] 0 4/3 4 -16/3 -4
##
## multiply row 2 by 3/5
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 2/3 4 -5/3 2
## [2,] 0 1 3 -4 36/5
## [3,] 0 4/3 4 -16/3 -4
##
## multiply row 2 by 2/3 and subtract from row 1
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 2 1 -14/5
## [2,] 0 1 3 -4 36/5
## [3,] 0 4/3 4 -16/3 -4
##
## multiply row 2 by 4/3 and subtract from row 3
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 2 1 -14/5
## [2,] 0 1 3 -4 36/5
## [3,] 0 0 0 0 -68/5
##
## row: 3
Row three represents 0 = -68/5 which is never true, thus there is no solution.
\(\emptyset = \{ \}\)