latex demo

latex

How to write an m x n matrix in LaTeX

pmatrix, bmatrix, vmatrix, Vmatrix are Latex environments:

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

With big parentheses

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}
(1)\[\begin{split}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{split}\]

With parentheses

A =
\begin{pmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{pmatrix}
(2)\[\begin{split}A = \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix}\end{split}\]

With brackets

B =
\begin{bmatrix}
a & b & c \\
d & e & f \\
g & h & i
\end{bmatrix}
(3)\[\begin{split}B = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}\end{split}\]

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}
(4)\[\begin{split}\begin{matrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{matrix}\end{split}\]

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}
(5)\[\begin{split}\begin{vmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{vmatrix}\end{split}\]

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}
(6)\[\begin{split}\begin{Bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{Bmatrix}\end{split}\]

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}
(7)\[\begin{split}\begin{Vmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{Vmatrix}\end{split}\]

small inline matrix

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

\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}
(8)\[\begin{split}\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}\end{split}\]

\boxed{u=1}

\begin{equation}
\boxed{
\begin{array}{rcl}
x + -y + z -t & = & 0 \\
2x + 2y + 2z +3t & = & 0
\end{array}
}
\end{equation}
(9)\[ \begin{align}\begin{aligned}\boxed{u=1}\\\begin{split}\begin{equation} \boxed{ \begin{array}{rcl} x + -y + z -t & = & 0 \\ 2x + 2y + 2z +3t & = & 0 \end{array} } \end{equation}\end{split}\end{aligned}\end{align} \]