Section 1.3: Solutions of Linear Systems–Matrix Algebra:

# of Solutions of a Linear System:

  • Consistent systems:

    • Have at least one solution
      • Possible outcomes of consistent systems:
        • Inf. Sol (unknown >= eq.)
        • 1 Sol
  • Inconsistent systems:

    • Don’t have solutions (e.g. 0 1)
  • Free Variable:

    • Variables that are free to range (e.g. x_n = λ , λ ∈ ℝ)
    • The variables which range for the inf. sol
  • Rankof a Matrix:

    • The number of non-free-variables or, number of leading-variables (i.e. diag() 1’s = some constant. How many linearly independent col there are)
    • No Solution:
      • If the augmented matrix has a row where all entries except the last one are zero, but the last entry is non-zero (e.g., [ 0    0    0    1]), the system is inconsistent.
    • Unique Solution:
      • If the rank of the coefficient matrix equals the number of variables, the system has a unique solution.
    • Infinitely Many Solutions:
      • If the rank of the coefficient matrix is less than the number of variables, and the system is consistent, there are infinitely many solutions.
  • VECTOR %*% VECTOR:

    • The vector must satisfy this condition:

      • ncol(VECTOR_1) == nrow(VECTOR_2)

      • COMPUTATIONALLY:

        • multiply each component with the corresponding index then sum up all those values
  • MATRIX %*% VECTOR:

    • The vector must satisfy this condition:

      • length(VECTOR) == ncol(MATRIX)

      • COMPUTATIONALLY:

        • Its basically the dot product for each row
      • Geometrically, Ax is some linear-transformation of the vector x due to A

      • MATRIX %*% VECTOR in terms of COL OF A:

        • Ax where x is unknown, is:

          • Ax = (x_1 * v_1) + (x_2* v_2) + … + (x_col* v_col)

            • COMPUTATIONALLY:

              • vectors times each col of matrix summed
  • Linear Combinations:

    • A vector 𝑏 is a linear combination of the columns of a matrix 𝐴 (or individual vectors = col) summed.

    • Meaning for every augmented matrix (system of linear equations), there exists the matrix form which separates the matrix and vector of unknowns equal to a matrix of the solutions of each linear equation.

HOMEWORK (1.3 : 1, 3, 4, 13, 14, 20)

Q1:

# HOW MANY SOLUTIONS DOES EACH SYSTEM HAVE? 
#1a: NO SOLUTION
#1b: 1 SOLUTION
#1b: INF SOLUTIONS

Q2:

# Rank(A) == ? 
mat <- rbind(1:3, c(0,1,2), c(0,0,1))
mat #rank must be 3 or less
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    0    1    2
## [3,]    0    0    1
mat[1, ] <- mat[1, ] - (2 * mat[2,])
mat[1, ] <- mat[1, ] + mat[3, ]
mat[2, ] <- mat[2, ] - (2 *  mat[3, ])
cat("rref: ")
## rref:
mat
##      [,1] [,2] [,3]
## [1,]    1    0    0
## [2,]    0    1    0
## [3,]    0    0    1
#Notice 3 1's, Therefore, rank == 3
rank <- qr(mat)$rank
cat("rank: ", rank)
## rank:  3

Q3:

# Rank(A) == ? 
mat <- matrix(rep(1,9), nrow = 3)
mat
##      [,1] [,2] [,3]
## [1,]    1    1    1
## [2,]    1    1    1
## [3,]    1    1    1
mat[1, ] <- mat[1, ] - mat[2, ] 
mat[2, ] <- mat[2, ] - mat[3, ] 
mat[1, ] <- mat[3, ] 
mat[3, ] <- mat[2, ]
cat("\n rref: ")
## 
##  rref:
mat
##      [,1] [,2] [,3]
## [1,]    1    1    1
## [2,]    0    0    0
## [3,]    0    0    0
rank <- qr(mat)$rank
cat("rank: ", rank)
## rank:  1

Q4:

# Rank(A) == ? 
mat <- matrix(1:9, nrow = 3, byrow = FALSE)
mat
##      [,1] [,2] [,3]
## [1,]    1    4    7
## [2,]    2    5    8
## [3,]    3    6    9
mat[2, ] <- mat[2, ] - (2 * mat[1, ])
mat[3, ] <- mat[3, ] - (3 * mat[1, ])
mat[2, ] <- mat[2, ] / -3
mat[3, ] <- mat[3, ] / -6
mat[1, ] <- mat[1, ] - (4 * mat[2, ])
mat[3, ] <- mat[3, ] - mat[2, ]
cat("\n rref: ")
## 
##  rref:
mat # rank == 2
##      [,1] [,2] [,3]
## [1,]    1    0   -1
## [2,]    0    1    2
## [3,]    0    0    0
rank <- qr(mat)$rank
cat("rank: ", rank)
## rank:  2

Q13:

# Matrix vector multiplication: 
mat <- cbind(c(1,2), c(2,4))
vec <- c(7,11)

identical(mat %*% vec, as.matrix(c(7 + 22, 14 + (11 * 4))))
## [1] TRUE

Extra Practice:

1.3, Q5:

\[ \text{Augmented matrix form:} \quad \left[\begin{array}{ccc} 1 & 2 & 7 \\ 3 & 1 & 11 \end{array}\right] \]

\[ \text{vector form:} \quad \begin{bmatrix} 1 \\ 3 \end{bmatrix} x_1 + \begin{bmatrix} 2 \\ 1 \end{bmatrix} x_2 = \begin{bmatrix} 7 \\ 11 \end{bmatrix} \]

1.3, Q14:

# Matrix vector multiplication: 
mat <- rbind(c(1,2,3), c(2,3,4))
vec <- c(-1,2,1)


identical(mat %*% vec,rbind(c(-1 + 4 + 3), c(-2 + 6 + 4))) 
## [1] TRUE