% matrices.tex - example of how to create matrices
%
% Andrew Roberts - 27th April 2004
\documentclass[a4paper]{article}
\usepackage{times}
% The mathptmx package does for maths equations what the times package
% does for the main text. That is, uses scalable fonts rather than the
% default bitmapped ones. This is useful if you later want to convert
% your postscript file to PDF.
\usepackage{mathptmx}
\usepackage{moreverb}
\begin{document}
\title{Creating matrices}
\author{Andrew Roberts}
\date{}
\maketitle
Latex doesn't have a specific matrix command to use. It instead has a
slightly more generalised environment called array. The array
environment is basically is similar, but simpler version of the tabular
environment. Arrays are very flexible, and can be used for many
purposes, but we shall focus on matrices. You can use the array to
arrange and align your data as you want, and then enclose it with
appropriate left and right brackets, and this will give you your matrix.
For a simple 2x2 matrix:
$$ \left[
\begin{array}{ c c }
1 & 2 \\
3 & 4
\end{array} \right]
$$
A more general matrix (with round brackets this time!):
$$ \left(
\begin{array}{c c c c}
x_{11} & x_{12} & \ldots & x_{1n}\\
x_{21} & x_{22} & \ldots & x_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
x_{m1} & x_{m2} & \ldots & x_{mn}\\
\end{array} \right)
$$
\end{document}