calculate the inverse of Matrix using Cache method