Skip to main content

LaTeX Matrix Syntax — pmatrix, bmatrix, vmatrix

Matrices are built from amsmath environments. You pick the delimiter — parentheses, brackets, or bars — and fill in the entries with & between columns and \\ between rows.

The Basics

Every matrix follows the same pattern: \begin{env} ... \end{env}, whereenv is one of pmatrix,bmatrix, Bmatrix,vmatrix, or Vmatrix. Inside, columns are separated by & and rows by \\ (two backslashes).

The delimiter is the only difference between environments: pmatrix gives parentheses, bmatrix gives square brackets, Bmatrix gives curly braces, vmatrix gives single bars (determinants), andVmatrix gives double bars (norms). All require amsmath.

For a quick matrix without loading amsmath, you can use the plain array environment inside math mode and wrap it in delimiters yourself, but the dedicated matrix environments are simpler and produce better spacing.

Matrix Examples

Parenthesized matrix (pmatrix)

Round parentheses. The most common matrix environment.

Bracketed matrix (bmatrix)

Square brackets, often used for vectors and arrays.

Determinant (vmatrix)

Single vertical bars — the notation for a determinant.

Norm (Vmatrix)

Double vertical bars, used for matrix norms.

Identity matrix

The 3×3 identity matrix I₃.

Row vector

A single row — use bmatrix with one row.

Matrix FAQ

What package do I need for matrices in LaTeX?▼

All matrix environments (pmatrix, bmatrix, vmatrix, and their capital-letter variants) are part of the amsmath package. Add \usepackage{amsmath} to your preamble.

How do I write a matrix in LaTeX?▼

Use one of the amsmath matrix environments. Begin with \begin{pmatrix} (or bmatrix, vmatrix, Bmatrix, Vmatrix), separate columns with &, end rows with \\, and close with \end{pmatrix}.

What is the difference between pmatrix, bmatrix, and vmatrix?▼

pmatrix uses round parentheses ( ), bmatrix uses square brackets [ ], Bmatrix uses curly braces { }, vmatrix uses single vertical bars | | for determinants, and Vmatrix uses double vertical bars || || for norms.

How do I write a determinant in LaTeX?▼

Use the vmatrix environment: \begin{vmatrix} a & b \\ c & d \end{vmatrix}. The single vertical bars are the standard determinant notation.