I am a beginner in R and I was doing a programming assignment from Coursera. The question involves caching of Inverse of matrix in R. I know it has been been asked many times but I am still not able to understand those solutions. Can someone dry run it from step 1 with an input and explain each and every step for better understanding? It would be highly appreciated.Basically I am more confused with the set functions and it's parameters. what would be value of y?
makeCacheMatrix <- function(x = matrix()) {
j <- NULL
set <- function(y){
x <<- y
j <<- NULL
}
get <- function()x
setInverse <- function(inverse) j <<- inverse
getInverse <- function() j
list(set = set, get = get,
setInverse = setInverse,
getInverse = getInverse)
}
## Write a short comment describing this function
cacheSolve <- function(x, ...) {
## Return a matrix that is the inverse of 'x'
j <- x$getInverse()
if(!is.null(j)){
message("getting cached data")
return(j)
}
mat <- x$get()
j <- solve(mat,...)
x$setInverse(j)
j
}