Inverse of matrix by caching

With comments