Version of assignment2 to get cached inverse of matrix