LaTeX & MathJax basic tutorial – Matrices

Matrices

1. Use $$\begin{matrix}…\end{matrix}$$ In between the \begin and \end, put the matrix elements. End each matrix row with \\, and separate matrix elements with & . For example,

produces:

$$\begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix}$$

MathJax will adjust the sizes of the rows and columns so that everything fits.

2. To add brackets, either use \left…\right as in section 6 of the tutorial, or replace matrix with pmatrix $\begin{pmatrix}1& 2\\3& 4\\ \end{pmatrix}$, bmatrix $\begin{bmatrix}1& 2\\3& 4\\ \end{bmatrix}$, Bmatrix $\begin{Bmatrix}1& 2\\3& 4\\ \end{Bmatrix}$, vmatrix $\begin{vmatrix}1& 2\\3& 4\\ \end{vmatrix}$, Vmatrix $\begin{Vmatrix}1& 2\\3& 4\\ \end{Vmatrix}$.

3. Use \cdots $\cdots$ \ddots $\ddots$ vdots $\vdots$ when you want to omit some of the entries:

$$\begin{pmatrix} 1 & a_1 & a_1^2 & \cdots & a_1^n \\ 1 & a_2 & a_2^2 & \cdots & a_2^n \\ \vdots & \vdots& \vdots & \ddots & \vdots \\ 1 & a_m & a_m^2 & \cdots & a_m^n \end{pmatrix}$$

4. For “augmented” matrices, put parentheses or brackets around a suitably-formatted table; see arrays below for details. Here is an example:

$$\left[\begin{array}{cc|c} 1& 2& 3\\ 4& 5& 6 \end{array}\right]$$

is produced by:

The cc|c is the crucial part here; it says that there are three centered columns with a vertical bar between the second and third.

5. For small inline matrices use \bigl(\begin{smallmatrix} ... \end{smallmatrix}\bigr), e.g. $\bigl( \begin{smallmatrix} a & b \\ c & d \end{smallmatrix} \bigr)$ is produced by: