Determinants in LaTeX
The determinant of a square matrix is written either as det A, with \det, or as the matrix between vertical bars, which the amsmath vmatrix environment draws.
LaTeX command
\det(A)Not the symbol you meant? Draw it to find the command →
Typing up handwritten notes? Convert a whole page of handwriting to LaTeX →
vmatrix works like the other matrix environments: & between columns and \\ between rows, with the vertical bars sized to the whole matrix. Its double-bar sibling Vmatrix is used for some norms, and pmatrix and bmatrix give round and square brackets.
\det is an upright operator built into LaTeX, so det A and det(A) are spaced correctly. Typing det as letters gives italic d, e and t. The short form |A| is common too; write it with \lvert A \rvert so the bars are spaced as a pair.
For an n by n determinant, fill the gaps with \cdots, \vdots and \ddots, as in the last example below. Inside a sentence a large determinant pushes the lines apart, so put it in a displayed equation.
Other forms
\begin{vmatrix} a & b \\ c & d \end{vmatrix}a determinant drawn with bars\lvert A \rvertshort form |A|\det \begin{pmatrix} a & b \\ c & d \end{pmatrix}det before a matrixExamples
$\begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc$a 2 by 2 determinant
$\begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix} = 1 \cdot 4 - 2 \cdot 3 = -2$a worked 2 by 2 example
$\begin{vmatrix} a & b & c \\ d & e & f \\ g & h & i \end{vmatrix} = a(ei - fh) - b(di - fg) + c(dh - eg)$a 3 by 3 determinant, expanded along the first row
$\det(A - \lambda I) = 0$the characteristic equation
$\det(AB) = \det(A)\det(B)$the product rule
$\begin{vmatrix} a_{11} & \cdots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{n1} & \cdots & a_{nn} \end{vmatrix}$an n by n determinant
Tips and common mistakes
- Use vmatrix, not pmatrix inside | |: vmatrix sizes the bars to the matrix.
- Write
\det, not det: the command sets it upright as an operator. - vmatrix needs amsmath;
\detis built in. - Fill an n by n determinant with
\cdots,\vdotsand\ddots. - Put large determinants in a displayed equation so they do not push lines of text apart.
Working from handwritten notes?
LatexNotes turns a photo or PDF of handwritten mathematics into LaTeX, graphs and all. It is built with real pdflatex before you see it, and the .tex file is yours to edit or take to Overleaf. Free to try, no sign-up.
See how handwriting to LaTeX works, step by step, or go from GoodNotes to LaTeX if you write on an iPad (Notability works the same way).
Convert your maths to LaTeX →FAQ
How do I write a determinant in LaTeX?
Use the vmatrix environment: \begin{vmatrix} a & b \\ c & d \end{vmatrix}, or write \det(A).
How do I write a 3x3 determinant?
Use vmatrix with three entries per row: \begin{vmatrix} a & b & c \\ d & e & f \\ g & h & i \end{vmatrix}.
Which package does vmatrix need?
amsmath. KaTeX supports it too.
How do I write det in upright letters?
Use \det, which LaTeX already sets upright and spaces as an operator.