I have matrix:
$$ A = \begin{bmatrix} 1 & 2 & 3 & 4 \\ 2 & 3 & 3 & 3 \\ 0 & 1 & 2 & 3 \\ 0 & 0 & 1 & 2 \end{bmatrix} $$
And I want to calculate $\det{A}$, so I have written:
$$ \begin{array}{|cccc|ccc} 1 & 2 & 3 & 4 & 1 & 2 & 3 \\ 2 & 3 & 3 & 3 & 2 & 3 & 3 \\ 0 & 1 & 2 & 3 & 0 & 1 & 2 \\ 0 & 0 & 1 & 2 & 0 & 0 & 1 \end{array} $$
From this I get that:
$$ \det{A} = (1 \cdot 3 \cdot 2 \cdot 2 + 2 \cdot 3 \cdot 3 \cdot 0 + 3 \cdot 3 \cdot 0 \cdot 0 + 4 \cdot 2 \cdot 1 \cdot 1) - (3 \cdot 3 \cdot 0 \cdot 2 + 2 \cdot 2 \cdot 3 \cdot 1 + 1 \cdot 3 \cdot 2 \cdot 0 + 4 \cdot 3 \cdot 1 \cdot 0) = (12 + 0 + 0 + 8) - (0 + 12 + 0 + 0) = 8 $$
But WolframAlpha is saying that it is equal 0. So my question is where am I wrong?
Sarrus's rule works only for $3\times 3$-determinants. So you have to find another way to compute $\det A$, for example you can apply elementary transformations not changing the determinant, that is e. g. adding the multiple of one row to another: \begin{align*} \det \begin{bmatrix} 1 & 2 & 3 & 4 \\ 2 & 3 & 3 & 3 \\ 0 & 1 & 2 & 3 \\ 0 & 0 & 1 & 2 \end{bmatrix} &= \det \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & -1 & -3 & -5 \\ 0 & 1 & 2 & 3 \\ 0 & 0 & 1 & 2 \end{bmatrix}\\ &= \det \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & -1 & -3 & -5 \\ 0 & 0 & -1 & -2 \\ 0 & 0 & 1 & 2 \end{bmatrix}\\ &= \det \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & -1 & -3 & -5 \\ 0 & 0 & -1 & -2 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{align*} To compute the determinant of a triagonal matrix, we just have to multiply the diagonal elements, so $$ \det A = \det \begin{bmatrix} 1 & 2 & 3 & 4 \\ 0 & -1 & -3 & -5 \\ 0 & 0 & -1 & -2 \\ 0 & 0 & 0 & 0 \end{bmatrix} = 1 \cdot (-1)^2 \cdot 0 = 0. $$