Implemented functions to create inverse of matrix.  The matrix is cached and stored in an external scope.