changed matrix invers and cacheing functions