coded: use solve() for matrix inversion