Matrices
Use
$$\begin{matrix}…\end{matrix}$$In between the\beginand\end, put the matrix elements. End each matrix row with\\, and separate matrix elements with&. For example,$$ \begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix} $$$$ \begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix} $$produces:
$$ \begin{matrix} 1 & x & x^2 \\ 1 & y & y^2 \\ 1 & z & z^2 \\ \end{matrix} $$
$$ \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.
To add brackets, either use
\left…\rightas in section 6 of the tutorial, or replacematrixwithpmatrix$\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}$.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}$$
For horizontally "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:
$$ \left[ \begin{array}{cc|c} 1&2&3\\ 4&5&6 \end{array} \right] $$ 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.
- For vertically "augmented" matrices, use
\hline. For example
$$ \begin{pmatrix} a & b \\ c & d\\ \hline 1 & 0\\ 0 & 1 \end{pmatrix} $$ is produced by
$$ \begin{pmatrix} a & b\\ c & d\\ \hline 1 & 0\\ 0 & 1 \end{pmatrix} $$ 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:$\bigl( \begin{smallmatrix} a & b \\ c & d \end{smallmatrix} \bigr)$