Your TeX code is unbalanced.

\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}

2.

\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}

4.

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