Question
Solve the linear system $A\mathbf{x} = \mathbf{b}$ using Python, where:
$$A = \begin{bmatrix} 2 & 1 & -1 \\ -3 & -1 & 2 \\ -2 & 1 & 2 \end{bmatrix}, \quad \mathbf{b} = \begin{bmatrix} 8 \\ -11 \\ -3 \end{bmatrix}$$
(a) Use np.linalg.solve(A, b) to find $\mathbf{x}$.
(b) Verify by computing $A \mathbf{x}$ and checking it equals $\mathbf{b}$.
(c) Also find $A^{-1}$ using np.linalg.inv(A) and solve via $\mathbf{x} = A^{-1}\mathbf{b}$. Do both methods agree?