# LaTeX matrix (square or curly brackets)

$\begin{matrix} a & b \\ c & d \end{matrix}$


$\begin{matrix} a & b \\ c & d \end{matrix}$

All rows are separated by double backslashes \\ and items in each row are separated by &. The matrix doesn't draw any brackets.

## pmatrix

$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$


$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$

The pmatrix generates the common type of matrices with curly brackets.

## bmatrix

$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$


$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$

The bmatrix generates a matrix as pmatrix but it's more suitable in case that the matrix has three or more rows or columns.

$\begin{bmatrix} a_{11} & \cdots & a_{1n} \\ a_{21} & \cdots & a_{2n} \end{bmatrix}$


$\begin{bmatrix} a_{11} & \cdots & a_{1n} \\ a_{21} & \cdots & a_{2n} \end{bmatrix}$

## vmatrix

$\begin{vmatrix} a & b \\ c & d \end{vmatrix}$


$\begin{vmatrix} a & b \\ c & d \end{vmatrix}$

The vmatrix is better than other commands if you want to draw the determinant of a matrix.

## Vmatrix

$\begin{Vmatrix} a & b \\ c & d \end{Vmatrix}$


$\begin{Vmatrix} a & b \\ c & d \end{Vmatrix}$

## array

$\begin{array}{cc} a & b \\ c & d \end{array}$


$\begin{array}{cc} a & b \\ c & d \end{array}$