Math & ScienceRule of Sarrus

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Math12345
Posts: 8
Joined: Sun Aug 07, 2011 7:20 am

Rule of Sarrus

Post by Math12345 »

I have a problem! I need to write the Sarrus rule for 3x3 determinant, indicating additional two columns (to the right of the matrix) and diagonal lines for positive and negative products. How should I proceed? any idea?
Thanks in advance and greetings
Last edited by Math12345 on Mon Aug 08, 2011 11:42 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Rule of Sarrus

Post by localghost »

A usual environment like array won't help you on here. The pgf/tikZ package can help you to construct a matrix with the necessary properties and the capability to connect the matrix elements with lines (or arrows). Let's take the example from the Wikipedia article [1].

Code: Select all

Code, edit and compile here:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}
\begin{document}
\begin{tikzpicture}
\matrix [%
matrix of math nodes,
column sep=1em,
row sep=1em
] (sarrus) {%
a_{11} & a_{12} & a_{13} & a_{11} & a_{12} \\
a_{21} & a_{22} & a_{23} & a_{21} & a_{22} \\
a_{31} & a_{32} & a_{33} & a_{31} & a_{32} \\
};
\path ($(sarrus-1-3.north east)+(0.5em,0)$) edge[dotted] ($(sarrus-3-3.south east)+(0.5em,0)$)
(sarrus-1-1) edge (sarrus-2-2)
(sarrus-2-2) edge (sarrus-3-3)
(sarrus-1-2) edge (sarrus-2-3)
(sarrus-2-3) edge (sarrus-3-4)
(sarrus-1-3) edge (sarrus-2-4)
(sarrus-2-4) edge (sarrus-3-5)
(sarrus-3-1) edge[dashed] (sarrus-2-2)
(sarrus-2-2) edge[dashed] (sarrus-1-3)
(sarrus-3-2) edge[dashed] (sarrus-2-3)
(sarrus-2-3) edge[dashed] (sarrus-1-4)
(sarrus-3-3) edge[dashed] (sarrus-2-4)
(sarrus-2-4) edge[dashed] (sarrus-1-5);
\foreach \c in {1,2,3} {\node[anchor=south] at (sarrus-1-\c.north) {$+$};};
\foreach \c in {1,2,3} {\node[anchor=north] at (sarrus-3-\c.south) {$-$};};
\end{tikzpicture}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
For further adjustments and modifications take a look at the very comprehensive package manual.

[1] Rule of Sarrus — Wikipedia, the free encyclopedia


Best regards and welcome to the board
Thorsten
Attachments
Rendered output of the given code.
Rendered output of the given code.
Sarrus.png (8.52 KiB) Viewed 12674 times
Math12345
Posts: 8
Joined: Sun Aug 07, 2011 7:20 am

Rule of Sarrus

Post by Math12345 »

Thanks Torsten for the code.
However, when trying to run it I get the message

Code: Select all

l.3 \usetikzlibrary{calc,matrix}
Please type another input file name:
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
And then nothing more....
I am not so skilled in Latex and am not sure how to ommit it.

Best, and thanks.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Rule of Sarrus

Post by localghost »

Submit the complete log file produced by my example code by upload to the forum server.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10310
Joined: Mon Mar 10, 2008 9:44 pm

Re: Rule of Sarrus

Post by Stefan Kottwitz »

You could check if you use the current version of pgf/TikZ, which is 2.10. If not, I recommend updating it.

Stefan
LaTeX.org admin
Math12345
Posts: 8
Joined: Sun Aug 07, 2011 7:20 am

Re: Rule of Sarrus

Post by Math12345 »

Thanks Torsten and Stefan,
I noticed that I didn't have PGF/TikZ installed on my Mac at all. I downloaded version 2.10 but here is no information what so ever how to install it or were to put the files. As soon as I solve this problem I will check the code from Thorsten. If you have an idea how to handle the installation, please advice (I use TexShop)

All the best.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Rule of Sarrus

Post by localghost »

Math12345 wrote:[…] If you have an idea how to handle the installation, please advice (I use TexShop) […]
I guess that the TeX Live Utility will be very helpful in this regard. I don't know how to get it. Perhaps it is already installed with MacTeX.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Rule of Sarrus

Post by frabjous »

Don't try to install it manually. Use the package manager of your TeX distribution. E.g., try (from a terminal):

Code: Select all

sudo tlmgr install pgf
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
You might also look into the possibility of a GUI frontend for your distribution; some info here for MacTeX.
Math12345
Posts: 8
Joined: Sun Aug 07, 2011 7:20 am

Re: Rule of Sarrus

Post by Math12345 »

IT WORKS !!!!!!
I'd like to say THANK YOU to all wonderful contributors!
:)
Post Reply