A solution suggested by @Fe_Y in How can I label the columns and rows of a matrix? - #2 by Fe_Y is to use a table in math mode.
A solution suggested by @Fe_Y in How can I label the columns and rows of a matrix? - #2 by Fe_Y is to use a table in math mode.