Math & Science ⇒ Display the determinant of a matrix with the rule of Sarrus.
Display the determinant of a matrix with the rule of Sarrus.
I would like to realize a LaTex page with the calculation of the determinant of a matrix with the rule of Sarrus.
I found this tutorial.
https://tex.stackovernet.com/fr/q/103579
It does not work, I get lots of mistakes.
On my computer I have MikeTex.
See you soon
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10330
- Joined: Mon Mar 10, 2008 9:44 pm
Display the determinant of a matrix with the rule of Sarrus.
welcome to the forum!
Which code exactly did you try?vinc wrote:It does not work
What mistakes? Can you tell us error messages?vinc wrote:I get lots of mistakes.
Stefan
Display the determinant of a matrix with the rule of Sarrus.
here is the code
\usepackage[frenchb]{babel}
\usepackage{array, mathtools}
\usepackage{amsmath,amsfonts,amssymb}
\documentclass[11pt,a4paper]{scrbook}
$det(B)=
\begin{array}{|ccc|cc|}
1 & 1 & 0 & 1 & 1\\
-1 & 2 & -1 & -1 & 2\\
-1 &-1 & 3 & -1 & -1\\
\end{array}$
\end{document}
here is the image prints screen.
I can not select the lines. Method of the rule of sarrus.
A simple selection line would suffice.
Thanks for your help.
See you soon
- Stefan Kottwitz
- Site Admin
- Posts: 10330
- Joined: Mon Mar 10, 2008 9:44 pm
Display the determinant of a matrix with the rule of Sarrus.
Code: Select all
\documentclass{article}\usepackage{tikz}\usetikzlibrary{matrix,calc}\begin{document}$\det(B) = $\begin{tikzpicture}[baseline = (m-2-2.base) ]\matrix (m) [matrix of math nodes,row sep = .5em, column sep = .5em,every node/.style = {anchor = base east}] {\ 1 & 1 & 0 & \ 1 & 1 \\-1 & 2 & -1 & -1 & 2 \\-1 &-1 & 3 & -1 & -1 \\};\draw(m-1-1.north west) -- ++(0em,-5em)(m-1-4.north west) -- ++(0em,-5em)(m-1-5.north east) -- ++(0em,-5em);\draw [color = red](m-1-1.south east) -- (m-3-3.north west)(m-1-2.south east) -- (m-3-4.north west)(m-1-3.south east) -- (m-3-5.north west);\draw [color = blue](m-1-3.south west) -- (m-3-1.north east)(m-1-4.south west) -- (m-3-2.north east)(m-1-5.south west) -- (m-3-3.north east);\end{tikzpicture}\end{document}
Display the determinant of a matrix with the rule of Sarrus.
It did not work, it looks like it is missing a package.
Here is a screenshot of the error.

Here is the code.
\documentclass[11pt,a4paper]{scrbook}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage[a4paper,pdftex,dvips]{geometry}
\usepackage[frenchb]{babel}
\usepackage{array, mathtools}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{tikz}
\usetikzlibrary{calc,matrix}
\usepackage[font={small,it}]{floatrow}
\usepackage{setspace}
\usepackage{systeme}
\usetikzlibrary{matrix,calc}
\begin{document}
$det(B)= $
\begin{tikzpicture}[baseline = (m-2-2.base) ]
matrix (m) [matrix of math nodes,
row sep = .5em, column sep = .5em,
every node/.style = {anchor = base east}] {
1&1&0&1&1 \\
-1&2&-1&-1&2 \\
-1&-1&3&-1&-1 \\
};
(m-1-1.north west) -- ++(0em,-5em)
(m-1-4.north west) -- ++(0em,-5em)
(m-1-5.north east) -- ++(0em,-5em);
draw [color = red]
(m-1-1.south east) -- (m-3-3.north west)
(m-1-2.south east) -- (m-3-4.north west)
(m-1-3.south east) -- (m-3-5.north west);
\draw [color = blue]
(m-1-3.south west) -- (m-3-1.north east)
(m-1-4.south west) -- (m-3-2.north east)
(m-1-5.south west) -- (m-3-3.north east);
\end{tikzpicture}
\end{document}
I took out \ he rejected them
See you soon
- Stefan Kottwitz
- Site Admin
- Posts: 10330
- Joined: Mon Mar 10, 2008 9:44 pm
Display the determinant of a matrix with the rule of Sarrus.
\matrix
instead of just matrix
.And remove the unnecessary empty lines in the code. Empty lines are paragraph breaks, and there should not be a paragraph break within a list of options or in the middle of a matrix.
Btw. it's nice that you provide screenshots, but can you please post them directly here? You can post images as attachments, the "Attachments" link is below the text edit field, when editing a post. See your original post above, I did it there for you, so you can see the image inline. And also btw. the "LaTeX" button is more for inline LaTeX commands, for longer code there is the "Code" button, for the editor. It looks nicer, as in my post above. Just to let you know.
Thanks!
Stefan
Display the determinant of a matrix with the rule of Sarrus.
There is one more problem.
Here is the code below.
Code: Select all
$det(B)= $\begin{tikzpicture}[baseline = (m-2-2.base) ]\matrix (m) [matrix of math nodes,row sep = .5em, column sep = .5em,every node/.style = {anchor = base east}] {1&1&0&1&1 \\-1&2&-1&-1&2 \\-1&-1&3&-1&-1 \\};(m-1-1.north west) -- ++(0em,-5em)(m-1-4.north west) -- ++(0em,-5em); (m-1-5.north east) -- ++(0em,-5em)draw [color = red](m-1-1.south east) -- (m-3-3.north west)(m-1-2.south east) -- (m-3-4.north west)(m-1-3.south east) -- (m-3-5.north west);\draw [color = blue](m-1-3.south west) -- (m-3-1.north east)(m-1-4.south west) -- (m-3-2.north east)(m-1-5.south west) -- (m-3-3.north east);\end{tikzpicture}
! Missing } inserted.<inserted text>}
! Misplaced \cr.<inserted text> \cr \end{tikzpicture}
See you soon
- Stefan Kottwitz
- Site Admin
- Posts: 10330
- Joined: Mon Mar 10, 2008 9:44 pm
Display the determinant of a matrix with the rule of Sarrus.
Stefan
Display the determinant of a matrix with the rule of Sarrus.
I almost arrived there, it misses the lines of the table.
Code: Select all
$det(B)=$\begin{tikzpicture}[baseline = (m-2-2.base)]\matrix (m) [matrix of math nodes,row sep = .5em, column sep = .5em,every node/.style = {anchor = base east}] {\ 1 & 1 & 0 & \ 1 & 1 \\-1 & 2 &-1 &- 1 & 2 \\-1 &-1 & 3 & 1 &-1 \\};(m-1-1.north west) -- ++(0em,-5em)(m-1-4.north west) -- ++(0em,-5em)(m-1-5.north east) -- ++(0em,-5em);\draw [color = red](m-1-1.south east) -- (m-3-3.north west)(m-1-2.south east) -- (m-3-4.north west)(m-1-3.south east) -- (m-3-5.north west);\draw [color = blue](m-1-3.south west) -- (m-3-1.north east)(m-1-4.south west) -- (m-3-2.north east)(m-1-5.south west) -- (m-3-3.north east);\end{tikzpicture}
Thank you !
See you soon
- Stefan Kottwitz
- Site Admin
- Posts: 10330
- Joined: Mon Mar 10, 2008 9:44 pm
Display the determinant of a matrix with the rule of Sarrus.
Stefan