Add matrix with caching ability and method to solve inverse