Search In This Website

Rabu, 30 April 2025

Determinant Matrix In Latex

1. Type this following latex code for drawing Determinant Matrix in Latex editor:
% !TEX TS-program=pdflatex 
% pdflatex DeterminantMatrix.tex
\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{tgbonum}
\usepackage{tikz}
\usetikzlibrary{matrix, arrows.meta}
\usetikzlibrary{decorations.text}
\usetikzlibrary{scopes}

\usepackage[active,tightpage,pdftex]{preview}
\PreviewEnvironment[{[]}]{tikzpicture}
\setlength\PreviewBorder{0.25pt}

\begin{document}
\boldmath
\tikzset{node style ge/.style={text width=2em, text centered, text depth=1.5ex, text height=3ex, inner sep=0},
    myarrow/.style={->, shorten <=2mm, shorten >=1mm}
    }

\begin{tikzpicture}[baseline=(A-2-1.base)]    
        \matrix (A) [matrix of math nodes, nodes = {node style ge,fill=white}, column sep=1 mm, ampersand replacement=\&, inner sep=1.5pt] 
        { a \& b \& c \& a \& b \\
            d \& e \& f \& d \& e \\
            g \& h \& i \& g \& h \\
        };   

%% write in the left side of Matrix A

% -------------------

\draw(A-3-1.north west) node[above left]{$\det B =\ |B|=$}; 


%%for placement of the 1st sign

% -------------------

 \draw(A-3-1.south west) -- (A-1-3.north east)node[above right=-1.5mm] {$-$};

%%Laplace expansion pattern 1

% -------------------

 \draw[draw=white] (A-3-1) node[above right=-2.2mm,fill=white] {$g$};

 \draw[draw=white] (A-2-2) node[above right=-2.1mm,fill=white] {$e$};

 \draw[draw=white] (A-1-3) node[above right=-2.1mm,fill=white] {$c$};

%%for placement of the 2nd sign

% -------------------

 \draw[myarrow] (A-3-2.south west) -- (A-1-4.north east)node[above right=-1.5mm] {$-$};

%%Laplace expansion pattern 2

% -------------------

 \draw[draw=white] (A-3-2) node[above right=-2.1mm, label={[fill=white!0.5,inner sep=1.5pt]}, fill=white!0.5] {$h$};

 \draw[draw=white] (A-2-3) node[above right=-2.1mm,fill=white!0.5] {$f$};

 \draw[draw=white] (A-1-4) node[above right=-2.1mm,fill=white!0.5] {$a$};

%%for placement of the 3rd sign

% -------------------

 \draw[myarrow] (A-3-3.south west) -- (A-1-5.north east)node[above right=-1.5mm] {$-$};

%%Laplace expansion pattern 3

% -------------------

 \draw[draw=white] (A-3-3) node[above right=-2.1mm,fill=white!0.5] {$i$};

 \draw[draw=white] (A-2-4) node[above right=-2.1mm,fill=white!0.5] {$d$};

 \draw[draw=white] (A-1-5) node[above right=-2.1mm,fill=white!0.5] {$b$};

%%for placement of the 4th sign

% -------------------

 \draw[myarrow] (A-1-1.north west) -- (A-3-3.south east)node[below right=-1.5mm] {$+$};

%%Laplace expansion pattern 4

% -------------------

 \draw[draw=white] (A-1-1) node[above right=-2.1mm,fill=white!0.5] {$a$};

 \draw[draw=white] (A-2-2) node[above right=-2.1mm,fill=white!0.5] {$e$};

 \draw[draw=white] (A-3-3) node[above right=-2.1mm,fill=white!0.5] {$i$};

%%for placement of the 5th sign

% -------------------

 \draw[myarrow] (A-1-2.north west) -- (A-3-4.south east)node[below right=-1.5mm] {$+$};

%%Laplace expansion pattern 5

% -------------------

% \draw[draw=white] (A-1-2) node[above right=-2.1mm,fill=white!0.5,label={[fill=white!0.2,inner sep=0.9pt]}] {$b$};

  \draw[draw=white] (A-1-2) node[above right=-2.1mm,label={[fill=white!0.5,inner sep=1.5pt]},fill=white!0.5] {$b$};

 \draw[draw=white] (A-2-3) node[above right=-2.1mm,fill=white!0.5] {$f$};

 \draw[draw=white] (A-3-4) node[above right=-2.1mm,fill=white!0.5] {$g$};

%%for placement of the 6th sign

% -------------------

 \draw[myarrow] (A-1-3.north west) -- (A-3-5.south east)node[below right=-1.5mm] {$\mathbf{+}$};

%%Laplace expansion pattern 6

% -------------------

 \draw[draw=white] (A-1-3) node[above right=-2.1mm,fill=white!0.5] {$c$};

 \draw[draw=white] (A-2-4) node[above right=-2.1mm,fill=white!0.5] {$d$};

 \draw[draw=white] (A-3-5) node[above right=-2.1mm,fill=white!0.5] {$h$};

%% draw a boundary vertical lines

% -------------------

 \draw[black] (A-1-1.north west) -- (A-3-1.south west);

 \draw[black] (A-1-4.north west) -- (A-3-4.south west);

\end{tikzpicture}

\end{document}

2. Save file as DeterminantMatrix.tex
3. Typeset or Build or Compile.

Output



Related Post

Tidak ada komentar:

Posting Komentar