Augmented matrices in LaTeX
An augmented matrix puts the right-hand side of a system of equations after a vertical line; in LaTeX it is an array with a | in its column list, inside \left[ and \right].
Main page: Matrices in LaTeX →
LaTeX command
\left[\begin{array}{cc|c} 1 & 2 & 3 \\ 4 & 5 & 6 \end{array}\right]Not the symbol you meant? Draw it to find the command →
Typing up handwritten notes? Convert a whole page of handwriting to LaTeX →
The matrix environments such as bmatrix take no column list, so they cannot draw the line. An array can: {cc|c} means two centred columns, a line, then one more column. \left[ and \right] around it give the square brackets, sized to the matrix; use \left( and \right) for round ones.
Rows are separated by \\ and entries by &, as in any matrix. For three unknowns the column list is {ccc|c}. The line runs the full height of the matrix, between the brackets.
Row reduction is written as a chain of matrices joined by arrows, with each operation over its arrow: \xrightarrow{R_2 - 2R_1}. For a dashed line instead of a solid one, the arydshln package adds a : column type.
Other forms
\begin{array}{ccc|c}three columns, then the line\xrightarrow{R_2 - 2R_1}a row operation over an arrow\left(\begin{array}{cc|c} ... \end{array}\right)round bracketsExamples
$\left[\begin{array}{cc|c} 1 & 2 & 3 \\ 4 & 5 & 6 \end{array}\right]$two equations, two unknowns
$\left[\begin{array}{ccc|c} 1 & 1 & 1 & 6 \\ 0 & 2 & 5 & -4 \\ 2 & 5 & -1 & 27 \end{array}\right]$three unknowns
$\left[\begin{array}{cc|c} 1 & 2 & 3 \\ 4 & 5 & 6 \end{array}\right] \xrightarrow{R_2 - 4R_1} \left[\begin{array}{cc|c} 1 & 2 & 3 \\ 0 & -3 & -6 \end{array}\right]$a row operation over the arrow
$\left(\begin{array}{cc|c} 1 & 0 & 2 \\ 0 & 1 & 5 \end{array}\right)$round brackets
Tips and common mistakes
- Put the | in the array's column list where the line belongs: {cc|c}.
- bmatrix and pmatrix cannot draw the line; use array inside
\left[\right] instead. - Write each row operation over an
\xrightarrowso the arrow fits the label. - Match the number of letters in the column list to the entries in each row.
- array is built into LaTeX and works in KaTeX;
\xrightarrowneeds amsmath.
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 an augmented matrix in LaTeX?
Use an array with a line in its column list inside brackets: \left[\begin{array}{cc|c} 1 & 2 & 3 \\ 4 & 5 & 6 \end{array}\right].
How do I add the vertical line?
Put | in the column list where the line goes, for example {ccc|c} before the last column.
Can I use bmatrix for an augmented matrix?
Not directly: bmatrix has no column list. Wrap an array in \left[ and \right] instead.
How do I show row operations?
Join the matrices with arrows and write each step over its arrow: \xrightarrow{R_2 - 2R_1}.