I need to find the eigenvalue of the following matrix (1):
$$A = \begin{bmatrix} 2 & -1 & 0 \\ -1 & 3 & 0 \\ 0 & 0 & 7 \end{bmatrix}$$
for this I need to compute (2) $$\det{A - \lambda I} = \det\Big(\begin{bmatrix} 2-\lambda & -1 & 0 \\ -1 & 3-\lambda & 0 \\ 0 & 0 & 7-\lambda \end{bmatrix}\Big)$$ which can be developped in (3) which is the correct answer given $$(\lambda^{2} -4\lambda + 3)(7-\lambda)$$ However if I follow the algorithm to determine the determinant of a 3x3 matrix (4) $$\text{if} \quad A = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}, \quad \text{then} \quad \det(A) = a\begin{bmatrix} e & f \\ h & i \end{bmatrix} - b\begin{bmatrix} d & f \\ g & i \end{bmatrix} +c\begin{bmatrix} d & e \\ g & h \end{bmatrix}$$
What I would get is (5) $$(2-\lambda)(2-\lambda)(7-\lambda)-(-1)(-1)(7-\lambda) = (4-4\lambda + \lambda^{2})(7-\lambda) -(7-\lambda)$$
What I don't understand is how to get to the equation (3)?