1

I need your help to formulate Sarrus rule for 3X3 matrix enter image description here

Thanks in advance.

  • 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
  • 2
    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
  • 1
1

Here is a proposal.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
 \edef\lstadd{{0,16,-12}}
 \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}
 {\pgfmathtruncatemacro{\mylabel}{\lstadd[\X-1]}
 \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}

enter image description here

Or

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
 \edef\lstadd{{0,16,-12}}
 \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}
 {\pgfmathtruncatemacro{\mylabel}{\lstadd[\X-1]}
 \draw[purple,-latex,thick] (mat-1-\X.north west) -- (mat-3-\Y.south east)
 node[pos=1.1] (LL-\X) {\mylabel};
 \pgfmathtruncatemacro{\mylabel}{\lstsub[\X-1]}
 \draw[purple,-latex,thick] (mat-3-\X.south west) -- (mat-1-\Y.north east)
 node[pos=1.1] (LU-\X) {\mylabel};
 }
 \draw[line width=1mm,purple,latex-,shorten >=1cm,shorten <=1cm]
 (LU-3.east) -- ++ (3,0) node[right] {Subtract these products};
 \draw[line width=1mm,purple,latex-,shorten >=1cm,shorten <=1cm]
 (LL-3.east-|LU-3.east) -- ++ (3,0) node[right] {Add these products};
\end{tikzpicture} 
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.