Suppose that S = {[2, -1, 3, 4], [3, 2, -2, 1]}. Let W = S and let x = [5, 8, -12, -5]. Is x an element of W?
Let’s calculate this out by hand. We will create an augmented matrix and reduce this matrix into its reduced row echelon form.
print(matrix(c(2, -1, 3, 4, 3, 2, -2, 1, 5, 8, -12, -5), ncol = 3))
## [,1] [,2] [,3]
## [1,] 2 3 5
## [2,] -1 2 8
## [3,] 3 -2 -12
## [4,] 4 1 -5
Via the Definition EO: Equations Operations
Let’s go ahead and use the 3rd part of the Definition EO to initiate the reduction. We’ll go ahead and perform three steps in one shot.
print(matrix(c(0, -1, 0, 0, 7, 2, 4, 9, 21, 8, 12, 27), ncol = 3))
## [,1] [,2] [,3]
## [1,] 0 7 21
## [2,] -1 2 8
## [3,] 0 4 12
## [4,] 0 9 27
Using Part 2 of EO:
print(matrix(c(0, -1, 0, 0, 1, 2, 1, 1, 3, 8, 3, 3), ncol = 3))
## [,1] [,2] [,3]
## [1,] 0 1 3
## [2,] -1 2 8
## [3,] 0 1 3
## [4,] 0 1 3
Again, using Part 3 of EO and subsequently rearranging the rows vis Part 1 of EO.
print(matrix(c(1, 0, 0, 0, -2, 1, 0, 0, -8, 3, 0, 0), ncol = 3))
## [,1] [,2] [,3]
## [1,] 1 -2 -8
## [2,] 0 1 3
## [3,] 0 0 0
## [4,] 0 0 0
Part 3 of EO:
print(matrix(c(1, 0, 0, 0, 0, 1, 0, 0, -2, 3, 0, 0), ncol = 3))
## [,1] [,2] [,3]
## [1,] 1 0 -2
## [2,] 0 1 3
## [3,] 0 0 0
## [4,] 0 0 0
Now that we had completely reduced the matrix to its reduced row echelon form, we can easily obtain the scalar values of x1 and x2. In this case, x1 = -2, and x2 = 3. We can confirm this by using R’s lsfit() function.
# Define x and S
# Reference for the functions used.
# https://stat.ethz.ch/R-manual/R-devel/library/stats/html/lsfit.html
x <- c(5, 8, -12, -5)
S <- matrix(c(2, -1, 3, 4, 3, 2, -2, 1), ncol = 2)
# Search for scalars that would determine if x is an element of W
ans <- lsfit(S, x)
print(ans$coefficients)
## Intercept X1 X2
## 1.776357e-15 -2.000000e+00 3.000000e+00
The answer via R is x1 = -2 and x2 = 3.
This confirms that x is indeed an element of W.