knitr::include_graphics('3-1.png')
# Reading library
library(matrixcalc)
# Feed the data into R
A <- matrix(c(1,-1,0,5,2,0,1,4,3,1,-2,-2,4,3,1,-3), nrow=4, ncol=4)
A
## [,1] [,2] [,3] [,4]
## [1,] 1 2 3 4
## [2,] -1 0 1 3
## [3,] 0 1 -2 1
## [4,] 5 4 -2 -3
# Calculating rank of matrix with R
matrix.rank(A)
## [1] 4
Maximum rank for m x n where m > n is n whereas minimum rank for m x n matrix where m > n and having the assumption of non-zero is 1.
B <- matrix(c(1,3,2,2,6,4,1,3,2), nrow=3, ncol=3)
B
## [,1] [,2] [,3]
## [1,] 1 2 1
## [2,] 3 6 3
## [3,] 2 4 2
#Rank for matrix B is:
matrix.rank(B)
## [1] 1
knitr::include_graphics('3-2.png')
# Creating matrix with the given numbers
A2 <- matrix(c(1,0,0,2,4,0,3,5,6),nrow=3, ncol=3)
A2
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 0 4 5
## [3,] 0 0 6
# Using eigen function, we will print eigen and vector
result <- eigen(A2)
# Now, we will print out eigen and vectors from the saved value 'result'
result$values
## [1] 6 4 1
result$vectors
## [,1] [,2] [,3]
## [1,] 0.5108407 0.5547002 1
## [2,] 0.7981886 0.8320503 0
## [3,] 0.3192754 0.0000000 0