Matrices in LaTeX

On This Page
Type LATEX markup Renders as
Plain \begin{matrix}
1 & 2 & 3\\
a & b & c
\end{matrix}
\(\begin{matrix} 1 & 2 & 3\\ a & b & c \end{matrix}\)
Parentheses; round brackets \begin{pmatrix}
1 & 2 & 3\\
a & b & c
\end{pmatrix}
\(\begin{pmatrix} 1 & 2 & 3\\ a & b & c \end{pmatrix}\)
Brackets; square brackets \begin{bmatrix}
1 & 2 & 3\\
a & b & c
\end{bmatrix}
\(\begin{bmatrix} 1 & 2 & 3\\ a & b & c \end{bmatrix}\)
Braces; curly brackets \begin{Bmatrix}
1 & 2 & 3\\
a & b & c
\end{Bmatrix}
\(\begin{Bmatrix} 1 & 2 & 3\\ a & b & c \end{Bmatrix}\)
Pipes \begin{vmatrix}
1 & 2 & 3\\
a & b & c
\end{vmatrix}
\(\begin{vmatrix} 1 & 2 & 3\\ a & b & c \end{vmatrix}\)
Double pipes \begin{Vmatrix}
1 & 2 & 3\\
a & b & c
\end{Vmatrix}
\(\begin{Vmatrix} 1 & 2 & 3\\ a & b & c \end{Vmatrix}\)

more

Matrix with Dots

Sometimes, you might want to include dots in your matrix to indicate a pattern. You can use the \cdots, \ddots, and \vdots commands for this.

\begin{pmatrix}
1 & 2 & \cdots & n \\
2 & 4 & \cdots & 2n \\
\vdots & \vdots & \ddots & \vdots \\
n & 2n & \cdots & n^2 \\
\end{pmatrix}
\[\begin{pmatrix} 1 & 2 & \cdots & n \\ 2 & 4 & \cdots & 2n \\ \vdots & \vdots & \ddots & \vdots \\ n & 2n & \cdots & n^2 \\ \end{pmatrix}\]

and

\begin{bmatrix}
x_{11} & x_{12} & x_{13} & \dots & x_{1n} \\
x_{21} & x_{22} & x_{23} & \dots & x_{2n} \\
\dots & \dots & \dots & \dots & \dots \\
x_{d1} & x_{d2} & x_{d3} & \dots & x_{dn}
\end{bmatrix}
=
\begin{bmatrix}
x_{11} & x_{12} & x_{13} & \dots & x_{1n} \\
x_{21} & x_{22} & x_{23} & \dots & x_{2n} \\
\vdots & \vdots & \vdots & \ddots & \vdots \\
x_{d1} & x_{d2} & x_{d3} & \dots & x_{dn}
\end{bmatrix}
\[\begin{bmatrix} x_{11} & x_{12} & x_{13} & \dots & x_{1n} \\ x_{21} & x_{22} & x_{23} & \dots & x_{2n} \\ \dots & \dots & \dots & \dots & \dots \\ x_{d1} & x_{d2} & x_{d3} & \dots & x_{dn} \end{bmatrix} = \begin{bmatrix} x_{11} & x_{12} & x_{13} & \dots & x_{1n} \\ x_{21} & x_{22} & x_{23} & \dots & x_{2n} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ x_{d1} & x_{d2} & x_{d3} & \dots & x_{dn} \end{bmatrix}\]

Matrix Multiplication

To represent matrix multiplication, you can use the \times command or leave a space between matrices.

\begin{pmatrix}
1 & 2 \\
3 & 4 \\
\end{pmatrix}
\times
\begin{pmatrix}
5 & 6 \\
7 & 8 \\
\end{pmatrix}
\[\begin{pmatrix} 1 & 2 \\ 3 & 4 \\ \end{pmatrix} \times \begin{pmatrix} 5 & 6 \\ 7 & 8 \\ \end{pmatrix}\]

Matrix Transpose and Inverse

To represent the transpose of a matrix, you can use the ^T command.

\begin{pmatrix}
1 & 2 \\
3 & 4 \\
\end{pmatrix}^T
\[\begin{pmatrix} 1 & 2 \\ 3 & 4 \\ \end{pmatrix}^T\]
\begin{aligned}
\mathbf{A}
&=
\begin{bmatrix}
\cos \theta & -\sin \theta \\
\sin \theta & \cos \theta
\end{bmatrix}
\\
\mathbf{A}^T
&=
\begin{bmatrix}
\cos \theta & \sin \theta \\
-\sin \theta & \cos \theta
\end{bmatrix}
\\
\mathbf{A}^{-1}
&=
\begin{bmatrix}
\cos \theta & \sin \theta \\
-\sin \theta & \cos \theta
\end{bmatrix}
\end{aligned}
\[\begin{aligned} \mathbf{A} &= \begin{bmatrix} \cos \theta & -\sin \theta \\ \sin \theta & \cos \theta \end{bmatrix} \\ \mathbf{A}^T &= \begin{bmatrix} \cos \theta & \sin \theta \\ -\sin \theta & \cos \theta \end{bmatrix} \\ \mathbf{A}^{-1} &= \begin{bmatrix} \cos \theta & \sin \theta \\ -\sin \theta & \cos \theta \end{bmatrix} \end{aligned}\]

Ref

Drop Your Email

Add Your Note