\(~\)
# Load library
#install.packages("pracma")
library(pracma)
\(~\)
\(~\)
\(~\)
\(~\)
# Create the matrices
<- matrix(c(1, 1, 0, 1, 2, 0 , 1, 1, 0, 3, 0, 2, 2, 1, 2, 0), nrow = 4, ncol = 4)
W
<- matrix(c(2, 1, 2, 1), nrow = 4, ncol = 1) b
\(~\)
# Bind the matrices together to create an argumented matrix
<- cbind(W, b)
data data
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 2 0 2 2
## [2,] 1 0 3 1 1
## [3,] 0 1 0 2 2
## [4,] 1 1 2 0 1
\(~\)
# Using reduced row echelon form using Gauss-Jordan elimination
rref(data)
## [,1] [,2] [,3] [,4] [,5]
## [1,] 1 0 0 0 -1.0
## [2,] 0 1 0 0 1.0
## [3,] 0 0 1 0 0.5
## [4,] 0 0 0 1 0.5
\(~\)
\(~\)