Sarmate.net Sarmate.net
Home Features Pricing Documentation Contact
Log in Sign up

Writing matrices in LaTeX

The amsmath package provides several matrix environments, each with a different delimiter style: brackets, parentheses, vertical bars or none.

Matrix types

LaTeX
% Crochets (bmatrix)
$\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}$ \quad
% Parenthèses (pmatrix)
$\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$ \quad
% Déterminant (vmatrix)
$\begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix}$
EnvironmentDelimiterCommon usage
matrixAucunMatrice nue
pmatrix( )Vecteurs, matrices générales
bmatrix[ ]Systèmes linéaires
vmatrix| |Déterminants
Vmatrix|| ||Normes matricielles

Large matrices with dots

LaTeX
\[
A = \begin{pmatrix}
    a_{11} & a_{12} & \cdots & a_{1n} \\
    a_{21} & a_{22} & \cdots & a_{2n} \\
    \vdots & \vdots & \ddots & \vdots \\
    a_{m1} & a_{m2} & \cdots & a_{mn}
\end{pmatrix}
\]

Example: linear system

LaTeX
\[
\begin{bmatrix}
    2 & 1 & -1 \\
    -3 & -1 & 2 \\
    -2 & 1 & 2
\end{bmatrix}
\begin{bmatrix} x \\ y \\ z \end{bmatrix}
=
\begin{bmatrix} 8 \\ -11 \\ -3 \end{bmatrix}
\]

Try it in Sarmate

Edit, compile and download your LaTeX documents directly in your browser.

Open the editor