use cache in inversion matrix