#math/linear-algebra
The `determinant` of a real square matrix describes how $T(x)=Ax$ changes area or volume:
- $|\det A|$ is the area or volume scale factor.
- Its sign records orientation: positive preserves it; negative reverses it.
- Zero means the columns are [[2C2 - Pivots and Independence|linearly dependent]]: the shape collapses into a lower dimension, and $A$ is [[1F1 - Invertible Transforms|not invertible]].
## Unit square to parallelogram
Matrix columns are $T(e_1),T(e_2)$. They become the edges of the image `parallelogram`, whose area is $|\det A|$ because the original unit square has area $1$. In two dimensions,
$
\det\begin{pmatrix}a&b\\c&d\end{pmatrix}=ad-bc.
$
For example,
$
A=\begin{pmatrix}2&1\\0&2\end{pmatrix},\quad \det A=4;
\qquad
B=\begin{pmatrix}1&2\\2&1\end{pmatrix},\quad \det B=-3.
$
The areas are $4$ and $3$; the second map reverses orientation. Dashed outlines are unit squares, and colored arrows are the matrix columns.
```tikz
\begin{document}
\begin{tikzpicture}[scale=0.95,>=stealth]
\begin{scope}
\node at (1.6,3.85) {$A:\ \det A=4$};
\fill[blue!12] (0,0) -- (2,0) -- (3,2) -- (1,2) -- cycle;
\draw[blue!65!black] (0,0) -- (2,0) -- (3,2) -- (1,2) -- cycle;
\draw[->,gray] (-0.3,0) -- (3.65,0) node[right] {$x$};
\draw[->,gray] (0,-0.3) -- (0,3.35) node[above] {$y$};
\draw[dashed,gray,thick] (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
\node[below,gray] at (1,0) {$e_1$};
\node[left,gray] at (0,1) {$e_2$};
\draw[->,very thick,blue!70!black] (0,0) -- (2,0) node[below right] {$v_1$};
\draw[->,very thick,red!75!black] (0,0) -- (1,2) node[above left] {$v_2$};
\node at (1.7,1.1) {$4$};
\node[below left] at (0,0) {$0$};
\node at (1.6,-0.75) {orientation preserved};
\end{scope}
\begin{scope}[xshift=5.5cm]
\node at (1.6,3.85) {$B:\ \det B=-3$};
\fill[orange!18] (0,0) -- (1,2) -- (3,3) -- (2,1) -- cycle;
\draw[orange!75!black] (0,0) -- (1,2) -- (3,3) -- (2,1) -- cycle;
\draw[->,gray] (-0.3,0) -- (3.65,0) node[right] {$x$};
\draw[->,gray] (0,-0.3) -- (0,3.35) node[above] {$y$};
\draw[dashed,gray,thick] (0,0) -- (1,0) -- (1,1) -- (0,1) -- cycle;
\node[below,gray] at (1,0) {$e_1$};
\node[left,gray] at (0,1) {$e_2$};
\draw[->,very thick,blue!70!black] (0,0) -- (1,2) node[above left] {$w_1$};
\draw[->,very thick,red!75!black] (0,0) -- (2,1) node[below right] {$w_2$};
\node at (1.6,1.7) {$3$};
\node[below left] at (0,0) {$0$};
\node at (1.6,-0.75) {orientation reversed};
\end{scope}
\end{tikzpicture}
\end{document}
```
A parallelogram's area is base times perpendicular height, $|\det A|=bh$; in the first example, $b=2$ and $h=2$, so the area is $4$.
## Unit cube to parallelepiped
Three columns similarly send the unit cube to a `parallelepiped`. Here $u_j=Ce_j$:
$
C=\begin{pmatrix}2&1&0\\0&1&0\\0&0&2\end{pmatrix},
\qquad \det C=4.
$
Its volume is $|\det C|=4$: base area $2$ times perpendicular height $2$. The positive sign means orientation is preserved.
```tikz
\begin{document}
\begin{tikzpicture}[>=stealth]
\begin{scope}[x={(0.95cm,-0.30cm)},y={(0.55cm,0.40cm)},z={(0cm,0.90cm)}]
\node at (0.5,0.5,2.4) {unit cube};
\fill[gray!10] (0,0,0) -- (1,0,0) -- (1,0,1) -- (0,0,1) -- cycle;
\fill[gray!20] (1,0,0) -- (1,1,0) -- (1,1,1) -- (1,0,1) -- cycle;
\fill[gray!5] (0,0,1) -- (1,0,1) -- (1,1,1) -- (0,1,1) -- cycle;
\draw[dashed,gray] (0,1,0) -- (1,1,0);
\draw[dashed,gray] (0,1,0) -- (0,1,1);
\draw (0,0,0) -- (1,0,0) -- (1,1,0) -- (1,1,1) -- (0,1,1) -- (0,0,1) -- cycle;
\draw (1,0,0) -- (1,0,1) -- (1,1,1);
\draw (0,0,1) -- (1,0,1);
\draw[->,thick,blue!70!black] (0,0,0) -- (1,0,0) node[below] {$e_1$};
\draw[->,thick,dashed,red!75!black] (0,0,0) -- (0,1,0) node[above right] {$e_2$};
\draw[->,thick,teal!70!black] (0,0,0) -- (0,0,1) node[left] {$e_3$};
\node[below left] at (0,0,0) {$0$};
\node at (0.5,0.5,-0.9) {volume $1$};
\end{scope}
\draw[->,thick] (2.05,0.75) -- (4.25,0.75) node[midway,above] {$T(x)=Cx$};
\begin{scope}[xshift=5cm,x={(0.95cm,-0.30cm)},y={(0.55cm,0.40cm)},z={(0cm,0.90cm)}]
\node at (1.5,0.5,2.8) {parallelepiped};
\fill[blue!12] (0,0,0) -- (2,0,0) -- (2,0,2) -- (0,0,2) -- cycle;
\fill[blue!22] (2,0,0) -- (3,1,0) -- (3,1,2) -- (2,0,2) -- cycle;
\fill[blue!6] (0,0,2) -- (2,0,2) -- (3,1,2) -- (1,1,2) -- cycle;
\draw[dashed,gray] (1,1,0) -- (3,1,0);
\draw[dashed,gray] (1,1,0) -- (1,1,2);
\draw (0,0,0) -- (2,0,0) -- (3,1,0) -- (3,1,2) -- (1,1,2) -- (0,0,2) -- cycle;
\draw (2,0,0) -- (2,0,2) -- (3,1,2);
\draw (0,0,2) -- (2,0,2);
\draw[->,very thick,blue!70!black] (0,0,0) -- (2,0,0) node[below] {$u_1$};
\draw[->,very thick,dashed,red!75!black] (0,0,0) -- (1,1,0) node[above right] {$u_2$};
\draw[->,very thick,teal!70!black] (0,0,0) -- (0,0,2) node[left] {$u_3$};
\node[below left] at (0,0,0) {$0$};
\node at (1.5,0.5,-1.2) {volume $4$};
\end{scope}
\end{tikzpicture}
\end{document}
```
Note the $h=\text{dist}(u_{3},\text{span}(u_{1},u_{2}))=2.$ Which is the closest distance between $u_{3}$ and then plane formed by $u_{1},u_{2}$. Let $B=\text{span}(u_{1},u_{2})$, if $u_{3}$ were slanted, we'd use $h=\lVert u_{3}-P_{E}(u_{3})\rVert$.
> [!Note] Determinant Notation
> For a system of vectors $a_{1}, \ldots{}, a_{n}$ we will denote its determinant as $D(a_{1}, \ldots{}, a_{n}).$ If we form these vectors into a matrix $A$, we use $\det A.$