# Matrices in Latex

• Mar 17th 2012, 09:04 PM
Bernhard
Matrices in Latex
In the advanced algebra post I recently tried to use latex to express mathis using 3 x 3 matrices and had problems

Here was my attempt to write the 3 x 3 identity matrix - I put the following code in between $and$

\left(\begin{array}{ccc}1&0&0\\0&1&0\\0&0&1\end{ar ray}\right)

Can someone please tell me my error here?

Further, does anyone know of a brief and easy to use document describing how to present matrices in latex?

Peter
• Mar 18th 2012, 01:22 AM
sbhatnagar
Re: Matrices in Latex

\left(\begin{array}{ccc}1&0&0\\0&1&0\\0&0&1\end{ar ray}\right)

You left a space between "ar" and "ray". If you replace "ar ray" with "array", your code will work fine. Here's a more better way of creating matrices:

1.
\begin{pmatrix} a & b &c \\ d & e & f \\ g & h & i \end{pmatrix}

$\begin{pmatrix} a & b &c \\ d & e & f \\ g & h & i\end{pmatrix}$

2.

\begin{bmatrix} a & b &c \\ d & e & f \\ g & h & i \end{bmatrix}

$\begin{bmatrix} a & b &c \\ d & e & f \\ g & h & i\end{bmatrix}$

3.
\begin{vmatrix} a & b &c \\ d & e & f \\ g & h & i \end{vmatrix}

$\begin{vmatrix} a & b &c \\ d & e & f \\ g & h & i\end{vmatrix}$

4.
\begin{Bmatrix} a & b &c \\ d & e & f \\ g & h & i \end{Bmatrix}

$\begin{Bmatrix} a & b &c \\ d & e & f \\ g & h & i\end{Bmatrix}$