Grando 1 Discussion

options(width = 100)
# This is a standard setup I include so that my working
# directory is set correctly whether I work on one of my
# windows or linux machines.
if (Sys.info()["sysname"] == "Windows") {
    setwd("~/Masters/DATA605/Week1/HW")
} else {
    setwd("~/Documents/Masters/DATA605/Week1/Discussion")
}

Explanation

For this discussion topic, I decided to manually sove a system of linear equations (TSS C21)

Original Augmented Matrix

(Aug_mtx <- matrix(c(1, 1, 4, 4, -1, 1, 3, 1, 6, -1, 2, 5, 5, 
    6, 9), nrow = 3))
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    1    4    3   -1    5
## [2,]    1   -1    1    2    6
## [3,]    4    1    6    5    9

Do nothing to row 1

Aug_mtx[1, ] <- Aug_mtx[1, ]
Aug_mtx
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    1    4    3   -1    5
## [2,]    1   -1    1    2    6
## [3,]    4    1    6    5    9

Subract row 1 from row 2

Aug_mtx[2, ] <- Aug_mtx[1, ] - Aug_mtx[2, ]
Aug_mtx
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    1    4    3   -1    5
## [2,]    0    5    2   -3   -1
## [3,]    4    1    6    5    9

Multiply row 1 by 4 and subract from row 3

Aug_mtx[3, ] <- Aug_mtx[1, ] * 4 - Aug_mtx[3, ]
Aug_mtx
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    1    4    3   -1    5
## [2,]    0    5    2   -3   -1
## [3,]    0   15    6   -9   11

Divide Row 2 by 5

Aug_mtx[2, ] <- Aug_mtx[2, ]/5
Aug_mtx
##      [,1] [,2] [,3] [,4] [,5]
## [1,]    1    4  3.0 -1.0  5.0
## [2,]    0    1  0.4 -0.6 -0.2
## [3,]    0   15  6.0 -9.0 11.0

Multiply row 2 by 15 and subract from row 3

Aug_mtx[3, ] <- Aug_mtx[2, ] * 15 - Aug_mtx[3, ]
Aug_mtx
##      [,1] [,2] [,3] [,4]  [,5]
## [1,]    1    4  3.0 -1.0   5.0
## [2,]    0    1  0.4 -0.6  -0.2
## [3,]    0    0  0.0  0.0 -14.0

Summary

We can stop here because row 3 is stating that 0 = -14, which is not possible. Therefore, this system has no solution. Technically, r = 3 because additional transformations can be performed in order to get the value in [3,5] to a value of 1 with the values in [1,5] and [2, 5] transformed to zeros. n = 4 because there are four columns/variables being used as arguments.