changed program to inverse matrix cache