# latex Typesetting mathematics Matrices

## Example

Matrices

You must always use the amsmath package if you are going to use the following commands. There are four main types of matrix, as shown in the code below:

\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}

1. It is important you put your matrix within the equation, equation*, or $...$ environment - the bmatrix command is not a math environment on its own.
2. The construction of the matrix is actually fairly simple. For each row, you create each element (say x_{11}), then put a &, and then write the next element. For multiple rows, at the end of each row put \\ (you do not have to do this for the last row). It is fairly similar to a table in this.