\documentclass{article} \setlength{\topmargin}{-1cm} % Lines between the 'documentclass' \setlength{\textheight}{23.5cm} % statement and 'begin{document}' comprise \pagestyle{empty} % what is called the preamble. The % particular 'pagestyle' statement used % here eliminates page numbers. \begin{document} \begin{center}\begin{large} Arrays and Matrices \\ \end{large} Matchett, \today \end{center} Arrays are produced in math mode with the \emph{array} command. An array with 4 rows and 3 columns is produced by the following syntax: \begin{verbatim} \begin{array}{***} row1 \\ row2 \\ row3 \\ row4 \end{array} \end{verbatim} Here each * is one of the letters, c, l, or r, and each row consists of 3 entries separated by ampersands. Note that each row ends with a double backslash except for the last row which simply ends with the command that ends the environment. Here is a comprehensive example. If you put the lines, \begin{verbatim} \begin{displaymath} \begin{array}{ccr} 271 & 828 & 182 \\ 4 & 5 & 9 \\ 0 & 8+x & 2 \\ 1 & 2 & 3 \end{array} \end{displaymath} \end{verbatim} in a LaTeX file, the pdf file will have the display, \begin{displaymath} \begin{array}{ccr} 271 & 828 & 182 \\ 4 & 5 & 9 \\ 0 & 8+x & 2 \\ 1 & 2 & 3 \end{array} \end{displaymath} Which of the three letters l, r, and c is used for a particular column determines whether the column is left justified, right justified, or centered. We often want to enclose a matrix in large brackets. This is accomplished by the commands $\backslash$left[ and $\backslash$right]. One could use parentheses, curley braces, or vertical lines as large delimiters here instead of brackets. So the following syntax: \begin{verbatim} \left[ \begin{array}{cc} 1 & 2 \\ 3 & 4 \end{array} \right) \end{verbatim} produces \begin{displaymath} \left[ \begin{array}{cc} 1 & 2 \\ 3 & 4 \end{array} \right) \end{displaymath} Remember that a curley brace that is to be printed in the pdf file must be preceeded by a backslash in the LaTeX file. LaTeX keeps track of ``left'' and ``right'' delimiters, and requires that they come in left-right pairs. However, as the above example shows, a pair can be mismatched as long as there is a left one and a right one. LaTeX treats an array as a single large character. So arrays may be easily used in equations, like \begin{displaymath} A = \left[ \begin{array}{cc} 8 & 9 \\ u & v \end{array} \right] \end{displaymath} If it is desired to have a large delimiter on only one side of an array, that delimiter can be paired with a period on the other side. Here is an example of that. The latex expression, \begin{verbatim} f(x) = \left\{ \begin{array}{rl} 2x, & x \le 1 \\ 3-x, & x > 1 \end{array} \right. \end{verbatim} produces \begin{displaymath} f(x) = \left\{ \begin{array}{rl} 2x, & x \le 1 \\ 3-x, & x > 1 \end{array} \right. \end{displaymath} in the pdf file. \end{document}