Determinant (source code)

= Determinant
{title2=$\det$}
{wiki}

The <determinant> assigns a <scalar> to a square <matrix>. For a <linear map> on the real <plane>, it measures signed <area> scaling: its <absolute value> tells how much <area> grows, and its sign records whether the <orientation of a vector space> is preserved or reversed. In three dimensions, the same idea measures signed <volume>. Over a <field>, a square <matrix> is an <invertible matrix> exactly when its <determinant> is nonzero. These are two views of one phenomenon: losing an independent direction collapses full-dimensional <volume> and makes the original input impossible to recover uniquely.https://www.math.ucla.edu/~rse/algebra_book.pdf#page=716[Elman, Lectures on Abstract Algebra, section 121: determinant and inverse]{ref}

Start with an explicit <matrix> and its action on a <vector>:
$$
\begin{gathered}
A=\begin{pmatrix}2&1\\1&3\end{pmatrix},\qquad
A\begin{pmatrix}x\\y\end{pmatrix}
=\begin{pmatrix}2x+y\\x+3y\end{pmatrix},\\
\det\begin{pmatrix}a&b\\c&d\end{pmatrix}=ad-bc,\qquad
\det A=2\cdot3-1\cdot1=5.
\end{gathered}
$$
The columns are the images of the <standard basis> <vectors>: $Ae_1=(2,1)^T$ and $Ae_2=(1,3)^T$. Consequently the unit <square> with corners $(0,0),(1,0),(1,1),(0,1)$ becomes the <parallelogram> with corners $(0,0),(2,1),(3,4),(1,3)$. Its <area> is five. Every small patch of this <square> undergoes the same <linear map>, so the factor describes the whole deformation, rather than just one specially chosen boundary. The <matrix> mixes horizontal and vertical components, but its <determinant> compresses that combined effect into one <area> factor.https://ocw.mit.edu/ans7870/18/18.013a/textbook/HTML/chapter04/section01.html[MIT calculus notes, section 4.1: determinants and area]{ref}

Now exchange the columns:
$$
A_{\rm swap}=\begin{pmatrix}1&2\\3&1\end{pmatrix},\qquad
\det A_{\rm swap}=1\cdot1-2\cdot3=-5.
$$
The <parallelogram> occupies exactly the same region, but its generating <vectors> arrive in the opposite order. Moving from the first column to the second now turns clockwise rather than counterclockwise. Ordinary <area> remains five; the <oriented volume> in two dimensions changes sign. A negative <determinant> therefore signals reversed <orientation of a vector space>, not a negative amount of material. Keeping the sign makes successive reversals calculable: two reversals restore the original <orientation of a vector space>.

Compare a <singular matrix>:
$$
C=\begin{pmatrix}1&2\\2&4\end{pmatrix},\qquad
\det C=1\cdot4-2\cdot2=0,\qquad
C\begin{pmatrix}x\\y\end{pmatrix}=(x+2y)\begin{pmatrix}1\\2\end{pmatrix}.
$$
Its columns are <linearly dependent>: the second is twice the first. The unit <square> collapses onto the segment from $(0,0)$ to $(3,6)$, which has zero <area> despite nonzero length. Since $C(-2,1)^T=0$, the <kernel of a linear map> contains a nonzero <vector>; inputs differing by that <vector> have identical outputs. The collapsed picture explains why an <inverse matrix> cannot exist.

\Image[/determinant-area-and-degeneracy.png]
{title=The unit square, determinant five, reversed orientation, and collapse to zero area}

For $A$, recovery is possible, and the complete <matrix multiplication> check is
$$
A^{-1}=\frac15\begin{pmatrix}3&-1\\-1&2\end{pmatrix},\qquad
AA^{-1}=\frac15
\begin{pmatrix}2\cdot3+1(-1)&2(-1)+1\cdot2\\1\cdot3+3(-1)&1(-1)+3\cdot2\end{pmatrix}
=\begin{pmatrix}1&0\\0&1\end{pmatrix}=I.
$$
Here $I$ is the <identity matrix>. The <inverse matrix> restores the original <square>, shrinking its <area> by $1/5$. Generally, the <adjugate identity> gives $A^{-1}=\operatorname{adj}(A)/\det A$ whenever the <determinant> is nonzero over a <field>; this is why the denominator matters.https://ocw.mit.edu/ans7870/18/18.013a/textbook/HTML/chapter04/section04.html[MIT calculus notes, section 4.4: determinant and inverse]{ref}

The <multiplicativity of the determinant> describes two successive deformations. <Matrix multiplication> means that $AB$ applies $B$ first, then $A$. Take
$$
B=\begin{pmatrix}1&0\\0&2\end{pmatrix},\qquad
AB=\begin{pmatrix}2\cdot1+1\cdot0&2\cdot0+1\cdot2\\1\cdot1+3\cdot0&1\cdot0+3\cdot2\end{pmatrix}
=\begin{pmatrix}2&2\\1&6\end{pmatrix}.
$$
The first <linear map> doubles <area>; the second multiplies the resulting <area> by five. Thus the unit <square> passes through <areas> $1,2,10$, with the last <parallelogram> bounded by $(0,0),(2,1),(4,7),(2,6)$. Direct calculation agrees:
$$
\det B=2,\qquad \det(AB)=2\cdot6-2\cdot1=10=\det A\det B.
$$
This explains physically why <area> factors multiply instead of adding. The general identity holds for square <matrices> of the same size, including <singular matrices>. If either stage loses a direction, later processing cannot recover the discarded information.https://ocw.mit.edu/ans7870/18/18.013a/textbook/HTML/chapter32/section04.html[MIT calculus notes, section 32.4: determinant products]{ref}

\Image[/determinant-product-geometry.png]
{title=Successive linear maps multiply area factors: one becomes two, then ten}

The same interpretation works in three dimensions without drawing a new picture. The <diagonal matrix>
$$
D=\begin{pmatrix}2&0&0\\0&3&0\\0&0&-1\end{pmatrix},\qquad
\det D=2\cdot3\cdot(-1)=-6
$$
sends the unit <cube> to a rectangular box with side lengths two, three, and one. Its ordinary <volume> is six. The minus sign comes from reversing the third direction, so the <oriented volume> is minus six. Replacing the last diagonal entry by zero flattens the <cube> into a planar region: its <area> may be positive, but its three-dimensional <volume> is zero. This distinction matters whenever a <linear map> changes shape: the <determinant> measures size in the full input <dimension>, rather than the size of whichever lower-dimensional object remains.

The <determinant> measures neither <trace> nor <perimeter>. For $A$, the <trace> happens also to be five, but the <identity matrix> in two dimensions has <trace> two and <determinant> one. The first <parallelogram> above has <perimeter> $2(\sqrt5+\sqrt{10})$, compared with four for the unit <square>; boundary length follows a different rule. Nor does <determinant> one require every length to stay fixed: the <diagonal matrix> $\operatorname{diag}(2,1/2)$ preserves <area> while stretching one direction and compressing the other.

These properties make the <determinant> useful when coordinates obscure what a deformation does. A nonzero <determinant> certifies that <linearly independent> input directions remain distinguishable; its magnitude counts the <area> or <volume> represented by a transformed cell. That second role reappears in the <change of variables formula>, where the <Jacobian determinant> corrects the sizes of small cells. Signed <volume> also separates a deformation that reverses the <orientation of a vector space> from one that merely stretches it, even when both give identical ordinary <volume> factors.https://ocw.mit.edu/ans7870/18/18.013a/textbook/HTML/chapter24/section02.html[MIT calculus notes, section 24.2: the Jacobian area factor]{ref}

For general $n$, regard the columns $v_1,\ldots,v_n$ as ordered arguments. The <determinant> is the unique <alternating multilinear map> to the <scalar> <field> normalized by $\det I=1$. The <multilinearity of the determinant> means <linearity> in each column separately, with all others held fixed:
$$
\det(\ldots,\alpha u+\beta v,\ldots)
=\alpha\det(\ldots,u,\ldots)+\beta\det(\ldots,v,\ldots).
$$
Alternation means equal columns give zero; exchanging columns negates the result. Normalization sets the <oriented volume> of the <standard basis> to one. These properties also hold in rows. For real three-dimensional columns, their <determinant> is the <scalar triple product>, and its <absolute value> is the enclosed <volume>. Over other <fields>, the algebraic definition still works even without a geometric notion of positive <volume>.https://web.mit.edu/18.06/www/Spring16/lecture22.pdf[Barwick, MIT 18.06 Lecture 22: the determinant axioms]{ref}

Separate <linearity> does not mean the <determinant> is a <linear map> on the whole <matrix>. Scaling every column of an $n$-by-$n$ <matrix> by $t$ gives $\det(tA)=t^n\det A$. For our two-dimensional example, $\det(2A)=4\det A=20$: doubling both directions quadruples <area>. The power records how many independent directions are being scaled together.

The properties suggest practical computations. Adding a multiple of one column to another preserves the <determinant>: the extra term has repeated columns and vanishes. This is the algebra behind an <area>-preserving <shear mapping>. Alternatively, expansion along a row uses <cofactors>, each a <matrix minor> multiplied by a sign:
$$
\det A=\sum_{j=1}^n a_{ij}(-1)^{i+j}\det A^{(ij)},
$$
where $A^{(ij)}$ deletes row $i$ and column $j$. The <Leibniz formula for determinants> supplies the general entry formula. Both calculations encode the same geometric invariant; the defining properties explain their structure without requiring memorization of a separate recipe for every size.https://ocw.mit.edu/ans7870/18/18.013a/textbook/HTML/chapter04/section03.html[MIT calculus notes, section 4.3: cofactor expansion]{ref}