# Determinant with tikz latex

I need your help to formulate Sarrus rule for 3X3 matrix

• There is already an answer of that sort here. – marmot Feb 23 at 15:42
• Thanks marmot. How to add the multiplication results (-4 0 6) at up and (0 16 -12) at down of matrix? – Said Feb 23 at 15:49
• I never teach Sarrus' rule. It is handy, if you know it, in some cases; but students tend to use it also for larger matrices. – egreg Feb 23 at 16:07
• Off-topic. Is that a 3x3 matrix? – manooooh Feb 23 at 16:33
• – Zarko Feb 23 at 16:49

Here is a proposal.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\edef\lstsub{{-4,0,6}}
\matrix[matrix of math nodes,nodes={text width=1.5em}] (mat)
{
0 & 2 & 1 & 0 & 2 \\
3 & -1 & 2 & 3 & -1\\
4 & -4 & 1 & 4 & -4\\
};
\foreach \X [evaluate=\X as \Y using {int(\X+2)}]in {1,2,3}
\draw[purple,-latex,thick] (mat-1-\X.north west) -- (mat-3-\Y.south east)
node[pos=1.1]{\mylabel};
\pgfmathtruncatemacro{\mylabel}{\lstsub[\X-1]}
\draw[purple,-latex,thick] (mat-3-\X.south west) -- (mat-1-\Y.north east)
node[pos=1.1]{\mylabel};
}
\end{tikzpicture}
\end{document}


Or

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\edef\lstsub{{-4,0,6}}
\matrix[matrix of math nodes,nodes={text width=1.5em}] (mat)
{
0 & 2 & 1 & 0 & 2 \\
3 & -1 & 2 & 3 & -1\\
4 & -4 & 1 & 4 & -4\\
};
\foreach \X [evaluate=\X as \Y using {int(\X+2)}]in {1,2,3}