% Mnemonic rule for matrix determinant 
% Author: Alain Matthes
\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usepackage{tikz}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%


\usetikzlibrary{matrix}
\usepackage{fullpage,amsmath}
\begin{document}
  Pierre Frédéric Sarrus (10 March 1798, Saint-Affrique - 20 November 1861) was a French mathematician.
  Sarrus was professor at the University of Strasbourg, France (1826-1856) and member of the Academy of Sciences in Paris (1842). He  discovered a mnemonic rule for solving the determinant of a 3-by-3 matrix, named Sarrus' scheme, which provides an easy-to-remember method of working out the determinant of a 3-by-3 matrix (as illustrated below)

\tikzset{node style ge/.style={circle}}
det(M)=
$\left|
\begin{matrix}
    a_{11} & a_{12} & a_{13}  \\
    a_{21} & a_{22} & a_{23}  \\
    a_{31} & a_{32} & a_{33}  \\
\end{matrix}%
\right|$
=$\big(a_{11}a_{22}a_{33}+a_{21}a_{32}a_{13}+a_{31}a_{12}a_{33}\big)-\big(a_{13}a_{22}a_{31}+a_{23}a_{32}a_{11}+a_{33}a_{12}a_{31}\big)$



\begin{tikzpicture}[baseline=(A.center)]
  \tikzset{BarreStyle/.style =   {opacity=.4,line width=4 mm,line cap=round,color=#1}}
    \tikzset{SignePlus/.style =   {above left,,opacity=1,circle,fill=#1!50}}
    \tikzset{SigneMoins/.style =   {below left,,opacity=1,circle,fill=#1!50}}
% les matrices
\matrix (A) [matrix of math nodes, nodes = {node style ge},,column sep=0 mm] 
{ a_{11} & a_{12} & a_{13}  \\
  a_{21} & a_{22} & a_{23}  \\
  a_{31} & a_{32} & a_{33}  \\
  a_{11} & a_{12} & a_{13} \\
  a_{21} & a_{22} & a_{13}\\
};

 \draw [BarreStyle=blue] (A-1-1.north west) node[SignePlus=blue] {$+$} to (A-3-3.south east) ;
 \draw [BarreStyle=blue] (A-2-1.north west) node[SignePlus=blue] {$+$} to (A-4-3.south east) ;
 \draw [BarreStyle=blue] (A-3-1.north west) node[SignePlus=blue] {$+$} to (A-5-3.south east) ;
 \draw [BarreStyle=red]  (A-3-1.south west) node[SigneMoins=red] {$-$} to (A-1-3.north east);
 \draw [BarreStyle=red]  (A-4-1.south west) node[SigneMoins=red] {$-$} to (A-2-3.north east);
 \draw [BarreStyle=red]  (A-5-1.south west) node[SigneMoins=red] {$-$} to (A-3-3.north east);
\end{tikzpicture}


\end{document}