functions to compute cached inverse of matrix, prog assign 2: rprog005