## Math-Linux.com

Knowledge base dedicated to Linux and applied mathematics.

Home > Latex > FAQ > Latex - FAQ > How to write matrices in Latex ? matrix, pmatrix, bmatrix, vmatrix, (...)

# How to write matrices in Latex ? matrix, pmatrix, bmatrix, vmatrix, Vmatrix

How to write matrices in Latex ? matrix, pmatrix, bmatrix, vmatrix, Vmatrix. Here are few examples to write quickly matrices.


\usepackage{amsmath}



*Thanks to Miss Paola Estrada for the fix.

## LateX pmatrix, bmatrix, vmatrix, Vmatrix

pmatrix, bmatrix, vmatrix, Vmatrix are Latex environments:

• p for parentheses
• b for brackets
• v for verts
• B for braces
• V for double verts.

## How to write an m x n matrix in LaTeX

How to write an m x n matrix with big parentheses


\begin{equation*}
A_{m,n} =
\begin{pmatrix}
a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
\vdots  & \vdots  & \ddots & \vdots  \\
a_{m,1} & a_{m,2} & \cdots & a_{m,n}
\end{pmatrix}
\end{equation*}



$$\begin{equation*} A_{m,n} = \begin{pmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{pmatrix} \end{equation*}$$

## Examples matrix 3 x 3 in LaTeX

With parentheses:


\begin{equation*}
A =
\begin{pmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{pmatrix}
\end{equation*}



$$\begin{equation*} A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix} \end{equation*}$$

With brackets:


\begin{equation*}
B =
\begin{bmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{bmatrix}
\end{equation*}



$$\begin{equation*} B = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} \end{equation*}$$

## LateX matrix with no bracket

Without brackets:


$$\begin{matrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{matrix}$$



$$$$\begin{matrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{matrix}$$$$

## LateX matrix determinant / vertical bar bracket

With vertical bar brackets:


$$\begin{vmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{vmatrix}$$



$$$$\begin{vmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{vmatrix}$$$$

## Latex matrix with curly brackets

With curly brackets:


$$\begin{Bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{Bmatrix}$$



$$$$\begin{Bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{Bmatrix}$$$$

## Latex matrix with double vertical bar brackets

With double vertical bar brackets:


$$\begin{Vmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{Vmatrix}$$



$$$$\begin{Vmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{Vmatrix}$$$$

## Latex small inline matrix

Use smallmatrix environment


I love small matrice such $\big(\begin{smallmatrix} a & b\\ c & d \end{smallmatrix}\big)$



I love small matrice such $\big(\begin{smallmatrix} a & b\\ c & d \end{smallmatrix}\big)$

## Examples matrix 2 x 2 in LaTeX

Here are examples with matrix 2x2 with pmatrix, bmatrix, vmatrix, Vmatrix environments:


\begin{matrix}
a & b \\
c & d
\end{matrix}
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
\begin{vmatrix}
a & b \\
c & d
\end{vmatrix}


$$\begin{matrix} a & b \\ c & d \end{matrix} \quad \begin{pmatrix} a & b \\ c & d \end{pmatrix} \quad \begin{bmatrix} a & b \\ c & d \end{bmatrix} \quad \begin{vmatrix} a & b \\ c & d \end{vmatrix} \quad \begin{Vmatrix} a & b \\ c & d \end{Vmatrix}$$