Module 5: Doing Math

For this assingment we are tasked with solving the inverse of a matrix using the given values. As the hint stated, we can start with the following for step 1:

Step 1: In this step, we are creating the matrices.
A <- matrix(1:100, nrow=10)  
B <- matrix(1:1000, nrow=10)

Step 2: After creating the matrices, we can use the dim function to check their shape.
> dim(A)
[1] 10 10
> dim(B)
[1]  10 100

After running this function, we can see that matrix A is a square 10x10 and matrix B is not becasue its 10x100.

Step 3: Next, we can use the det() to find the determinant of matrix A 
> det(A)
[1] 0

After running the det() we can see that the result is 0 which means the matrix is singular which has no inverse. 

Step 4: I attempted to double check and try finding the inverse using the solve() function
> solve(A)
Error in solve.default(A) : 
  Lapack routine dgesv: system is exactly singular: U[6,6] = 0

Step 5: I also attempted to double check matrix B even though is not a square using the det(), and solve() function. After running the code we get errors becasue matrix B is not a square.  



After attempmting to find the inverse for matrix A and B, we came to the conclusion that they do not have an inverse. Matrix A does not have an inverse becasue its determinat is 0, which makes it a singular thus making it not have an inverse. Matrix B is not a square which is the reason it does not have an inerse. This assingment helped me get more used to working with matrices and how to find the inverse and things to look out for when attempting to find the inverse of a matrix.  

Comments

Popular posts from this blog

Evaluating the function myMean in RStudio

Module #8 Assignment