CamteX
All guides

Matrix in LaTeX

Matrices are built with environments from the amsmath package. Separate columns with & and rows with a double backslash \\. The environment name decides the brackets: pmatrix gives round ones, bmatrix square ones and vmatrix the vertical bars of a determinant.

Round brackets

\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}
(1234)\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}

Determinant

\det A = \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc
detA=abcd=adbc\det A = \begin{vmatrix} a & b \\ c & d \end{vmatrix} = ad - bc

n × n matrix

\begin{bmatrix} a_{11} & \cdots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{n1} & \cdots & a_{nn} \end{bmatrix}
[a11a1nan1ann]\begin{bmatrix} a_{11} & \cdots & a_{1n} \\ \vdots & \ddots & \vdots \\ a_{n1} & \cdots & a_{nn} \end{bmatrix}

Common mistakes

See also

Don't want to memorize commands?

Draw a formula or paste a screenshot, and CamteX turns it into ready LaTeX.

Try it free