# How to create a labelled matrix in LaTeX?

1. May 28, 2008

### rwinston

Hi

does anybody know how to create a labelled matrix in LaTeX? By which I mean something like this:
a b
a [ 1 0 ]
b [ 0 1 ]

Where the inner elements are within the braces, but there are tabular label elements for the rows and columns (a and b). Cant get it too look right!

Cheers

2. May 28, 2008

### alphysicist

Hi rwinston,

If you don't mind parenthesis instead of braces you can use bordermatrix from plain TeX:

$$\bordermatrix{&a_1&a_2& a_3 \cr b_1 & 1 & 2 & 3 \cr b_2 & 2 & 3 & 4 \cr b_3 & 3 & 4 & 5 \cr}$$

$$\bordermatrix{&a_1&a_2\cr b_1 & 1 & 2 \cr b_2 & 2 & 3 \cr}$$

$$\bordermatrix{&a_1&a_2 \cr b_1 & 1 & 2 \cr b_2 & 2 & 3 \cr b_3 & 3 & 4 \cr}$$

There is also a newer kbordermatrix package that you can use that gives more options (such as being able to change the delimiters).

3. Jun 10, 2008

### rwinston

Thanks! Thats exactly what I need!