Module #5 Doing Math

The purpose of this assignment is to learn more about how matrices function by finding the inverse and determinant of two matrices, A and B. We begin this process by creating the two matrices, A uses numbers 1 through 100 and reshapes it into a 10x10 matrix. B uses numbers 1 through 1000 and shapes it into 10x100 matrix. 

Calculating the inverse of the matrices is quite simple in R and can be done with the solve() function. However, this does not guarantee that every matrix in R has an inverse which is immediately apparent when attempting to use this function on matrix A. 



Upon running this function in R we are met with an error indicating there is no inverse. This is supported by running another function, the det() function which is used to find the determinant of A. Matrices cannot have an inverse if the determinant is zero. 



Moving on to matrix B, we are met with another error running the solve() function on it. 


This error indicates that matrix B is not square which is required in R to calculate the inverse. While there are methods for calculating the inverse of a non-square matrix it may not give the answer that we are expecting. We also get a similar error when attempting to find the determinant of the B, citing B not being a square matrix as the issue. 


My completed R code



Comments