created both methods to cache matrix inversion
updated comments