If \(A = \begin{bmatrix} 3 & 1 \\ -1 & 2 \end{bmatrix}\), show that \(A^2 - 5A + 7I = O\). Hence find \(A^{-1}\).