Arrays

The array environment is provided for typesetting arrays and array-like material. It accepts two arguments, one optional and one mandatory. The optional argument specifies the vertical alignment of the array—use t, b, or c to align the top, bottom, or centre of the array with the centreline of the line it occurs on (the default being c). The second argument is as for the tabular environment: a series of l, r, and c's that specify the number of columns and the justification of these columns. The body of the array environment uses the same syntax as the tabular environment to specify the individual entries of the array.

For instance the input

0.1

... let $A = \begin{array}{rrr}
12 & 3 & 4\\
-2 & 1 & 0\\
3 & 7 & 9
\end{array}$ ...
will produce the output

let A = $\left[\vphantom{\begin{array}{rrr}
12 & 3 & 4\\
-2 & 1 & 0\\
3 & 7 & 9
\end{array}}\right.$$\begin{array}{rrr}
12 & 3 & 4\\
-2 & 1 & 0\\
3 & 7 & 9
\end{array}$$\left.\vphantom{\begin{array}{rrr}
12 & 3 & 4\\
-2 & 1 & 0\\
3 & 7 & 9
\end{array}}\right]$

Note that we had to choose and supply the enclosing brackets ourselves (they are not placed for us so that we can use the array environment for array-like material; also, we get to choose what type of brackets we want this way). As in the tabular environment, the scope of a command given inside a matrix entry is restricted to that entry.

We can use ellipsis within arrays as in the following example:

0.1

\det A = \left| \begin{array}{cccc}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{array} \right|
which produces

det A = $\left\vert\vphantom{ \begin{array}{cccc}
a_{11} & a_{12} & \cdots & a_{1n}\\
...
...ts & \ddots & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{array} }\right.$$\begin{array}{cccc}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cd...
...ts & \vdots & \ddots & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{array}$$\left.\vphantom{ \begin{array}{cccc}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{2...
... \ddots & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{array} }\right\vert$

The array environment is often used to typeset material that is not, strictly speaking, an array:

0.1

f(x) = \left\{ \begin{array}{ll}
   x & \mbox{for $x<1$}\\
 x^2 & \mbox{for $x \geq 1$}  
\end{array} \right.
which will yield

f (x) = $\left\{\vphantom{ \begin{array}{ll}
x & \mbox{for $x<1$}\\
x^2 & \mbox{for $x \geq 1$}
\end{array} }\right.$$\begin{array}{ll}
x & \mbox{for $x<1$}\\
x^2 & \mbox{for $x \geq 1$}
\end{array}$