MSDS Spring 2018

DATA 605 FUndamental of Computational Mathematics

Jiadi Li

Week 2 Discussion: Pg.354 Determinant M11

M11: Find a value of k so that the matrix A has det(A)=0.

1.Creatematrix A

k <- 0
A <- matrix(c(1,2,2,2,0,3,1,1,k),nrow = 3)

2.Use row 3 to compute the determinant:

#a <- matrix(c(1,2,2,0),nrow = 2)
#b <- matrix(c(2,2,0,3),nrow = 2)
#c <- matrix(c(1,2,2,3),nrow = 2)
a <- A[1:2,2:3]
b1 <- A[1:2,1]
b2 <- A[1:2,3]
b <- cbind(b1,b2)
c <- A[1:2,1:2]
a
##      [,1] [,2]
## [1,]    2    1
## [2,]    0    1
b
##      b1 b2
## [1,]  1  1
## [2,]  2  1
c
##      [,1] [,2]
## [1,]    1    2
## [2,]    2    0
  1. Compute the determinants for each matrix and verify with built-in function
#det(a): ad-bc
2*1-0*1
## [1] 2
det(a)
## [1] 2
#det(b)
1*1-2*1
## [1] -1
det(b)
## [1] -1
#det(c)
1*0-2*2
## [1] -4
det(c)
## [1] -4
  1. Determine k det(A) = 2det(a) - 3det(b) + k*det(c) = 0 k = [det(A) - det(a) + det(b)]/det(c)
k <- (0-2*det(a)+3*det(b))/det(c)#k=7-4k
k
## [1] 1.75
  1. Verify the value of k satisfy det(A) = 0 by computing the determinant of A
A <- matrix(c(1,2,2,2,0,3,1,1,k),nrow = 3)
A
##      [,1] [,2] [,3]
## [1,]    1    2 1.00
## [2,]    2    0 1.00
## [3,]    2    3 1.75
det(A)
## [1] 0
  • when k=1.75 and only when k=1.75, det(A) = 0.