Math & Science ⇒ Rule of Sarrus
Rule of Sarrus
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
Thanks in advance and greetings
Last edited by Math12345 on Mon Aug 08, 2011 11:42 am, edited 1 time in total.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Rule of Sarrus
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].
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
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}
[1] Rule of Sarrus — Wikipedia, the free encyclopedia
Best regards and welcome to the board
Thorsten
- Attachments
-
- Rendered output of the given code.
- Sarrus.png (8.52 KiB) Viewed 12674 times
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Rule of Sarrus
Thanks Torsten for the code.
However, when trying to run it I get the message
And then nothing more....
I am not so skilled in Latex and am not sure how to ommit it.
Best, and thanks.
However, when trying to run it I get the message
Code: Select all
l.3 \usetikzlibrary{calc,matrix}Please type another input file name:
I am not so skilled in Latex and am not sure how to ommit it.
Best, and thanks.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: Rule of Sarrus
Submit the complete log file produced by my example code by upload to the forum server.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Stefan Kottwitz
- Site Admin
- Posts: 10310
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Rule of Sarrus
You could check if you use the current version of pgf/TikZ, which is 2.10. If not, I recommend updating it.
Stefan
Stefan
LaTeX.org admin
Re: Rule of Sarrus
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.
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.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Rule of Sarrus
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.Math12345 wrote:[…] If you have an idea how to handle the installation, please advice (I use TexShop) […]
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Rule of Sarrus
Don't try to install it manually. Use the package manager of your TeX distribution. E.g., try (from a terminal):
You might also look into the possibility of a GUI frontend for your distribution; some info here for MacTeX.
Code: Select all
sudo tlmgr install pgf
Re: Rule of Sarrus
IT WORKS !!!!!!
I'd like to say THANK YOU to all wonderful contributors!

I'd like to say THANK YOU to all wonderful contributors!
