Find all solutions to the system of linear equations: C18, Page 42 \[x_{1}+2x_{2}-4x_{3}-x_{4} = 32\] \[x_{1}+3x_{2}-7x_{3}-x_{5} = 33\] \[x_{1}+2x_{3}-2x_{4}+3x_{5} = 22\]
library(matlib)
A <- matrix(c(1, 1, 1, 2, 3, 0, -4, -7, 2, -1, 0, -2, 0, -1, 3), 3, 5)
b <- c(32, 33, 22)
showEqn(A, b) # show Matrices (A, b) as Linear Equations
## 1*x1 + 2*x2 - 4*x3 - 1*x4 + 0*x5 = 32
## 1*x1 + 3*x2 - 7*x3 + 0*x4 - 1*x5 = 33
## 1*x1 + 0*x2 + 2*x3 - 2*x4 + 3*x5 = 22
gaussianElimination(A, b) # row reduction used for solving systems of linear equations
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] 1 0 2 0 5 6
## [2,] 0 1 -3 0 -2 9
## [3,] 0 0 0 1 1 -8
Solve(A, b) # solve and Display Solutions for Systems of Linear Simultaneous Equations
## x1 + 2*x3 + 5*x5 = 6
## x2 - 3*x3 - 2*x5 = 9
## x4 + x5 = -8