# Cross product using the checker method

I saw an old question on how to obtain arrows inside of matrices using arrows. And thanks to Altermundus I was able to hack together the file below:

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{fullpage,amsmath}
\begin{document}

\begin{align*}
\begin{array}{|rrr|rr}
i &  j & k & i &  j\\
3 & -2 & 2 & 3 & -2\\
3 &  2 & 1 & 3 &  2
\end{array}
\end{align*}

\begin{figure}[!htbp]
\tikzset{node style ge/.style={circle}}
\centering
\begin{tikzpicture}[baseline=(A.center)]
\tikzset{BarreStyle/.style =   {opacity=.4,line width=3 mm,line cap=round,color=#1}}
\tikzset{SignePlus/.style  =   {above left,,opacity=0.8,circle,fill=#1!50}}
\tikzset{SigneMoins/.style =   {above right,,opacity=0.8,circle,fill=#1!50}}
% les matrices
\matrix (A) [matrix of math nodes, nodes = {node style ge},,column sep=0 mm]
{      i &  j & k & i &  j \\
3 & -2 & 2 & 3 & -2 \\
3 &  2 & 1 & 3 &  2 \\
};

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

\end{document}


Now I am having a few bunks to iron out, and some help would be much obliged =)

(\p1 |- #1.north) -- (\p1 |- #1.south);
\draw (#1.north west) -- (#1.south west);
\end{pgfonlayer}
}

\begin{document}
\begin{tikzpicture}
\matrix (A)
[matrix of math nodes,inner sep=0pt,
nodes={minimum size=2.5em,inner sep=0pt}]
{
i  & j  & k  & i & j  \\
3  & -2 & 2  & 3 & -2 \\
61 & 2  & 61 & 3 & 2  \\
};
\checkers{A}
\end{tikzpicture}

{\footnotesize%
\begin{tikzpicture}
\matrix (B)
[matrix of math nodes,inner sep=0pt,
nodes={minimum size=2.5em,inner sep=0pt}]
{
i  & j   & k  & i  & j  \\
13 & -2  & 125 & 13 & -2 \\
3  & -18 & 1  & 3  & 2  \\
};
\checkers{B}
\end{tikzpicture}%
}
\end{document}


Here is results with different font sizes:

-
Nice solution! Unfortunately I'm out of votes for today. –  Gonzalo Medina Jun 12 '12 at 20:17